| 
		
 | 
	
		
		
			| Re: Problem storing the geometry to a root file [message #4745 is a reply to message #4744] | 
			Thu, 26 July 2007 09:46    | 
		 
		
			
				
				
				
					
						  
						Ralf Kliemt
						 Messages: 508 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    | 
		 
		
			
				
				
				
					
						  
						Ralf Kliemt
						 Messages: 508 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     
 
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    | 
		 
		
			
				
				
				
					
						  
						Ralf Kliemt
						 Messages: 508 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 #4793 is a reply to message #4744] | 
			Wed, 01 August 2007 14:28   | 
		 
		
			
				
				
				
					
						  
						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
		
		
		
 |  
	| 
		
	 | 
 
 
 |