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

Contents of /PamVMC/include/PamVMCDetector.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jun 12 18:39:17 2009 UTC (15 years, 5 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r0, HEAD
Changes since 1.1: +6 -6 lines
File MIME type: text/plain
- Introduced user-defined names of output files and random seeds number.
Users can do it use options of PamVMCApplication constructor:
PamVMCApplication(const char* name,  const char *title, const char*
filename="pamtest", Int_t seed=0).
The Random object that I use is TRandom3 object which has astronomical
large period (in case of default initialization 0). All random generators
in the code use this object by calling of gRandom singleton which keeps
it.

- Corrected TOF digitization routine. No problems with TDC hits due to
hadronic interactions anymore.

- Some small changes was done to compile code under Root 5.23. +
geant4_vmc v. 2.6 without any warnings

- Some classes of PamG4RunConfiguartion was changed for geant4_vmc v.
2.6.Some obsolete classes was deleted as soon as developers implemented
regions.

- Navigation was changed from "geomRootToGeant4" to "geomRoot", because on
VMC web page written that as soon as Geant4 has no option ONLY/MANY
translation of overlapped geometry to Geant4 through VGM could be wrong.
I'd like to stay with Root navigation:
http://root.cern.ch/root/vmc/Geant4VMC.html. This should be default
option.

- New Tracker digitization routine written by Sergio was implemented

- PamVMC again became compatible with geant4_vmc v.2.5 and ROOT 5.20.
 The problem was that ROOT developers introduced in TVirtualMC class a new
method SetMagField and new base class:TVirtualMagField from which
user-defined classes shoukd be derived

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

  ViewVC Help
Powered by ViewVC 1.1.23