]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAlignObj.h
New version of alignment framework.
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.h
1 #ifndef ALIALIGNOBJ_H
2 #define ALIALIGNOBJ_H
3
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                                      *
9 //************************************************************************
10 #include "TObject.h"
11 #include "TString.h"
12 #include "TGeoMatrix.h"
13
14 class AliTrackPoint;
15 class AliTrackPointArray;
16
17 class AliAlignObj : public TObject {
18
19  public:
20
21   AliAlignObj();
22   AliAlignObj(const AliAlignObj& theAlignObj);
23   AliAlignObj& operator= (const AliAlignObj& theAlignObj);
24   AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
25   virtual ~AliAlignObj();
26   enum ELayerID{kInvalidLayer=0,
27                 kFirstLayer=1,
28                 kSPD1=1, kSPD2=2,
29                 kSDD1=3, kSDD2=4,
30                 kSSD1=5, kSSD2=6,
31                 kTPC1=7, kTPC2=8,
32                 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
33                 kTOF=15,
34                 kPHOS1=16, kPHOS2=17,
35                 kRICH=18,
36                 kMUON=19,
37                 kLastLayer=20};
38
39   //Setters
40   virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
41   virtual void SetTranslation(const TGeoMatrix& m) = 0;
42   virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
43   virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
44   virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
45                Double_t theta, Double_t phi) = 0;
46   virtual void SetMatrix(const TGeoMatrix& m) = 0;
47   void  SetVolPath(const TString& volpath) {fVolPath=volpath;}
48   void  SetVolUID(UShort_t voluid) {fVolUID=voluid;}
49   void  SetVolUID(ELayerID layerId, Int_t modId);
50
51   //Getters
52   const char  *GetVolPath()    const {return fVolPath.Data();}
53   UShort_t     GetVolUID()     const {return fVolUID;}
54   void         GetVolUID(ELayerID &layerId, Int_t &modId) const;
55   virtual void GetTranslation(Double_t* tr)  const=0;
56   virtual Bool_t GetAngles(Double_t* angles) const=0;
57   virtual void GetPars(Double_t transl[], Double_t rot[]) const=0;
58   virtual void GetMatrix(TGeoHMatrix& m) const=0;
59
60   virtual AliAlignObj& Inverse() const=0;
61
62   void  Transform(AliTrackPoint &p) const;
63   void  Transform(AliTrackPointArray &array) const;
64
65   void  Print(Option_t *) const;
66
67   static Int_t       LayerSize(Int_t layer) { return fgLayerSize[layer]; }
68   static const char* LayerName(Int_t layer) { return fgLayerName[layer]; }
69
70   static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
71   static UShort_t LayerToVolUID(Int_t    layerId, Int_t modId);
72   static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
73   static ELayerID VolUIDToLayer(UShort_t voluid);
74
75   static const char* GetVolPath(UShort_t voluid) {
76     Int_t modId;
77     ELayerID layerId = VolUIDToLayer(voluid,modId);
78     return GetVolPath(layerId,modId);
79   }
80   static const char* GetVolPath(ELayerID layerId, Int_t modId);
81
82   Bool_t ApplyToGeometry();
83   static Bool_t   GetFromGeometry(const char *path, AliAlignObj &alobj);
84
85  protected:
86
87   void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
88   Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
89
90   void InitVolPaths();
91
92   //Volume identifiers
93   TString  fVolPath; // Volume path inside TGeo geometry
94   UShort_t fVolUID;  // Unique volume ID
95
96   static Int_t       fgLayerSize[kLastLayer - kFirstLayer];
97   static const char* fgLayerName[kLastLayer - kFirstLayer];
98
99   static TString*    fgVolPath[kLastLayer - kFirstLayer];
100
101   ClassDef(AliAlignObj, 2)
102 };
103
104 #endif