]>
Commit | Line | Data |
---|---|---|
67dd5535 | 1 | #ifndef ALI_GEOM_MANAGER_H |
2 | #define ALI_GEOM_MANAGER_H | |
3 | ||
4 | // | |
5 | // Class for interfacing to the geometry; it also builds and manages two | |
6 | // look-up tables for fast access to volumes : | |
7 | // 1) the look-up table mapping unique volume ids to symbolic volume names | |
8 | // 2) the look-up table mapping unique volume ids to TGeoPNEntries | |
9 | // this allows to access directly the functionality of the physical node | |
10 | // associated to a given alignable volume by means of its index | |
11 | // | |
12 | ||
13 | #include <TObject.h> | |
14 | #include <TGeoManager.h> | |
15 | ||
16 | class TObjArray; | |
17 | ||
18 | class AliAlignObj; | |
19 | class AliCDBId; | |
20 | class AliCDBParam; | |
21 | ||
22 | class AliGeomManager: public TObject { | |
23 | ||
24 | public: | |
25 | enum ELayerID{kInvalidLayer=0, | |
26 | kFirstLayer=1, | |
27 | kSPD1=1, kSPD2=2, | |
28 | kSDD1=3, kSDD2=4, | |
29 | kSSD1=5, kSSD2=6, | |
30 | kTPC1=7, kTPC2=8, | |
31 | kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14, | |
32 | kTOF=15, | |
33 | kPHOS1=16, kPHOS2=17, | |
34 | kHMPID=18, | |
35 | kMUON=19, | |
36 | kLastLayer=20}; | |
37 | ||
38 | ||
39 | static Int_t LayerSize(Int_t layerId); | |
40 | static const char* LayerName(Int_t layerId); | |
41 | static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId); | |
42 | static UShort_t LayerToVolUID(Int_t layerId, Int_t modId); | |
43 | static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId); | |
44 | static ELayerID VolUIDToLayer(UShort_t voluid); | |
45 | static UShort_t LayerToVolUIDSafe(ELayerID layerId, Int_t modId); | |
46 | static UShort_t LayerToVolUIDSafe(Int_t layerId, Int_t modId); | |
47 | static ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId); | |
48 | static ELayerID VolUIDToLayerSafe(UShort_t voluid); | |
49 | ||
50 | static const char* SymName(UShort_t voluid); | |
51 | static const char* SymName(ELayerID layerId, Int_t modId); | |
52 | ||
53 | static TGeoPNEntry* GetPNEntry(Int_t index); | |
54 | static TGeoPNEntry* GetPNEntry(UShort_t index); | |
55 | static TGeoPNEntry* GetPNEntry(ELayerID layerId, Int_t modId); | |
56 | ||
57 | static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj); | |
58 | static AliAlignObj* GetAlignObj(UShort_t voluid); | |
59 | static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId); | |
60 | ||
25fad4e5 | 61 | //to be used making a copy of the returned pointer to TGeoHMatrix!! |
67dd5535 | 62 | static TGeoHMatrix* GetMatrix(TGeoPNEntry* pne); |
63 | static TGeoHMatrix* GetMatrix(Int_t index); | |
64 | static TGeoHMatrix* GetMatrix(const char *symname); | |
65 | static Bool_t GetTranslation(Int_t index, Double_t t[3]); | |
66 | static Bool_t GetRotation(Int_t index, Double_t r[9]); | |
67 | ||
68 | static Bool_t GetOrigGlobalMatrix(Int_t index, TGeoHMatrix &m); | |
69 | static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m); | |
70 | static Bool_t GetOrigTranslation(Int_t index, Double_t t[3]); | |
71 | static Bool_t GetOrigRotation(Int_t index, Double_t r[9]); | |
72 | ||
73 | static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t index); | |
74 | static Bool_t GetTrackingMatrix(Int_t index, TGeoHMatrix &m); | |
75 | ||
76 | Bool_t ApplyAlignObjsToGeom(TObjArray* alObjArray); | |
77 | ||
78 | Bool_t ApplyAlignObjsToGeom(const char* fileName, | |
79 | const char* clArrayName); | |
80 | Bool_t ApplyAlignObjsToGeom(AliCDBParam* param, | |
81 | AliCDBId& Id); | |
82 | Bool_t ApplyAlignObjsToGeom(const char* uri, const char* path, | |
83 | Int_t runnum, Int_t version, | |
84 | Int_t sversion); | |
85 | Bool_t ApplyAlignObjsToGeom(const char* detName, Int_t runnum, Int_t version, | |
86 | Int_t sversion); | |
87 | ||
88 | Bool_t ApplyAlignObjsFromCDB(const char* AlDetsList); | |
89 | Bool_t LoadAlignObjsFromCDBSingleDet(const char* detName); | |
90 | ||
91 | ~AliGeomManager(); | |
92 | static AliGeomManager* Instance(); | |
93 | ||
94 | ||
95 | protected: | |
96 | ||
97 | static void InitAlignObjFromGeometry(); | |
98 | static void InitSymNamesLUT(); | |
99 | static void InitPNEntriesLUT(); | |
100 | ||
101 | static Int_t fgLayerSize[kLastLayer - kFirstLayer]; // Size of layers | |
102 | static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers | |
103 | static TString* fgSymName[kLastLayer - kFirstLayer]; // Symbolic volume names | |
104 | static TGeoPNEntry** fgPNEntry[kLastLayer - kFirstLayer]; // TGeoPNEntries | |
105 | static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects | |
106 | ||
107 | private: | |
108 | AliGeomManager(); | |
109 | AliGeomManager(const AliGeomManager&); | |
110 | AliGeomManager& operator=(const AliGeomManager&); | |
111 | ||
25fad4e5 | 112 | static Bool_t ReactIfChangedGeom(); |
67dd5535 | 113 | static Bool_t HasGeomChanged(){return fgGeometry!=gGeoManager;} |
114 | static TGeoManager* fgGeometry; | |
115 | ||
116 | ||
117 | ||
118 | static AliGeomManager* fgInstance; // the AliGeomManager singleton instance | |
119 | ||
120 | TObjArray* fAlignObjArray; // array with the alignment objects to be applied to the geometry | |
121 | ||
122 | void Init(); | |
123 | ||
124 | ClassDef(AliGeomManager, 0); | |
125 | }; | |
126 | ||
127 | #endif |