GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » TGeoManager and TGeoVolume
TGeoManager and TGeoVolume [message #5963] Mon, 25 February 2008 16:21 Go to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 507
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: 141.30.85*
Hi all,

I have a root geometry file which contains a new design of the MVD. However, it is inside a TGeoManager object in the file. My main problem is that there can be only one TGeoManager in the simulation. This forbids me to load the stored manager from the file and subsequently adding the volumes to the global gGeoManager.
I tried to do a workaround by storing the Volumes in a new root file without the manager:
Toggle Spoiler

Loading this to the simulation does not work and it seems that only the top volume is stored, but not the subsequent ones.
Does have someone (Mohammed? Tobias(currently N/A)?) have experience with this?
I suppose there shall be some intelligent recursive loop over all entries in the file. Is there maybe a possibility to load the volumes directly and bypassing this stored geomanager?

Kind greetings from Dresden, Ralf.
Re: TGeoManager and TGeoVolume [message #5965 is a reply to message #5963] Mon, 25 February 2008 21:29 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hi,

Reading a TGeoManager from file is on my long todo list since last year! it is not implimented yet but in principle it is easy to do! I hope I will do this in the next few weeks!

Mohammad
Re: TGeoManager and TGeoVolume [message #5969 is a reply to message #5963] Tue, 26 February 2008 08:33 Go to previous messageGo to next message
Aleksandra Wronska is currently offline  Aleksandra Wronska
Messages: 38
Registered: May 2006
Location: Cracow
continuous participant
From: *if.uj.edu.pl
Hi Ralf,

in macro/dch/createRootGeoFile.C you can find how we do it for the drift chambers (and it works Wink). Simply

TGeoVolume *top = gGeoMan->MakeBox("top",gGeoMan->GetMedium("air"),350,100,800);
gGeoMan->SetTopVolume(top);
//..
//filling the top volume
//...
TFile* fi = new TFile(outfile,"RECREATE");
top->Write();
fi->Close();


does the job, including top's content (i.e. recursively).

I hope this helps,
ola
Re: TGeoManager and TGeoVolume [message #5970 is a reply to message #5963] Tue, 26 February 2008 11:17 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 507
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: 141.30.85*
Hello,

It seems that the geometry volumes are stored but not the medium information. Examining the rootfile contents I see:
index.php?t=getfile&id=4218&private=0
The first one is the geomanagter and the second one just the stored top volume (which indeed seems to dive into the subvolumes) when exporting.
Do I need the additional Material, Media and Local transformations directories? Because when I run the simulation with this Mvd_20a_vol.root file it crashes somewhere inside Geant4.
Simulation output:
Toggle Spoiler

where the gdb output gives (I marked suspicious things):
Toggle Spoiler


Ralf.
  • Attachment: scr1.jpg
    (Size: 24.75KB, Downloaded 789 times)
Re: TGeoManager and TGeoVolume [message #5971 is a reply to message #5970] Tue, 26 February 2008 11:36 Go to previous messageGo to next message
Aleksandra Wronska is currently offline  Aleksandra Wronska
Messages: 38
Registered: May 2006
Location: Cracow
continuous participant
From: *if.uj.edu.pl
Hi Ralf,

when creating dch geometry, I use the Pandaroot libraries in the macro (and thus have access to the CBMGeom manager and media definitions). I create the media in the macro in order to use them there. Their names are stored in the final geometry file, but not the definitions. So each volume has the information from which material it is built, but you have to make sure later on in the program (when loading the geometry), that the material is created there as well (at least I guess so).

ola

Re: TGeoManager and TGeoVolume [message #5975 is a reply to message #5970] Tue, 26 February 2008 12:56 Go to previous messageGo to next message
Aleksandra Biegun is currently offline  Aleksandra Biegun
Messages: 64
Registered: May 2007
Location: Groningen
continuous participant
From: *KVI.nl
Hi Ralf,

I think, even when you do not have information about Media and Materials, you check it into your pandaroot/mvd/MvdMC/PndMvdDetector.cxx class (void PndMvdDetector::ExpandNode(TGeoNode *fN){... function) and the problem with G4 might comes from overlapped volumes in your geometry (I had similar problem with FwEndCap and I changed TGeoVolume() to TGeoVolumeAssembly() ).

Ciao,
Ola.


Aleksandra Biegun
University of Groningen/KVI
Zernikelaan 25, 9747 AA Groningen
tel. +31 50 363 3630
fax. +31 50 363 4003
Re: TGeoManager and TGeoVolume [message #5976 is a reply to message #5963] Tue, 26 February 2008 13:19 Go to previous messageGo to next message
George Serbanut is currently offline  George Serbanut
Messages: 4
Registered: May 2007
occasional visitor
From: *to.infn.it
Hi,

I experienced that problem as well and I managed to worked around that problem. If you inherit CbmDetector for your class, you have access to gGeoManager which is the simulation manager (the instance of TGeoManager). Once you registered the materials (as materials or mixtures) and media in gGeoManager, all you have to do is to set the geometry which, in the case you are not using the "standard" way (meaning, in ConstructGeometry member), you can register your volumes to gGeoManager by accessing gGeoManager->AddVolume(<volume>), and to access it further (in any other member) by calling gGeoManager->GetVolume("<volume name>"). For more information, have a look on http://root.cern.ch/root/html/TGeoManager.html (gGeoManager is the instance of that class).

You will need one more thing: register your class in the DB (see the examples how to register a class of parameters in DB).

Good luck!
George
Re: TGeoManager and TGeoVolume [message #5978 is a reply to message #5963] Tue, 26 February 2008 17:15 Go to previous message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 507
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: 141.30.85*
Hi again,

I Did some checks and there are no overlapping volumes. If I run only one event it does not crash and in the resulting sim file the geometry is there! This are the good news. I can drw them, everything seems to be fine.

Now coming to the Problems: After the 7th event Geant4 crashed, Geant3 too.
After commenting the line which set the momentum range it ran... This is not a good sign and here might come soon some further problems. We will see.



So my conclusion is now as simple as this:
To get the geometry out of a file with a TGeoManager objec, just make a script with
Quote:

TFile* file = new TFile("../geometry/geo_with_manager.root");
TGeoManager *geoMan = (TGeoManager*) file->Get("ManagerName");
TGeoVolume* topvol = geoMan->GetMasterVolume();
topvol->Export("../geometry/geo_volumes_only.root","VolumeName","recreate ");


And then load these Volumes like in PndMvdDetector::ConstructRootGeometry() (pandaroot/mvd/MvdMC/MvdDetector.cxx)

Thanks for the help.
Happy greetings from Dresden, Ralf.

[Updated on: Tue, 26 February 2008 17:20]

Report message to a moderator

Previous Topic: Includes for MacOs X for different detectors.
Next Topic: root files with the same hitcolection structure
Goto Forum:
  


Current Time: Mon Dec 02 17:05:57 CET 2024

Total time taken to generate the page: 0.00584 seconds