4 //************************************************************************
5 // AliAlignObj: alignment base class for the storage of alignment *
6 // information for a single volume, that is a displacement (a shift *
7 // a rotation) plus the identity of the volume itself in form of a *
8 // symbolic volume name (eventually a TGeo path) and as a unique *
9 // integer identifier *
10 //************************************************************************
13 #include "TGeoMatrix.h"
16 class AliTrackPointArray;
18 class AliAlignObj : public TObject {
22 enum ELayerID{kInvalidLayer=0,
28 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
35 AliAlignObj(const char* symname, UShort_t voluid);
36 AliAlignObj(const char* symname, ELayerID detId, Int_t modId);
37 AliAlignObj(const AliAlignObj& theAlignObj);
38 AliAlignObj& operator= (const AliAlignObj& theAlignObj);
39 AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
40 virtual ~AliAlignObj();
43 virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
44 virtual void SetTranslation(const TGeoMatrix& m) = 0;
45 virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
46 virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
47 virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
48 Double_t theta, Double_t phi);
49 virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
50 Double_t psi, Double_t theta, Double_t phi);
51 virtual Bool_t SetMatrix(const TGeoMatrix& m);
52 virtual Bool_t SetLocalMatrix(const TGeoMatrix& m);
53 void SetSymName(const TString& symname) {fVolPath=symname;}
54 void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
55 void SetVolUID(ELayerID layerId, Int_t modId);
58 const char *GetSymName() const {return fVolPath.Data();}
59 UShort_t GetVolUID() const {return fVolUID;}
60 void GetVolUID(ELayerID &layerId, Int_t &modId) const;
61 virtual void GetTranslation(Double_t* tr) const=0;
62 virtual Bool_t GetAngles(Double_t* angles) const=0;
63 virtual Bool_t GetPars(Double_t transl[], Double_t rot[]) const;
64 virtual void GetMatrix(TGeoHMatrix& m) const=0;
66 Bool_t IsSortable() const {return kTRUE;}
67 Int_t GetLevel() const;
68 virtual Int_t Compare(const TObject* obj) const;
70 virtual AliAlignObj& Inverse() const=0;
72 void Transform(AliTrackPoint &p) const;
73 void Transform(AliTrackPointArray &array) const;
75 void Print(Option_t *) const;
77 static Int_t LayerSize(Int_t layerId);
78 static const char* LayerName(Int_t layerId);
80 static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
81 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId);
82 static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
83 static ELayerID VolUIDToLayer(UShort_t voluid);
85 static const char* SymName(UShort_t voluid);
86 static const char* SymName(ELayerID layerId, Int_t modId);
88 Bool_t ApplyToGeometry();
89 static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj);
91 static AliAlignObj* GetAlignObj(UShort_t voluid);
92 static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
96 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
97 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
99 static void InitSymNames();
100 static void InitAlignObjFromGeometry();
103 TString fVolPath; // Symbolic volume name; in case could coincide with
104 // the volume path inside TGeo geometry
105 UShort_t fVolUID; // Unique volume ID
107 static Int_t fgLayerSize[kLastLayer - kFirstLayer]; // Size of layers
108 static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers
110 static TString* fgVolPath[kLastLayer - kFirstLayer]; // Symbolic volume names
111 static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects
113 ClassDef(AliAlignObj, 2)