/[PAMELA software]/PamVMC_update/include/PamVMCDetector.h
ViewVC logotype

Contents of /PamVMC_update/include/PamVMCDetector.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Oct 15 15:52:29 2013 UTC (11 years, 1 month ago) by formato
Branch: MAIN, rel
CVS Tags: reltag, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
PamVMC update

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 delete n;
60
61 DefineGeometry();
62
63
64 AddMotherProp();
65 if(GetMotherVol()){
66 fdetgeom->SetMotherVol(GetMotherVol());
67 fdetgeom->RegisterNodes();
68 }
69
70
71 }
72
73 //will be mobydyed o register all cuts, defined in map of CCManager
74 virtual void ConstructCuts(){
75
76 TMapIter *n= (TMapIter *)fsubdet.MakeIterator();
77 TObject *o; while( (o=(TObject *) n->Next())) {
78 ((PamVMCDetector*)fsubdet.GetValue(o))->ConstructCuts();
79 }
80
81 DefineCuts();
82 delete n;
83 }
84
85 virtual void InitGeometry(){
86
87 TMapIter *n= (TMapIter *)fsubdet.MakeIterator();
88 TObject *o; while( (o=(TObject *) n->Next())) {
89 ((PamVMCDetector*)fsubdet.GetValue(o))->InitGeometry();
90 }
91
92 SetCuts();
93 delete n;
94 }
95
96 virtual TGeoVolume* GetMotherVol(){ return 0; };
97
98 virtual void InitMC(){
99
100 TMapIter *n= (TMapIter *)fsubdet.MakeIterator();
101 TObject *o; while( (o=(TObject *) n->Next())) {
102 ((PamVMCDetector*)fsubdet.GetValue(o))->InitMC();
103 }
104 delete n;
105 };
106
107
108 TGeoRotation* GetRot(const char*name){ return PamVMCGeoRotMgr::Instance()->GetRot(name); }
109 void AddRot(const char*name, TGeoRotation*rot){ PamVMCGeoRotMgr::Instance()->AddRot(name, rot); }
110
111 void AddMotherProp(TObjArray *mp) { fdetgeom->AddMotherProp(mp); }
112
113 void AddMotherProp() {
114 TMapIter *n= (TMapIter *)fsubdet.MakeIterator();
115 TObject *o=0;
116 while( (o=(TObject *) n->Next())) {
117 AddMotherProp( ((PamVMCDetector*)(fsubdet.GetValue(o)))->GetMotherProp() );
118 }
119 delete n;
120 }
121
122 void SetMotherProp(TGeoVolume *mv, Int_t cn, TGeoMatrix* mx){
123 fdetgeom->SetMotherProp(mv,cn,mx);
124 }
125
126 void SetCC(const char *medname, pCutControl * pCC) {
127 PamVMCCutContMgr::Instance()->SetCutCont(medname, pCC);
128 }
129 pCutControl * GetCC(const char *medname) {
130 return PamVMCCutContMgr::Instance()->GetCutCont(medname);
131 }
132
133 TObjArray* GetMotherProp(){ return fdetgeom->GetMotherProp(); }
134
135 void SetMotherVol(TGeoVolume *mv) { fdetgeom->SetMotherVol(mv); }
136
137 void RegisterNodes() { fdetgeom->RegisterNodes(); }
138
139 Int_t GetMedID(const char* name){ return fdetgeom->GetMedID(name); }
140
141 TGeoMaterial* GetMat(const char* name){ return fdetgeom->GetMat(name); }
142
143 TGeoMedium* GetMed(const char* name){ return fdetgeom->GetMed(name); }
144
145 TGeoVolume* GetVol(const char* name){ return fdetgeom->GetVol(name); }
146
147 virtual void PrintMediumCuts(const Option_t* =""){
148 PamVMCCutContMgr::Instance()->Print();
149 }
150
151 virtual void Print(const Option_t* ="") const {
152 std::cout<<"DETECTOR "<<fdname<<" HIT COLLECTIONS:"<<std::endl;
153 PrintHitColl();
154 PrintGeoColl();
155 }
156
157 virtual void PrintColl(const TMap *tm, const char* label=" HIT COLLECTIONS: ",const Option_t* ="") const {
158
159 std::cout<<"DETECTOR "<<fdname<<label << std::endl;
160 TMapIter *n= (TMapIter *)tm->MakeIterator();
161 TObject *o; while( (o=(TObject *) n->Next())) {
162 ((PamVMCDetectorSD *)tm->GetValue(o))->Print();
163 }
164 delete n;
165 }
166
167 virtual void PrintHitColl(const Option_t* = "") const { PrintColl(&fdetSD," HIT COLLECTION: "); }
168 virtual void PrintGeoColl(const Option_t* = "") const { PrintColl(&fsubdet," SUBDETECTOR COLLECTION: "); }
169
170 ClassDef(PamVMCDetector,1)
171 };
172
173
174 #endif //PAMVMC_DETECTOR_H

  ViewVC Help
Powered by ViewVC 1.1.23