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