GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Problem storing the geometry to a root file
Problem storing the geometry to a root file [message #4744] Thu, 26 July 2007 09:45 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*
Alexandra Wronska wrote:
Quote:


Hi Ralf,

I am currently looking at the way you implemented the mvd geometry with
the root file (in order to follow it for the dch). I have some problems
with how the volumes and nodes are added. All physical volumes seem to
be sensitive (should it be so?) and, moreover, when after running macro
I type:

geo=(TGeoManager*)gROOT->FindObject("CBMGeom");
geo->GetListOfVolumes()->Print();

I get a core dump. This is not the case when one uses the ".geo"
interface (checked for the tpc). Do you have any clue? If so, we could
chat tomorrow on skype.

Have fun with debugging Wink

ola



Re: Problem storing the geometry to a root file [message #4745 is a reply to message #4744] Thu, 26 July 2007 09:46 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*
Ralf Kliemt replied:
Quote:


Hi Ola,

I have tried to get your problem, but I won't get it.
The main thing is, I think, how the root file geometry is produced. In
the Mvd case Tobias Stockmanns did the work here. He built a converter
from the step file format to root objects. He pointed out to me that it
was somehow important to give a complete TGeoManager into the rootfile
itself.

pandaroot/mvd/MvdMC/MvdDetector.cxx is the you should look into, since
the volume handling is done there.

Concerning the sensitive volumes there is a list of name parts of your
sensitives. The detector names are used to identify them. When the name
contains one of the names in the sensitives list, it is added to the
sensitive volume list from geant.


like:
---
fListOfSensitives.push_back("StripSensor");
fListOfSensitives.push_back("SensorActiveArea");
---

---
bool MvdDetector::CheckIfSensitive(std::string name)
{
for (int i = 0; i < fListOfSensitives.size(); i++){
if (name.find(fListOfSensitives[i]) != std::string::npos)
return true;
}
return false;
}
---

---
if (CheckIfSensitive(v->GetName())){
AddSensitiveVolume(v);
}
---




I hope this helps.
Kind regards, Ralf.


PS:
Skype is no problem for me. In any other case I would not have given my
name to the list.
I'm a very friend of the pandaroot forum. Maybe I'll put these emails
into a thread there...

[Updated on: Thu, 26 July 2007 09:47]

Report message to a moderator

Re: Problem storing the geometry to a root file [message #4746 is a reply to message #4744] Thu, 26 July 2007 09:47 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*
Alexandra Wronska replied:
Quote:


Hi Ralf,

I create the dch geometry "by hand" (=in a macro) and export it into a
file. I tried several options: saving the top node or the complete
TGeoManager. The latter failed completely because framework has already
one TGeoManager of its own (CBMGeom) and although they differed by name
and were refered to by pointers, the program seemed to be confused
anyway Sad

I found your MvdDetector.cxx, of course. Concerning sensitive volumes,
my concern was that you add them when looping over nodes, while some
nodes are copies of the same volume. There, I guess, there is no need to
add it to the list of sensitive volumes many times (?).
What I observed for dch was that although I add explicitely 8 volumes to
the list of sensitives, Geant statistics say there are 17 sensitive
volumes (all built TGeoVolumes seem to be sensitive).

Anyway, the code works somehow, but the final core dump worries me and I
do not know how to fix this. And you say you do not observe it? Do you
work in gsi or locally?

Re: Problem storing the geometry to a root file [message #4748 is a reply to message #4744] Thu, 26 July 2007 14:33 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*
In the source of Tobias' converter I found this structure to save the geometry objects into a root file:

TGeoManager* geom;                                                                                                                                      
TGeoVolume* topNode;                                                                                                                                    
std::map<std::string,TGeoMedium*> MediumMap;   


geom = new TGeoManager("myGeomanager","Production of Root Geometry Objects");                                          
  
TGeoMaterial *matVacuum = new TGeoMaterial("vacuum",0,0,0);                                                                                             
MediumMap["Vacuum"] = new TGeoMedium("vacuum", 1, matVacuum);                                                                                       

topNode = geom->MakeBox("TOP",MediumMap["Vacuum"],1000,1000,1000);
geom->SetTopVolume(topNode);


[.....]
topNode->AddNode(....);
[.....]


geom->CloseGeometry();                    
geom->Export("myGeo.root");   


The main things are, as far as I see, to close the Geo Manager and do the TGeoManager::Export(). Maybe it is enough to store the topNode.... I don't know.

Ralf.
Re: Problem storing the geometry to a root file [message #4754 is a reply to message #4748] Fri, 27 July 2007 14: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: *ghnet.pl
Hi again, Ralf and others,

the recipe you sent me seems inconsistent with the structure of file MVD14.root. If you simply call gGeoMan->Export(), after re-opening the file you havehas only a key to that gGeoMan, while in your file you get the key to the object of type TGeoVolume.

I am working in gsi.

I do not really know how to debug macros efficiently. If I get a segfault in a certain event, how to get a detailed info which object/method has caused it?

cheers,
ola
Re: Problem storing the geometry to a root file [message #4793 is a reply to message #4744] Wed, 01 August 2007 14:28 Go to previous message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Hi Root-GeoFile-Users,

root is not able to handle two TGeoManagers at the same time. Thus the root file with the MVD geometry data does not have a TGeoManager. Therefore you cannot open this file to view the geometry. This is the reason why I have two options in my CADConverter. One with a TGeoManager and one without. The first is used to check the geometry the second for import into PandaRoot.

The code written in PandaRoot to load in the root geometry files is comming from Mohammad.

I hope this helps a bit.

Cheers,

Tobias
Previous Topic: Computing Wiki
Next Topic: Geometry update
Goto Forum:
  


Current Time: Sun Apr 28 22:41:47 CEST 2024

Total time taken to generate the page: 0.00836 seconds