Event server (Mihai)
[u/mrichter/AliRoot.git] / STEER / STEER / AliGeomManager.h
CommitLineData
67dd5535 1#ifndef ALI_GEOM_MANAGER_H
2#define ALI_GEOM_MANAGER_H
3
4//
0bf7aade 5// Class for interfacing to the geometry; it also builds and manages the
6// look-up tables for fast access to geometry and alignment information
7// for sensitive alignable volumes:
8// 1) the look-up table mapping unique volume ids to TGeoPNEntries
9// this allows to access directly by means of the unique index
10// the associated symbolic name and original global matrix
11// in addition to the functionality of the physical node
12// associated to a given alignable volume
13// 2) the look-up table of the alignment objects associated to the
14// indexed alignable volumes
67dd5535 15//
16
17#include <TObject.h>
36b010bf 18
19class TGeoManager;
20class TGeoPNEntry;
21class TGeoHMatrix;
67dd5535 22class TObjArray;
23
24class AliAlignObj;
25class AliCDBId;
26class AliCDBParam;
27
28class AliGeomManager: public TObject {
29
30public:
31 enum ELayerID{kInvalidLayer=0,
32 kFirstLayer=1,
33 kSPD1=1, kSPD2=2,
34 kSDD1=3, kSDD2=4,
35 kSSD1=5, kSSD2=6,
36 kTPC1=7, kTPC2=8,
37 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
38 kTOF=15,
39 kPHOS1=16, kPHOS2=17,
40 kHMPID=18,
41 kMUON=19,
3dfc15c0 42 kEMCAL=20,
43 kLastLayer=21};
67dd5535 44
9cb4fe0b 45 static TGeoManager* GetGeometry() { return fgGeometry; }
67dd5535 46
47 static Int_t LayerSize(Int_t layerId);
48 static const char* LayerName(Int_t layerId);
49 static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
50 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId);
51 static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
52 static ELayerID VolUIDToLayer(UShort_t voluid);
53 static UShort_t LayerToVolUIDSafe(ELayerID layerId, Int_t modId);
54 static UShort_t LayerToVolUIDSafe(Int_t layerId, Int_t modId);
55 static ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId);
56 static ELayerID VolUIDToLayerSafe(UShort_t voluid);
57
58 static const char* SymName(UShort_t voluid);
59 static const char* SymName(ELayerID layerId, Int_t modId);
60
67dd5535 61 static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj);
62 static AliAlignObj* GetAlignObj(UShort_t voluid);
63 static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
64
25fad4e5 65 //to be used making a copy of the returned pointer to TGeoHMatrix!!
67dd5535 66 static TGeoHMatrix* GetMatrix(Int_t index);
67 static TGeoHMatrix* GetMatrix(const char *symname);
68 static Bool_t GetTranslation(Int_t index, Double_t t[3]);
69 static Bool_t GetRotation(Int_t index, Double_t r[9]);
70
5d534fe3 71 static Bool_t GetDeltaForBranch(AliAlignObj& aao, TGeoHMatrix &inclusiveD);
72 static Bool_t GetDeltaForBranch(Int_t index, TGeoHMatrix &inclusiveD);
36b010bf 73 static TGeoHMatrix* GetOrigGlobalMatrix(Int_t index);
67dd5535 74 static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m);
75 static Bool_t GetOrigTranslation(Int_t index, Double_t t[3]);
76 static Bool_t GetOrigRotation(Int_t index, Double_t r[9]);
77
78 static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t index);
79 static Bool_t GetTrackingMatrix(Int_t index, TGeoHMatrix &m);
80
36b010bf 81 static void LoadGeometry(const char *geomFileName = NULL);
53dd673d 82 static void SetGeometry(TGeoManager * const geom);
5590c6c3 83 static void CheckOverlapsOverPNs(Double_t threshold);
36b010bf 84
5590c6c3 85 static Bool_t ApplyAlignObjsToGeom(TObjArray& alObjArray, Bool_t ovlpcheck=kFALSE);
67dd5535 86
36b010bf 87 static Bool_t ApplyAlignObjsToGeom(const char* fileName,
67dd5535 88 const char* clArrayName);
36b010bf 89 static Bool_t ApplyAlignObjsToGeom(AliCDBParam* param,
67dd5535 90 AliCDBId& Id);
36b010bf 91 static Bool_t ApplyAlignObjsToGeom(const char* uri, const char* path,
67dd5535 92 Int_t runnum, Int_t version,
93 Int_t sversion);
36b010bf 94 static Bool_t ApplyAlignObjsToGeom(const char* detName, Int_t runnum, Int_t version,
67dd5535 95 Int_t sversion);
36b010bf 96 static Bool_t ApplyAlignObjsFromCDB(const char* AlDetsList);
97 static Bool_t LoadAlignObjsFromCDBSingleDet(const char* detName, TObjArray& alignObjArray);
ff5970a3 98 static Bool_t CheckSymNamesLUT(const char* detsToBeChecked);
4fbb8e9d 99 static Int_t GetNalignable(const char* module);
67dd5535 100
101 ~AliGeomManager();
67dd5535 102
36b010bf 103 private:
104 AliGeomManager();
105 AliGeomManager(const AliGeomManager&);
106 AliGeomManager& operator=(const AliGeomManager&);
107
53dd673d 108 static TGeoHMatrix* GetMatrix(TGeoPNEntry * const pne);
109 static TGeoHMatrix* GetOrigGlobalMatrix(TGeoPNEntry * const pne);
36b010bf 110 static Bool_t GetOrigGlobalMatrixFromPath(const char *path, TGeoHMatrix &m);
67dd5535 111
36b010bf 112 static TGeoPNEntry* GetPNEntry(Int_t index);
113 static TGeoPNEntry* GetPNEntry(ELayerID layerId, Int_t modId);
67dd5535 114
3564f2da 115 static void ResetPNEntriesLUT();
67dd5535 116 static void InitAlignObjFromGeometry();
67dd5535 117 static void InitPNEntriesLUT();
4fbb8e9d 118 static void InitNalignable();
36b010bf 119
120 static TGeoManager* fgGeometry;
67dd5535 121
122 static Int_t fgLayerSize[kLastLayer - kFirstLayer]; // Size of layers
123 static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers
67dd5535 124 static TGeoPNEntry** fgPNEntry[kLastLayer - kFirstLayer]; // TGeoPNEntries
125 static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects
820b4d9e 126// #ifdef MFT_UPGRADE
127// static const Int_t fgkNDetectors = 16; // number of detectors
128// #else
129// static const Int_t fgkNDetectors = 15; // number of detectors
130// #endif
131 static const Int_t fgkNDetectors = 16; // number of detectors // AU
4fbb8e9d 132 static const char * fgkDetectorName[fgkNDetectors] ; // name of detectors
133 static Int_t fgNalignable[fgkNDetectors];
67dd5535 134
3564f2da 135 ClassDef(AliGeomManager, 0); // Manager of geometry information for alignment
67dd5535 136};
137
138#endif