GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
TGeoGeometryInitializer.cc
1 #include <string>
2 #include <vector>
3 
4 #include "gear/GEAR.h"
5 #include "geartgeo/TGeoGeometryInitializer.h"
6 #include "TGDMLParse.h"
7 #include "TGeoVolume.h"
8 #include "TGeoManager.h"
9 
10 
11 namespace gear {
12 
17 // TGeoGeometryInitializer * TGeoGeometryInitializer::theInitializer = NULL;
18 
19  // TGeoGeometryInitializer * TGeoGeometryInitializer::getTGeoGeometryInitializer(std::string gdmlFile)
20  // {
21  // if(theInitializer == NULL)
22  // theInitializer = new TGeoGeometryInitializer(gdmlFile);
23  // return theInitializer;
24  // }
25 
26  TGeoGeometryInitializer::TGeoGeometryInitializer(std::string gdmlFile)
27  {
28  TGDMLParse gdmlparser;
29  _geoMgr = new TGeoManager("","");
30  TGeoVolume *top=gdmlparser.GDMLReadFile(gdmlFile.c_str());
31  if(!top)
32  throw ParseException( std::string( "TGeoGeometryInitializer: Could not find GDML file ")
33  + gdmlFile ) ;
34  _geoMgr=top->GetGeoManager();
35  _geoMgr->SetTopVolume(top);
36  _geoMgr->CloseGeometry();
37  }
38 
39 } // namespace gear
ParseException used for parse errors, e.g.
Definition: GEAR.h:65