]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAlignObj.h
Updated comments (Raffaele)
[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 the alignment    *
6 //   constants for a single volume:                                      *
7 //   -  a displacement (a shift and a rotation) either as                *
8 //      - the 6 doubles which identify it or as                          *
9 //      - the matrix which identifies it                                 *
10 //   -  the identity of the volume itself in form of a symbolic volume   *
11 //      name for alignable volumes, in form of a TGeo path otherwise,    *
12 //      and as a unique integer identifier                               *
13 //************************************************************************
14 #include "TObject.h"
15 #include "TString.h"
16 #include "TGeoMatrix.h"
17
18 class AliTrackPoint;
19 class AliTrackPointArray;
20
21 class AliAlignObj : public TObject {
22
23  public:
24
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                 kRICH=18,
35                 kMUON=19,
36                 kLastLayer=20};
37   AliAlignObj();
38   AliAlignObj(const char* symname, UShort_t voluid);
39   AliAlignObj(const char* symname, ELayerID detId, Int_t modId);
40   AliAlignObj(const AliAlignObj& theAlignObj);
41   AliAlignObj& operator= (const AliAlignObj& theAlignObj);
42   AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
43   virtual ~AliAlignObj();
44
45   //Setters
46   virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
47   virtual void SetTranslation(const TGeoMatrix& m) = 0;
48   virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
49   virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
50   virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
51                Double_t theta, Double_t phi);
52   virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
53                               Double_t psi, Double_t theta, Double_t phi);
54   virtual Bool_t SetMatrix(const TGeoMatrix& m);
55   virtual Bool_t SetLocalMatrix(const TGeoMatrix& m);
56   void  SetSymName(const TString& symname) {fVolPath=symname;}
57   void  SetVolUID(UShort_t voluid) {fVolUID=voluid;}
58   void  SetVolUID(ELayerID layerId, Int_t modId);
59
60   //Getters
61   const char  *GetSymName()    const {return fVolPath.Data();}
62   UShort_t     GetVolUID()     const {return fVolUID;}
63   void         GetVolUID(ELayerID &layerId, Int_t &modId) const;
64   virtual void GetTranslation(Double_t* tr)  const=0;
65   virtual Bool_t GetAngles(Double_t* angles) const=0;
66   virtual Bool_t GetPars(Double_t transl[], Double_t rot[]) const;
67   virtual void GetMatrix(TGeoHMatrix& m) const=0;
68
69   Bool_t   IsSortable() const {return kTRUE;}
70   Int_t         GetLevel() const;
71   virtual Int_t Compare(const TObject* obj) const;
72
73   virtual AliAlignObj& Inverse() const=0;
74
75   void  Transform(AliTrackPoint &p) const;
76   void  Transform(AliTrackPointArray &array) const;
77
78   void  Print(Option_t *) const;
79
80   static Int_t       LayerSize(Int_t layerId);
81   static const char* LayerName(Int_t layerId);
82
83   static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
84   static UShort_t LayerToVolUID(Int_t    layerId, Int_t modId);
85   static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
86   static ELayerID VolUIDToLayer(UShort_t voluid);
87
88   static const char* SymName(UShort_t voluid);
89   static const char* SymName(ELayerID layerId, Int_t modId);
90
91   Bool_t ApplyToGeometry();
92   static Bool_t   GetFromGeometry(const char *symname, AliAlignObj &alobj);
93
94   static AliAlignObj* GetAlignObj(UShort_t voluid);
95   static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
96
97  protected:
98
99   void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
100   Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
101
102   static void InitSymNames();
103   static void InitAlignObjFromGeometry();
104
105   //Volume identifiers
106   TString  fVolPath; // Symbolic volume name; in case could coincide with
107       // the volume path inside TGeo geometry (for non-alignable volumes)
108   UShort_t fVolUID;  // Unique volume ID
109
110   static Int_t       fgLayerSize[kLastLayer - kFirstLayer]; // Size of layers
111   static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers
112
113   static TString*    fgVolPath[kLastLayer - kFirstLayer]; // Symbolic volume names
114   static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects
115
116   ClassDef(AliAlignObj, 2)
117 };
118
119 #endif