Fix Jira issues #ROOT-8722 and ROOT-8723
Fix Jira issues #ROOT-8722 and ROOT-8723

Add a few tests like "if (obj->IsA() != TClass::Class())" to prevent casting a TClass object to its class type.
For example: if (obj->InheritsFrom("TDirectory")) returns true in the case of obj being a TClass (of a TDirectory class); then, calling ((TDirectory *)obj)->GetListOfKeys() fails (crash or random behavior)

olifre/root,zzxuanyuan/root,agarciamontoro/root,BerserkerTroll/root,root-mirror/root,beniz/root,beniz/root,bbockelm/root,zzxuanyuan/root-compressor-dummy,beniz/root,bbockelm/root,root-mirror/root,olifre/root,karies/root,bbockelm/root,mhuwiler/rootauto,simonpf/root,zzxuanyuan/root-compressor-dummy,karies/root,zzxuanyuan/root-compressor-dummy,olifre/root,satyarth934/root,zzxuanyuan/root-compressor-dummy,zzxuanyuan/root-compressor-dummy,karies/root,root-mirror/root,mhuwiler/rootauto,root-mirror/root,satyarth934/root,simonpf/root,mhuwiler/rootauto,beniz/root,mhuwiler/rootauto,olifre/root,olifre/root,BerserkerTroll/root,BerserkerTroll/root,bbockelm/root,buuck/root,zzxuanyuan/root-compressor-dummy,satyarth934/root,karies/root,olifre/root,beniz/root,zzxuanyuan/root,simonpf/root,buuck/root,bbockelm/root,davidlt/root,simonpf/root,BerserkerTroll/root,davidlt/root,zzxuanyuan/root,beniz/root,root-mirror/root,beniz/root,satyarth934/root,davidlt/root,simonpf/root,root-mirror/root,olifre/root,satyarth934/root,davidlt/root,buuck/root,BerserkerTroll/root,karies/root,bbockelm/root,mhuwiler/rootauto,agarciamontoro/root,satyarth934/root,bbockelm/root,beniz/root,mhuwiler/rootauto,davidlt/root,BerserkerTroll/root,davidlt/root,zzxuanyuan/root-compressor-dummy,bbockelm/root,davidlt/root,simonpf/root,simonpf/root,olifre/root,buuck/root,buuck/root,root-mirror/root,BerserkerTroll/root,buuck/root,mhuwiler/rootauto,mhuwiler/rootauto,zzxuanyuan/root,root-mirror/root,karies/root,davidlt/root,buuck/root,zzxuanyuan/root,satyarth934/root,agarciamontoro/root,agarciamontoro/root,zzxuanyuan/root-compressor-dummy,beniz/root,davidlt/root,beniz/root,agarciamontoro/root,BerserkerTroll/root,olifre/root,beniz/root,agarciamontoro/root,zzxuanyuan/root,mhuwiler/rootauto,BerserkerTroll/root,buuck/root,zzxuanyuan/root-compressor-dummy,karies/root,agarciamontoro/root,bbockelm/root,BerserkerTroll/root,olifre/root,karies/root,satyarth934/root,zzxuanyuan/root,mhuwiler/rootauto,BerserkerTroll/root,zzxuanyuan/root,bbockelm/root,root-mirror/root,davidlt/root,agarciamontoro/root,buuck/root,agarciamontoro/root,agarciamontoro/root,simonpf/root,zzxuanyuan/root,satyarth934/root,simonpf/root,agarciamontoro/root,satyarth934/root,zzxuanyuan/root-compressor-dummy,karies/root,zzxuanyuan/root,karies/root,karies/root,buuck/root,simonpf/root,zzxuanyuan/root,root-mirror/root,simonpf/root,buuck/root,zzxuanyuan/root-compressor-dummy,satyarth934/root,root-mirror/root,mhuwiler/rootauto,davidlt/root,olifre/root,zzxuanyuan/root,bbockelm/root