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 //************************************************************************
12 #include "TGeoMatrix.h"
15 class AliTrackPointArray;
17 class AliAlignObj : public TObject {
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,
32 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
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 Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
47 Double_t psi, Double_t theta, Double_t phi);
48 virtual void SetMatrix(const TGeoMatrix& m) = 0;
49 void SetVolPath(const TString& volpath) {fVolPath=volpath;}
50 void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
51 void SetVolUID(ELayerID layerId, Int_t modId);
54 const char *GetVolPath() const {return fVolPath.Data();}
55 UShort_t GetVolUID() const {return fVolUID;}
56 void GetVolUID(ELayerID &layerId, Int_t &modId) const;
57 virtual void GetTranslation(Double_t* tr) const=0;
58 virtual Bool_t GetAngles(Double_t* angles) const=0;
59 virtual void GetPars(Double_t transl[], Double_t rot[]) const=0;
60 virtual void GetMatrix(TGeoHMatrix& m) const=0;
62 virtual AliAlignObj& Inverse() const=0;
64 void Transform(AliTrackPoint &p) const;
65 void Transform(AliTrackPointArray &array) const;
67 void Print(Option_t *) const;
69 static Int_t LayerSize(Int_t layer) { return fgLayerSize[layer]; }
70 static const char* LayerName(Int_t layer) { return fgLayerName[layer]; }
72 static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
73 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId);
74 static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
75 static ELayerID VolUIDToLayer(UShort_t voluid);
77 static const char* GetVolPath(UShort_t voluid) {
79 ELayerID layerId = VolUIDToLayer(voluid,modId);
80 return GetVolPath(layerId,modId);
82 static const char* GetVolPath(ELayerID layerId, Int_t modId);
84 Bool_t ApplyToGeometry();
85 static Bool_t GetFromGeometry(const char *path, AliAlignObj &alobj);
87 static void InitAlignObjFromGeometry();
88 static AliAlignObj* GetAlignObj(UShort_t voluid) {
90 ELayerID layerId = VolUIDToLayer(voluid,modId);
91 return GetAlignObj(layerId,modId);
93 static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
97 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
98 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
100 static void InitVolPaths();
103 TString fVolPath; // Volume path inside TGeo geometry
104 UShort_t fVolUID; // Unique volume ID
106 static Int_t fgLayerSize[kLastLayer - kFirstLayer];
107 static const char* fgLayerName[kLastLayer - kFirstLayer];
109 static TString* fgVolPath[kLastLayer - kFirstLayer];
111 static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer];
113 ClassDef(AliAlignObj, 2)