FairRoot/PandaRoot
PndMagnet.cxx
Go to the documentation of this file.
1 /* Generated by Together */
2 
3 #include "PndMagnet.h"
4 #include "FairGeoLoader.h"
5 #include "FairGeoInterface.h"
6 #include "PndGeoMagnet.h"
7 #include "FairGeoRootBuilder.h"
8 #include "FairRuntimeDb.h"
9 #include "PndGeoPassivePar.h"
10 #include "TObjArray.h"
11 #include "FairRun.h"
12 #include "FairGeoVolume.h"
13 #include "FairGeoNode.h"
14 
16 {
17 }
19 {
20 }
21 
22 PndMagnet::PndMagnet(const char * name, const char *Title)
23  : FairModule(name ,Title)
24 {
25 }
26 
28 
29  TString fileName=GetGeometryFileName();
30  if (fileName.EndsWith(".geo")) {
32  } else if(fileName.EndsWith(".root")) {
33  ConstructRootGeometry();
34  } else {
35  std::cout<< "Geometry format not supported " <<std::endl;
36  }
37 }
38 
40  // just to get rid of the warrning during run, not need this is a passive element!
41  (void)name; // get rid of "unused" warning
42  return kFALSE;
43 }
44 
46  FairGeoLoader *loader=FairGeoLoader::Instance();
47  FairGeoInterface *GeoInterface =loader->getGeoInterface();
48  PndGeoMagnet *MGeo=new PndGeoMagnet();
49  MGeo->setGeomFile(GetGeometryFileName());
50  GeoInterface->addGeoModule(MGeo);
51  Bool_t rc = GeoInterface->readSet(MGeo);
52  if ( rc ) MGeo->create(loader->getGeoBuilder());
53 
54  TList* volList = MGeo->getListOfVolumes();
55  // store geo parameter
56  FairRun *fRun = FairRun::Instance();
57  FairRuntimeDb *rtdb= FairRun::Instance()->GetRuntimeDb();
58  PndGeoPassivePar* par=(PndGeoPassivePar*)(rtdb->getContainer("PndGeoPassivePar"));
59  TObjArray *fSensNodes = par->GetGeoSensitiveNodes();
60  TObjArray *fPassNodes = par->GetGeoPassiveNodes();
61 
62  TListIter iter(volList);
63  FairGeoNode* node = NULL;
64  FairGeoVolume *aVol=NULL;
65 
66  while( (node = (FairGeoNode*)iter.Next()) ) {
67  aVol = dynamic_cast<FairGeoVolume*> ( node );
68  if ( node->isSensitive() ) {
69  fSensNodes->AddLast( aVol );
70  }else{
71  fPassNodes->AddLast( aVol );
72  }
73  }
74  ProcessNodes( volList );
75  par->setChanged();
76  par->setInputVersion(fRun->GetRunId(),1);
77 }
78 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
virtual ~PndMagnet()
Definition: PndMagnet.cxx:15
TObjArray * GetGeoPassiveNodes()
Double_t par[3]
FairRunAna * fRun
Definition: hit_dirc.C:58
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
Bool_t CheckIfSensitive(std::string name)
Definition: PndMagnet.cxx:39
TString name
void ConstructASCIIGeometry()
Definition: PndMagnet.cxx:45
void ConstructGeometry()
Definition: PndMagnet.cxx:27
ClassImp(PndAnaContFact)
TObjArray * GetGeoSensitiveNodes()