CbmRoot
CbmPlatform.cxx
Go to the documentation of this file.
1 /* Generated by Together */
2 #include "CbmPlatform.h"
3 
4 #include "CbmGeoPassivePar.h"
5 #include "CbmGeoPlatform.h"
6 
7 #include "FairGeoInterface.h"
8 #include "FairGeoLoader.h"
9 #include "FairGeoNode.h"
10 #include "FairRun.h"
11 #include "FairRuntimeDb.h"
12 
13 #include "CbmGeometryUtils.h"
14 
15 #include "TList.h"
16 #include "TObjArray.h"
17 
18 #include "TFile.h"
19 #include "TGeoManager.h"
20 #include "TKey.h"
21 
22 
23 CbmPlatform::CbmPlatform() : FairModule(), fCombiTrans(), fVolumeName("") {}
24 
25 CbmPlatform::CbmPlatform(const char* name, const char* title)
26  : FairModule(name, title), fCombiTrans(), fVolumeName("") {}
27 
29 
31  TString fileName = GetGeometryFileName();
32  if (fileName.EndsWith(".root")) {
34  LOG(info) << "Importing Platform geometry from ROOT file "
35  << fgeoName.Data();
37  } else {
38  LOG(info) << "Constructing Platform geometry from ROOT file "
39  << fgeoName.Data();
40  FairModule::ConstructRootGeometry();
41  }
42  } else if (fileName.EndsWith(".geo")) {
43  LOG(info) << "Constructing PLATFORM from ASCII file "
44  << fileName.Data();
46  } else
47  LOG(fatal) << "Geometry format of PLATFORM file " << fileName.Data()
48  << " not supported.";
49 }
50 
52  FairGeoLoader* loader = FairGeoLoader::Instance();
53  FairGeoInterface* GeoInterface = loader->getGeoInterface();
54  CbmGeoPlatform* MGeo = new CbmGeoPlatform();
55  MGeo->setGeomFile(GetGeometryFileName());
56  GeoInterface->addGeoModule(MGeo);
57  Bool_t rc = GeoInterface->readSet(MGeo);
58  if (rc) MGeo->create(loader->getGeoBuilder());
59 
60  TList* volList = MGeo->getListOfVolumes();
61  // store geo parameter
62  FairRun* fRun = FairRun::Instance();
63  FairRuntimeDb* rtdb = FairRun::Instance()->GetRuntimeDb();
64  CbmGeoPassivePar* par =
65  (CbmGeoPassivePar*) (rtdb->getContainer("CbmGeoPassivePar"));
66  TObjArray* fSensNodes = par->GetGeoSensitiveNodes();
67  TObjArray* fPassNodes = par->GetGeoPassiveNodes();
68 
69  TListIter iter(volList);
70  FairGeoNode* node = NULL;
71  FairGeoVolume* aVol = NULL;
72 
73  while ((node = (FairGeoNode*) iter.Next())) {
74  aVol = dynamic_cast<FairGeoVolume*>(node);
75  if (node->isSensitive()) {
76  fSensNodes->AddLast(aVol);
77  } else {
78  fPassNodes->AddLast(aVol);
79  }
80  }
81  ProcessNodes(volList);
82  par->setChanged();
83  par->setInputVersion(fRun->GetRunId(), 1);
84 }
85 
CbmPlatform.h
CbmGeoPlatform
Definition: CbmGeoPlatform.h:6
CbmPlatform::ConstructAsciiGeometry
virtual void ConstructAsciiGeometry()
Definition: CbmPlatform.cxx:51
CbmGeoPassivePar::GetGeoPassiveNodes
TObjArray * GetGeoPassiveNodes()
Definition: CbmGeoPassivePar.h:19
CbmPlatform::CbmPlatform
CbmPlatform()
Definition: CbmPlatform.cxx:23
Cbm::GeometryUtils::IsNewGeometryFile
Bool_t IsNewGeometryFile(TString &filename)
Definition: CbmGeometryUtils.cxx:133
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmGeoPassivePar::GetGeoSensitiveNodes
TObjArray * GetGeoSensitiveNodes()
Definition: CbmGeoPassivePar.h:18
CbmPlatform::ConstructGeometry
virtual void ConstructGeometry()
Definition: CbmPlatform.cxx:30
CbmGeoPassivePar
Definition: CbmGeoPassivePar.h:6
CbmGeoPlatform.h
CbmPlatform::fCombiTrans
TGeoCombiTrans * fCombiTrans
Definition: CbmPlatform.h:23
Cbm::GeometryUtils::ImportRootGeometry
void ImportRootGeometry(TString &filename, FairModule *mod, TGeoMatrix *mat)
Definition: CbmGeometryUtils.cxx:140
CbmPlatform::~CbmPlatform
virtual ~CbmPlatform()
Definition: CbmPlatform.cxx:28
CbmGeometryUtils.h
CbmPlatform
Definition: CbmPlatform.h:9
CbmGeoPassivePar.h