GSI Helmholtzzentrum für Schwerionenforschung
Dear pandaRooters, I am looking for a way to figure out if a GeoManager is existing in a root session or not without crashing the program. Unfortunately I have not found anything up to now, so I wonder if one of you can help me? Looking forward for a positive reply, Tobias
Hallo Tobias, There is two ways to do this: 1. if you know the name of the TGeoManager object, you can use: gROOT->FindObjectAny("ObjectName") this will return a pointer to TGeo if it exist or a zero if not. in case of PandaRoot it is always created with the default name "CBMGeom". 2. In case you do not no the name, you can call: gROOT->GetListOfGeometries() which will return you a TSeqCollection of existing geometries (TGeoManager objects) which you can check if it is empty or has some entries which will be the existing geometries. regards Mohammad
Dear Mohammad, thank you for your fast reply. I will try the options. Cheers, Tobias