1 |
nikolas |
1.1 |
#ifndef PAMVMC_DETECTOR_H |
2 |
|
|
#define PAMVMC_DETECTOR_H |
3 |
|
|
#include <iostream> |
4 |
|
|
|
5 |
|
|
#include <TMap.h> |
6 |
|
|
#include <TObject.h> |
7 |
|
|
#include <TString.h> |
8 |
|
|
|
9 |
|
|
#include "PamVMCSDMgr.h" |
10 |
|
|
|
11 |
|
|
#include "pCutControl.h" |
12 |
|
|
#include "PamVMCCutContMgr.h" |
13 |
|
|
|
14 |
|
|
#include "PamVMCDetectorSD.h" |
15 |
|
|
#include "PamVMCDetGeom.h" |
16 |
|
|
#include "PamVMCGeoRotMgr.h" |
17 |
|
|
|
18 |
|
|
class PamVMCDetGeom; |
19 |
|
|
|
20 |
|
|
class PamVMCDetector : public TObject { |
21 |
|
|
|
22 |
|
|
protected: |
23 |
|
|
|
24 |
|
|
TString fdname; |
25 |
|
|
TMap fdetSD; //map of pointers to SD collection |
26 |
|
|
TMap fsubdet; //map of pointers to subdetectors; |
27 |
|
|
PamVMCDetGeom *fdetgeom; //geometry |
28 |
|
|
// TObjArray fdetmother; //array of pointers to mother volumes and matrix |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
public: |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
PamVMCDetector(const char *dname="NoDetector" ): |
35 |
|
|
fdname(dname), fdetgeom(0) |
36 |
|
|
{ |
37 |
|
|
fdetgeom = new PamVMCDetGeom(dname); |
38 |
|
|
}; |
39 |
|
|
|
40 |
|
|
|
41 |
|
|
virtual ~PamVMCDetector() { |
42 |
|
|
fdetSD.DeleteAll(); |
43 |
|
|
fsubdet.DeleteAll(); |
44 |
|
|
delete fdetgeom; |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
virtual void DefineGeometry() = 0; |
48 |
|
|
|
49 |
|
|
virtual void DefineCuts() = 0; |
50 |
|
|
|
51 |
|
|
void SetCuts() { PamVMCCutContMgr::Instance()->SetCuts(); }; |
52 |
|
|
|
53 |
|
|
virtual void ConstructGeometry(){ |
54 |
|
|
|
55 |
|
|
TMapIter *n= (TMapIter *)fsubdet.MakeIterator(); |
56 |
|
|
TObject *o; while( o=(TObject *) n->Next()) { |
57 |
|
|
((PamVMCDetector*)fsubdet.GetValue(o))->ConstructGeometry(); |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
DefineGeometry(); |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
AddMotherProp(); |
64 |
|
|
if(GetMotherVol()){ |
65 |
|
|
fdetgeom->SetMotherVol(GetMotherVol()); |
66 |
|
|
fdetgeom->RegisterNodes(); |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
|
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
//will be mobydyed o register all cuts, defined in map of CCManager |
73 |
|
|
virtual void ConstructCuts(){ |
74 |
|
|
|
75 |
|
|
TMapIter *n= (TMapIter *)fsubdet.MakeIterator(); |
76 |
|
|
TObject *o; while( o=(TObject *) n->Next()) { |
77 |
|
|
((PamVMCDetector*)fsubdet.GetValue(o))->ConstructCuts(); |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
DefineCuts(); |
81 |
|
|
|
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
virtual void InitGeometry(){ |
85 |
|
|
|
86 |
|
|
TMapIter *n= (TMapIter *)fsubdet.MakeIterator(); |
87 |
|
|
TObject *o; while( o=(TObject *) n->Next()) { |
88 |
|
|
((PamVMCDetector*)fsubdet.GetValue(o))->InitGeometry(); |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
SetCuts(); |
92 |
|
|
|
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
virtual TGeoVolume* GetMotherVol(){ return 0; }; |
96 |
|
|
|
97 |
|
|
virtual void InitMC(){ |
98 |
|
|
|
99 |
|
|
TMapIter *n= (TMapIter *)fsubdet.MakeIterator(); |
100 |
|
|
TObject *o; while( o=(TObject *) n->Next()) { |
101 |
|
|
((PamVMCDetector*)fsubdet.GetValue(o))->InitMC(); |
102 |
|
|
} |
103 |
|
|
}; |
104 |
|
|
|
105 |
|
|
|
106 |
|
|
TGeoRotation* GetRot(const char*name){ return PamVMCGeoRotMgr::Instance()->GetRot(name); } |
107 |
|
|
|
108 |
|
|
void AddMotherProp(TObjArray *mp) { fdetgeom->AddMotherProp(mp); } |
109 |
|
|
|
110 |
|
|
void AddMotherProp() { |
111 |
|
|
TMapIter *n= (TMapIter *)fsubdet.MakeIterator(); |
112 |
|
|
TObject *o=0; |
113 |
|
|
while( o=(TObject *) n->Next()) { |
114 |
|
|
AddMotherProp( ((PamVMCDetector*)(fsubdet.GetValue(o)))->GetMotherProp() ); |
115 |
|
|
} |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
void SetMotherProp(TGeoVolume *mv, Int_t cn, TGeoMatrix* mx){ |
119 |
|
|
fdetgeom->SetMotherProp(mv,cn,mx); |
120 |
|
|
} |
121 |
|
|
|
122 |
|
|
void SetCC(const char *medname, pCutControl * pCC) { |
123 |
|
|
PamVMCCutContMgr::Instance()->SetCutCont(medname, pCC); |
124 |
|
|
} |
125 |
|
|
pCutControl * GetCC(const char *medname) { |
126 |
|
|
return PamVMCCutContMgr::Instance()->GetCutCont(medname); |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
TObjArray* GetMotherProp(){ return fdetgeom->GetMotherProp(); } |
130 |
|
|
|
131 |
|
|
void SetMotherVol(TGeoVolume *mv) { fdetgeom->SetMotherVol(mv); } |
132 |
|
|
|
133 |
|
|
void RegisterNodes() { fdetgeom->RegisterNodes(); } |
134 |
|
|
|
135 |
|
|
Int_t GetMedID(const char* name){ return fdetgeom->GetMedID(name); } |
136 |
|
|
|
137 |
|
|
TGeoMaterial* GetMat(const char* name){ return fdetgeom->GetMat(name); } |
138 |
|
|
|
139 |
|
|
TGeoMedium* GetMed(const char* name){ return fdetgeom->GetMed(name); } |
140 |
|
|
|
141 |
|
|
TGeoVolume* GetVol(const char* name){ return fdetgeom->GetVol(name); } |
142 |
|
|
|
143 |
|
|
virtual void PrintMediumCuts(const Option_t* =""){ |
144 |
|
|
PamVMCCutContMgr::Instance()->Print(); |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
virtual void Print(const Option_t* ="") const { |
148 |
|
|
std::cout<<"DETECTOR "<<fdname<<" HIT COLLECTIONS:"<<std::endl; |
149 |
|
|
PrintHitColl(); |
150 |
|
|
PrintGeoColl(); |
151 |
|
|
} |
152 |
|
|
|
153 |
|
|
virtual void PrintColl(const TMap *tm, const char* label=" HIT COLLECTIONS: ",const Option_t* ="") const { |
154 |
|
|
|
155 |
|
|
std::cout<<"DETECTOR "<<fdname<<label << std::endl; |
156 |
|
|
TMapIter *n= (TMapIter *)tm->MakeIterator(); |
157 |
|
|
TObject *o; while( o=(TObject *) n->Next()) { |
158 |
|
|
((PamVMCDetectorSD *)tm->GetValue(o))->Print(); |
159 |
|
|
} |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
virtual void PrintHitColl(const Option_t* = "") const { PrintColl(&fdetSD," HIT COLLECTION: "); } |
163 |
|
|
virtual void PrintGeoColl(const Option_t* = "") const { PrintColl(&fsubdet," SUBDETECTOR COLLECTION: "); } |
164 |
|
|
|
165 |
|
|
ClassDef(PamVMCDetector,1) |
166 |
|
|
}; |
167 |
|
|
|
168 |
|
|
|
169 |
|
|
#endif //PAMVMC_DETECTOR_H |