New constructors added to AliAlignObj and the derived classes (R.Grosso)
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.h
CommitLineData
c18195b9 1#ifndef ALIALIGNOBJ_H
2#define ALIALIGNOBJ_H
3
fdf65bb5 4//************************************************************************
5// AliAlignObj: alignment base class for the storage of alignment *
6// information for a single volume, that is a translation, a rotation *
7// and a the identity of the volume itself in form of a TGeo path and *
8// as a unique integer identifier *
befe2c08 9//************************************************************************
c18195b9 10#include "TObject.h"
11#include "TString.h"
12#include "TGeoMatrix.h"
13
03b18860 14class AliTrackPoint;
15class AliTrackPointArray;
16
c18195b9 17class AliAlignObj : public TObject {
18
19 public:
20
877c3816 21 enum ELayerID{kInvalidLayer=0,
22 kFirstLayer=1,
98937d93 23 kSPD1=1, kSPD2=2,
befe2c08 24 kSDD1=3, kSDD2=4,
25 kSSD1=5, kSSD2=6,
26 kTPC1=7, kTPC2=8,
27 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
28 kTOF=15,
29 kPHOS1=16, kPHOS2=17,
30 kRICH=18,
98937d93 31 kMUON=19,
32 kLastLayer=20};
d9cc42ed 33 AliAlignObj();
34 AliAlignObj(const char* volpath, UShort_t voluid);
35 AliAlignObj(const char* volpath, ELayerID detId, Int_t modId);
36 AliAlignObj(const AliAlignObj& theAlignObj);
37 AliAlignObj& operator= (const AliAlignObj& theAlignObj);
38 AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
39 virtual ~AliAlignObj();
c18195b9 40
41 //Setters
42 virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
43 virtual void SetTranslation(const TGeoMatrix& m) = 0;
44 virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
45 virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
46 virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
47 Double_t theta, Double_t phi) = 0;
1bfe7ffc 48 virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
49 Double_t psi, Double_t theta, Double_t phi);
c18195b9 50 virtual void SetMatrix(const TGeoMatrix& m) = 0;
51 void SetVolPath(const TString& volpath) {fVolPath=volpath;}
cab6c0d0 52 void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
befe2c08 53 void SetVolUID(ELayerID layerId, Int_t modId);
c18195b9 54
55 //Getters
56 const char *GetVolPath() const {return fVolPath.Data();}
57 UShort_t GetVolUID() const {return fVolUID;}
befe2c08 58 void GetVolUID(ELayerID &layerId, Int_t &modId) const;
c18195b9 59 virtual void GetTranslation(Double_t* tr) const=0;
60 virtual Bool_t GetAngles(Double_t* angles) const=0;
61 virtual void GetPars(Double_t transl[], Double_t rot[]) const=0;
62 virtual void GetMatrix(TGeoHMatrix& m) const=0;
63
d9cc42ed 64 Bool_t IsSortable() const {return kTRUE;}
4b94e753 65 Int_t GetLevel() const;
66 virtual Int_t Compare(const TObject* obj) const;
67
03b18860 68 virtual AliAlignObj& Inverse() const=0;
69
70 void Transform(AliTrackPoint &p) const;
71 void Transform(AliTrackPointArray &array) const;
72
c18195b9 73 void Print(Option_t *) const;
74
98937d93 75 static Int_t LayerSize(Int_t layer) { return fgLayerSize[layer]; }
76 static const char* LayerName(Int_t layer) { return fgLayerName[layer]; }
77
befe2c08 78 static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
46ae650f 79 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId);
befe2c08 80 static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
81 static ELayerID VolUIDToLayer(UShort_t voluid);
03b18860 82
83 static const char* GetVolPath(UShort_t voluid) {
84 Int_t modId;
85 ELayerID layerId = VolUIDToLayer(voluid,modId);
86 return GetVolPath(layerId,modId);
87 }
e7570944 88 static const char* GetVolPath(ELayerID layerId, Int_t modId);
03b18860 89
995ad051 90 Bool_t ApplyToGeometry();
91 static Bool_t GetFromGeometry(const char *path, AliAlignObj &alobj);
92
c5304981 93 static void InitAlignObjFromGeometry();
94 static AliAlignObj* GetAlignObj(UShort_t voluid) {
95 Int_t modId;
96 ELayerID layerId = VolUIDToLayer(voluid,modId);
97 return GetAlignObj(layerId,modId);
98 }
99 static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
100
c18195b9 101 protected:
102
103 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
104 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
105
c5304981 106 static void InitVolPaths();
03b18860 107
c18195b9 108 //Volume identifiers
98937d93 109 TString fVolPath; // Volume path inside TGeo geometry
110 UShort_t fVolUID; // Unique volume ID
111
112 static Int_t fgLayerSize[kLastLayer - kFirstLayer];
113 static const char* fgLayerName[kLastLayer - kFirstLayer];
03b18860 114
7604a026 115 static TString* fgVolPath[kLastLayer - kFirstLayer];
03b18860 116
c5304981 117 static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer];
118
03b18860 119 ClassDef(AliAlignObj, 2)
c18195b9 120};
121
c18195b9 122#endif