Reading from TGeoManager does not work [message #13597 is a reply to message #13488] |
Tue, 12 June 2012 18:42 |
Volker Friese
Messages: 365 Registered: April 2004 Location: GSI CBM
|
first-grade participant |
From: *gsi.de
|
|
After trying for a while, I concluded that while reading from a TGeoVolume saved in a ROOT file works, reading from a TGeoManager object in the file does not.
There are some straightforward bugs in FairModule::ConstructRootGeometry().
Line 257
Since v1 is the volume to be copied (the node below the top node), this sets the node n to its first daughter, i.e. the second node level. Consequently, the wrong transformation matrix is applied when adding v1 to the cave.
Line 259
This immediately leads to a segmentation fault, since the newly created volume v1 is deleted when deleting the new TGeoManager (MakeCopyVolume adds it to the volume list of the latter).
However, even after correcting that, I did not manage to read in from TGeoManager in a file. I would be interested if anybody did succeed. I personally dislike the must to define all media in one file (media.geo), which quickly gets unreadable. It seems to me, though, that copying objects (volumes, media, materials etc.) from one TGeoManager to another is not foreseen in the ROOT geometry concept - all copy constructors and assignment operators are protected, and there is a lot of usage of the gGeoManager pointer and automatic registration of objects to it.
So I resolved to writing out a TGeoVolume with the detector geometry in it. This works, but one has to take care:
- Below the top node (volume), there must be a single volume containing the entire (sub-)detector. This can be a virtual (keep-in) volume or a real one. But only the first daughter of the top volume is considered.
- If a medium is assigned whose material name does not correspond to a medium in the TGeoManager (i.e., present in media.geo), the method FairModule::AssignMediumAtImport will create a new medium with the same (material) name but empty properties and assign this to the respective volume. This leads (in my case) to a crash in the transport. It is hard to notice that since there is only a FairLogger output on debug level.
|
|
|