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

Contents of /PamVMC_update/include/PamVMCDetGeom.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Oct 15 15:52:30 2013 UTC (11 years, 1 month ago) by formato
Branch point for: MAIN, rel
File MIME type: text/plain
Initial revision

1 #ifndef PAMVMC_DET_GEOM_H
2 #define PAMVMC_DET_GEOM_H
3 #include <iostream>
4
5 #include <TMap.h>
6 #include <TObject.h>
7 #include <TString.h>
8 #include <TObjString.h>
9 #include <TList.h>
10
11 #include <Riostream.h>
12 #include <TVirtualMC.h>
13 #include <TGeoManager.h>
14 #include <TGeoMatrix.h>
15
16 #include "PamVMCMat.h"
17
18 struct pMotherProp : public TObject{
19
20 TGeoVolume *fmother;
21 Int_t fcopyNo;
22 TGeoMatrix *fmothermatrix;
23
24
25 pMotherProp():fmother(0),fcopyNo(-1),fmothermatrix(0){};
26 pMotherProp(TGeoVolume *mother, Int_t copyNo, TGeoMatrix *mothermatrix):
27 fmother(mother),fcopyNo(copyNo),fmothermatrix(mothermatrix){};
28
29 };
30
31
32 class PamVMCDetGeom : public TObject {
33
34 protected:
35
36 enum kind {MAT,MED,VOL};
37 TString fdname;
38 TMap fdrot; //Map of geometry transformations
39 TObjArray fmotherprop; // Vector of mother volume to be passed as node of other mother volumes
40 TMap fmat; //Map of Material
41 TMap fmix; // Mixtures
42 TMap fmed; // Mediums
43 TMap fvol; // Volumes
44 TGeoVolume *fmother; // Mother volume of the detector in case of any
45
46 public:
47
48
49 PamVMCDetGeom(const char *dname="NoDetGeom" ):
50 fdname(dname), fmother(0)
51 {
52
53 };
54
55
56 virtual ~PamVMCDetGeom() {
57 fdrot.DeleteAll();
58 fmotherprop.Clear();
59 fmat.DeleteAll();
60 fmix.DeleteAll();
61 fmed.DeleteAll();
62 }
63
64
65
66
67 TGeoRotation* GetRot(const char* rot){
68 return (TGeoRotation*)fdrot(rot);
69 }
70
71 Int_t GetMedID(const char *name){ return GetMed(name)->GetId(); }
72
73 TGeoMaterial* GetMat(const char *name){ return (TGeoMaterial*)CheckDef(name,MAT); }
74
75 TGeoMedium* GetMed(const char *name){ return (TGeoMedium*)CheckDef(name,MED); }
76
77 TGeoVolume* GetVol(const char *name){ return (TGeoVolume*)CheckDef(name,VOL); }
78
79 TObject* CheckDef(const char *name, kind k){
80 switch(k){
81 case MAT:
82 return gGeoManager->GetMaterial(name);
83 case MED:
84 return gGeoManager->GetMedium(name);
85 case VOL:
86 return gGeoManager->GetVolume(name);
87 default:
88 return 0;
89 }
90 }
91
92
93 void AddMotherProp(pMotherProp *mp) {SetMotherProp(mp);}
94
95 void AddMotherProp(TObjArray *mp) {fmotherprop.AddAll(mp); }
96
97 void SetMotherProp(pMotherProp *mp) {
98 SetMotherProp(mp->fmother,mp->fcopyNo,mp->fmothermatrix);
99 }
100
101 void SetMotherProp(TGeoVolume *mv, Int_t cn, TGeoMatrix* mx){
102
103 fmotherprop.Add(new pMotherProp(mv,cn,mx) );
104 }
105
106 void SetMotherVol(TGeoVolume *mv) { fmother=mv; }
107
108 TObjArray* GetMotherProp(){ return &fmotherprop;}
109
110 void RegisterNodes() { RegisterNodes(&fmotherprop); }
111
112 void RegisterNodes( TObjArray * to ) {
113 // Some exception or error printout
114 // should be added to signal that fmother is empty
115 if(fmother) {
116 TIterator *p= (TIterator *)(*to).MakeIterator();
117 pMotherProp *k;
118 while( (k=(pMotherProp *) p->Next())) {
119 fmother->AddNode((*k).fmother,(*k).fcopyNo,(*k).fmothermatrix);
120 }
121 delete p;
122 }
123 }
124
125 ClassDef(PamVMCDetGeom,1)
126 };
127
128
129 #endif //PAMVMC_DET_GEOM_H

  ViewVC Help
Powered by ViewVC 1.1.23