EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndMagnet.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndMagnet.cxx
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")) {
34  } else {
35  std::cout<< "Geometry format not supported " <<std::endl;
36  }
37 }
38 
39 Bool_t PndMagnet::CheckIfSensitive(std::string name){
40  // just to get rid of the warrning during run, not need this is a passive element!
41  return kFALSE;
42 }
43 
46  FairGeoInterface *GeoInterface =loader->getGeoInterface();
47  PndGeoMagnet *MGeo=new PndGeoMagnet();
49  GeoInterface->addGeoModule(MGeo);
50  Bool_t rc = GeoInterface->readSet(MGeo);
51  if ( rc ) MGeo->create(loader->getGeoBuilder());
52 
53  TList* volList = MGeo->getListOfVolumes();
54  // store geo parameter
55  FairRun *fRun = FairRun::Instance();
57  PndGeoPassivePar* par=(PndGeoPassivePar*)(rtdb->getContainer("PndGeoPassivePar"));
58  TObjArray *fSensNodes = par->GetGeoSensitiveNodes();
59  TObjArray *fPassNodes = par->GetGeoPassiveNodes();
60 
61  TListIter iter(volList);
62  FairGeoNode* node = NULL;
63  FairGeoVolume *aVol=NULL;
64 
65  while( (node = (FairGeoNode*)iter.Next()) ) {
66  aVol = dynamic_cast<FairGeoVolume*> ( node );
67  if ( node->isSensitive() ) {
68  fSensNodes->AddLast( aVol );
69  }else{
70  fPassNodes->AddLast( aVol );
71  }
72  }
73  ProcessNodes( volList );
74  par->setChanged();
75  par->setInputVersion(fRun->GetRunId(),1);
76 }
77 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92