]>
Commit | Line | Data |
---|---|---|
ce886e8e | 1 | #ifndef ALIITSGEOMTGEOUPG_H |
2 | #define ALIITSGEOMTGEOUPG_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | ///////////////////////////////////////////////////////////////////////// | |
7 | // AliITSgeomTGeoUpg is a simple interface class to TGeoManager // | |
8 | // It is used in the simulation and reconstruction in order to // | |
9 | // query the TGeo ITS geometry // | |
10 | // // | |
11 | // author - cvetan.cheshkov@cern.ch // | |
12 | // 15/02/2007 // | |
13 | // adapted to ITSupg 18/07/2012 - ruben.shahoyan@cern.ch // | |
14 | // RS: in order to preserve the static character of the class but // | |
15 | // make it dynamically access geometry, we need to check in every // | |
16 | // method if the structures are initialized. To be converted to // | |
17 | // singleton at later stage. // | |
18 | // // | |
19 | ///////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | #include <TObject.h> | |
22 | #include <TGeoMatrix.h> | |
23 | ||
24 | class TGeoPNEntry; | |
25 | class TDatime; | |
26 | ||
27 | class AliITSgeomTGeoUpg : public TObject { | |
28 | ||
29 | public: | |
30 | enum {kNLayersOld = 6}; // The number of layers in OLD ITS. | |
31 | enum {kITSVNA, kITSVOld, kITSVUpg}; // ITS version | |
32 | ||
33 | AliITSgeomTGeoUpg() { } // Default constructor | |
34 | virtual ~AliITSgeomTGeoUpg() { }// Destructor | |
35 | ||
36 | // This function returns the total number of ITS modules | |
37 | static Int_t GetNModules() {CheckInit(); return fgNModules;} | |
38 | // This function returns the number of detectors/ladder for a given layer | |
39 | static Int_t GetNDetectors(Int_t lay) {CheckInit(); return (lay<1||lay>fgNLayers) ? 0:fgNDetectors[lay-1];} | |
40 | // This function returns the number of ladders for a given layer | |
41 | static Int_t GetNLadders(Int_t lay) {CheckInit(); return (lay<1||lay>fgNLayers) ? 0:fgNLadders[lay-1];} | |
42 | // This function returns the number of layers | |
43 | static Int_t GetNLayers() {CheckInit(); return fgNLayers;} | |
44 | ||
45 | // Two methods to map module index to layer,ladder,detector indeces | |
46 | static Int_t GetModuleIndex(Int_t lay,Int_t lad,Int_t det); | |
47 | static Bool_t GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det); | |
48 | ||
49 | static const char *GetSymName(Int_t index); // Get TGeoPNEntry symbolic name | |
50 | static const char *GetSymName(Int_t lay,Int_t lad,Int_t det) | |
51 | { return GetSymName(GetModuleIndex(lay,lad,det)); } | |
52 | ||
53 | // This function returns a pointer to the TGeoHMatrix (local->global) | |
54 | // of a given module index | |
55 | static TGeoHMatrix* GetMatrix(Int_t index); | |
56 | static TGeoHMatrix* GetMatrix(Int_t lay,Int_t lad,Int_t det) { return GetMatrix(GetModuleIndex(lay,lad,det)); } | |
57 | ||
58 | static Bool_t GetTranslation(Int_t index, Double_t t[3]); | |
59 | static Bool_t GetTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3]) { return GetTranslation(GetModuleIndex(lay,lad,det),t); } | |
60 | ||
61 | static Bool_t GetRotation(Int_t index, Double_t r[9]); | |
62 | static Bool_t GetRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9]) | |
63 | { return GetRotation(GetModuleIndex(lay,lad,det),r); } | |
64 | ||
65 | // This function returns a pointer to the original TGeoHMatrix (local->global) | |
66 | // for a specific module index | |
67 | static Bool_t GetOrigMatrix(Int_t index, TGeoHMatrix &m); | |
68 | static Bool_t GetOrigMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m) | |
69 | { return GetOrigMatrix(GetModuleIndex(lay,lad,det),m); } | |
70 | ||
71 | static Bool_t GetOrigTranslation(Int_t index, Double_t t[3]); | |
72 | static Bool_t GetOrigTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3]) | |
73 | { return GetOrigTranslation(GetModuleIndex(lay,lad,det),t); } | |
74 | ||
75 | static Bool_t GetOrigRotation(Int_t index, Double_t r[9]); | |
76 | static Bool_t GetOrigRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9]) | |
77 | { return GetOrigRotation(GetModuleIndex(lay,lad,det),r); } | |
78 | ||
79 | static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t index); | |
80 | static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t lay,Int_t lad,Int_t det) | |
81 | { return GetTracking2LocalMatrix(GetModuleIndex(lay,lad,det)); } | |
82 | ||
83 | static Bool_t GetTrackingMatrix(Int_t index, TGeoHMatrix &m); | |
84 | static Bool_t GetTrackingMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m) | |
85 | { return GetTrackingMatrix(GetModuleIndex(lay,lad,det),m); } | |
86 | ||
87 | static Bool_t LocalToGlobal(Int_t index, const Double_t *loc, Double_t *glob); | |
88 | static Bool_t LocalToGlobal(Int_t lay, Int_t lad, Int_t det, | |
89 | const Double_t *loc, Double_t *glob) | |
90 | { return LocalToGlobal(GetModuleIndex(lay,lad,det), loc, glob);} | |
91 | ||
92 | static Bool_t GlobalToLocal(Int_t index, const Double_t *glob, Double_t *loc); | |
93 | static Bool_t GlobalToLocal(Int_t lay, Int_t lad, Int_t det, | |
94 | const Double_t *glob, Double_t *loc) | |
95 | { return GlobalToLocal(GetModuleIndex(lay,lad,det), glob, loc);} | |
96 | ||
97 | static Bool_t LocalToGlobalVect(Int_t index, const Double_t *loc, Double_t *glob); | |
98 | static Bool_t GlobalToLocalVect(Int_t index, const Double_t *glob, Double_t *loc); | |
99 | static void CheckInit() { if (fgVersion==kITSVNA) BuildITS(); } | |
535d15f5 | 100 | static Int_t GetLayerDetTypeID(Int_t lr) {CheckInit(); return (lr<1||lr>fgNLayers||!fgLrDetType) ? -1:fgLrDetType[lr-1];} |
101 | ||
102 | static const char* GetITSVolPattern() {return fgkITSVolName;} | |
103 | static const char* GetITSLayerPattern() {return fgkITSLrName;} | |
104 | static const char* GetITSLadderPattern() {return fgkITSLadName;} | |
105 | static const char* GetITSModulePattern() {return fgkITSModName;} | |
106 | static const char* GetITSSensorPattern() {return fgkITSSensName;} | |
ce886e8e | 107 | |
108 | private: | |
109 | ||
110 | static Bool_t GetLayer(Int_t index,Int_t &lay,Int_t &index2); | |
111 | static TGeoPNEntry* GetPNEntry(Int_t index); | |
112 | static Int_t ExtractNumberOfDetectors(const Int_t lay); | |
113 | static Int_t ExtractNumberOfLadders(const Int_t lay); | |
535d15f5 | 114 | static Int_t ExtractLayerDetType(const Int_t lay); |
ce886e8e | 115 | static Int_t ExtractNumberOfLayers(); |
116 | static Bool_t ReadVersionString(const Char_t *str,Int_t &maj,Int_t &min,TDatime &dt); | |
117 | static void BuildITSUpg(); | |
118 | static void BuildITSOld(); | |
119 | static void BuildITS(); | |
120 | // | |
121 | AliITSgeomTGeoUpg(const AliITSgeomTGeoUpg &geom); // Copy constructor | |
122 | AliITSgeomTGeoUpg& operator=(const AliITSgeomTGeoUpg &geom);// Assignment operator | |
123 | ||
124 | static Int_t fgVersion; // ITS Version | |
125 | static Int_t fgNLayers; // number of layers | |
126 | static Int_t fgNModules; // The total number of modules | |
127 | static Int_t *fgNLadders; // Array of the number of ladders/layer(layer) | |
535d15f5 | 128 | static Int_t *fgLrDetType; // Array of layer detector types |
ce886e8e | 129 | static Int_t *fgNDetectors; // Array of the number of detector/ladder(layer) |
130 | ||
131 | ||
132 | // these are hardwired settings for old ITS | |
133 | static const Int_t fgkNModulesOld; // The total number of modules | |
134 | static const Int_t fgkNLaddersOld[kNLayersOld]; // Array of the number of ladders/layer(layer) | |
135 | static const Int_t fgkNDetectorsOld[kNLayersOld];// Array of the number of detector/ladder(layer) | |
136 | // | |
137 | static const char* fgkITSVolName; // ITS mother volume name | |
138 | static const char* fgkITSLrName; // ITS Layer name | |
139 | static const char* fgkITSLadName; // ITS Ladder name | |
140 | static const char* fgkITSModName; // ITS Module name | |
535d15f5 | 141 | static const char* fgkITSSensName; // ITS Sensor name |
ce886e8e | 142 | |
143 | ClassDef(AliITSgeomTGeoUpg, 0) // ITS geometry based on TGeo | |
144 | }; | |
145 | ||
146 | #endif |