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

Contents of /PamVMC/include/PamVMCDetGeom.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Feb 19 16:50:35 2009 UTC (15 years, 9 months ago) by nikolas
Branch: MAIN
File MIME type: text/plain
Cleaning before committing

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 //delete fmother;
63 }
64
65
66 // virtual void ConstructGeometry()=0;
67
68
69 TGeoRotation* GetRot(const char* rot){
70 return (TGeoRotation*)fdrot(rot);
71 }
72
73
74 Int_t GetMedID(const char *name){ return GetMed(name)->GetId(); }
75
76 TGeoMaterial* GetMat(const char *name){ return (TGeoMaterial*)CheckDef(name,MAT); }
77
78 TGeoMedium* GetMed(const char *name){ return (TGeoMedium*)CheckDef(name,MED); }
79
80 TGeoVolume* GetVol(const char *name){ return (TGeoVolume*)CheckDef(name,VOL); }
81
82 TObject* CheckDef(const char *name, kind k){
83 switch(k){
84 case MAT:
85 return gGeoManager->GetMaterial(name);
86 case MED:
87 return gGeoManager->GetMedium(name);
88 case VOL:
89 return gGeoManager->GetVolume(name);
90 default:
91 return 0;
92 }
93 }
94
95
96 void AddMotherProp(pMotherProp *mp) {SetMotherProp(mp);}
97
98 void AddMotherProp(TObjArray *mp) {fmotherprop.AddAll(mp); }
99
100 void SetMotherProp(pMotherProp *mp) {
101 SetMotherProp(mp->fmother,mp->fcopyNo,mp->fmothermatrix);
102 }
103
104 void SetMotherProp(TGeoVolume *mv, Int_t cn, TGeoMatrix* mx){
105
106 fmotherprop.Add(new pMotherProp(mv,cn,mx) );
107 }
108
109 void SetMotherVol(TGeoVolume *mv) { fmother=mv; }
110
111 TObjArray* GetMotherProp(){ return &fmotherprop;}
112
113 void RegisterNodes() { RegisterNodes(&fmotherprop); }
114
115 void RegisterNodes( TObjArray * to ) {
116 // Some exception or error printout
117 // should be added to signal that fmother is empty
118 if(fmother) {
119 TIterator *p= (TIterator *)(*to).MakeIterator();
120 pMotherProp *k;
121 while( k=(pMotherProp *) p->Next()) {
122 fmother->AddNode((*k).fmother,(*k).fcopyNo,(*k).fmothermatrix);
123 }
124 }
125 }
126
127 ClassDef(PamVMCDetGeom,1)
128 };
129
130
131 #endif //PAMVMC_DET_GEOM_H

  ViewVC Help
Powered by ViewVC 1.1.23