FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairGeoLoader.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /***************************************************************************
9  FairGeoLoader.cxx - description
10  -------------------
11  begin : Thu Jun 17 2004
12  copyright : (C) 2004 by ilse koenig , M. Al-turany
13  email : m.al-turany@gsi.de
14  ***************************************************************************/
15 #include "FairGeoLoader.h"
16 
17 #include "FairGeoInterface.h" // for FairGeoInterface
18 #include "FairGeoRootBuilder.h" // for FairGeoRootBuilder
19 
20 #include <TGeoManager.h> // for TGeoManager
21 #include <cstdlib> // for NULL, exit
22 #include <iostream> // for cout, endl, operator<<, etc
23 #include <string.h> // for strncmp
24 
25 using std::cout;
26 using std::endl;
27 
28 FairGeoLoader* FairGeoLoader::fgInstance = 0;
29 
30 FairGeoLoader* FairGeoLoader::Instance() { return fgInstance; }
31 
33  : TNamed()
34  , fInterface(NULL)
35  , fGeoBuilder(NULL)
36 {
37  fgInstance = this;
38 }
39 
40 FairGeoLoader::FairGeoLoader(const char* Name, const char* title)
41  : TNamed(Name, title)
42  , fInterface(NULL)
43  , fGeoBuilder(NULL)
44 {
45  if (fgInstance) {
46  Fatal("FairGeoLoader", "Singleton instance already exists.");
47  return;
48  }
49  fgInstance = this;
50  fInterface = new FairGeoInterface;
51  if (strncmp(Name, "TGeo", 4) == 0) {
52  TGeoManager* geom = new TGeoManager("FAIRGeom", "FAIR geometry");
53  fGeoBuilder = new FairGeoRootBuilder("TGeo builder", "geometry builder");
54  (static_cast<FairGeoRootBuilder*>(fGeoBuilder))->setGeoManager(geom);
55  } else if (strncmp(Name, "G3Native", 8) == 0) {
56  cout << "-I- FairGeoLoader() : Native G3 Geometry is used: This option is not supported any more!" << endl;
57  exit(0);
58  // gGeoManager = NULL;
59  // fGeoBuilder=new FairGeoG3Builder("G3 builder","geometry builder");
60  }
61 
62  fInterface->setGeomBuilder(fGeoBuilder);
63 }
64 
65 FairGeoLoader::~FairGeoLoader() { delete fInterface; }
66 
virtual ~FairGeoLoader()
static FairGeoLoader * Instance()
ClassImp(FairEventBuilder)
void setGeomBuilder(FairGeoBuilder *p)