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 //************************************************************************
17 #include "AliGeomManager.h"
18 #include <TMatrixDSymfwd.h>
22 class AliTrackPointArray;
25 class AliAlignObj : public TObject {
30 AliAlignObj(const char* symname, UShort_t voluid);
31 AliAlignObj(const char* symname, UShort_t voluid, Double_t* cmat);
32 AliAlignObj(const char* symname, AliGeomManager::ELayerID detId, Int_t modId);
33 AliAlignObj(const AliAlignObj& theAlignObj);
34 AliAlignObj& operator= (const AliAlignObj& theAlignObj);
35 AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
36 virtual ~AliAlignObj();
39 virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
40 virtual void SetTranslation(const TGeoMatrix& m) = 0;
41 virtual Bool_t SetLocalTranslation(Double_t x, Double_t y, Double_t z);
42 virtual Bool_t SetLocalTranslation(const TGeoMatrix& m);
43 virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
44 virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
45 virtual Bool_t SetLocalRotation(Double_t psi, Double_t theta, Double_t phi);
46 virtual Bool_t SetLocalRotation(const TGeoMatrix& m);
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(AliGeomManager::ELayerID layerId, Int_t modId);
56 void SetCorrMatrix(Double_t *cov);
57 void SetCorrMatrix(TMatrixDSym& mcov);
60 const char *GetSymName() const {return fVolPath.Data();}
61 UShort_t GetVolUID() const {return fVolUID;}
62 void GetVolUID(AliGeomManager::ELayerID &layerId, Int_t &modId) const;
63 virtual void GetTranslation(Double_t* tr) const=0;
64 virtual Bool_t GetLocalTranslation(Double_t* tr) const;
65 virtual Bool_t GetAngles(Double_t* angles) const=0;
66 virtual Bool_t GetLocalAngles(Double_t* angles) const;
67 virtual Bool_t GetPars(Double_t transl[], Double_t angles[]) const;
68 virtual Bool_t GetLocalPars(Double_t transl[], Double_t angles[]) const;
69 virtual void GetMatrix(TGeoHMatrix& m) const=0;
70 virtual Bool_t GetLocalMatrix(TGeoHMatrix& m) const;
71 void GetCovMatrix(Double_t *cov) const;
72 void GetCovMatrix(TMatrixDSym& mcov) const;
74 Bool_t IsSortable() const {return kTRUE;}
75 Int_t GetLevel() const;
76 virtual Int_t Compare(const TObject* obj) const;
78 virtual AliAlignObj& Inverse() const=0;
80 void Transform(AliTrackPoint &p, Bool_t copycov=kFALSE) const;
81 void Transform(AliTrackPointArray &array) const;
83 void Print(Option_t *) const;
85 static Int_t LayerSize(Int_t layerId) {return AliGeomManager::LayerSize(layerId);}
86 static const char* LayerName(Int_t layerId) {return AliGeomManager::LayerName(layerId);}
88 static UShort_t LayerToVolUID(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::LayerToVolUID(layerId, modId);}
89 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId) {return AliGeomManager::LayerToVolUID(layerId, modId);}
90 static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId) {return AliGeomManager::VolUIDToLayer(voluid, modId);}
91 static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid) {return AliGeomManager::VolUIDToLayer(voluid);}
92 static UShort_t LayerToVolUIDSafe(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::LayerToVolUIDSafe(layerId, modId);}
93 static UShort_t LayerToVolUIDSafe(Int_t layerId, Int_t modId) {return AliGeomManager::LayerToVolUIDSafe(layerId, modId);}
94 static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId) {return AliGeomManager::VolUIDToLayerSafe(voluid, modId);}
95 static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid) {return AliGeomManager::VolUIDToLayerSafe(voluid);}
97 static const char* SymName(UShort_t voluid) {return AliGeomManager::SymName(voluid);}
98 static const char* SymName(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::SymName(layerId, modId);}
100 Bool_t ApplyToGeometry(Bool_t ovlpcheck=kFALSE);
101 static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj) {return AliGeomManager::GetFromGeometry(symname, alobj);}
103 static AliAlignObj* GetAlignObj(UShort_t voluid) {return AliGeomManager::GetAlignObj(voluid);}
104 static AliAlignObj* GetAlignObj(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::GetAlignObj(layerId, modId);}
106 static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m) {return AliGeomManager::GetOrigGlobalMatrix(symname, m);}
110 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
111 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
114 TString fVolPath; // Symbolic volume name; in case could coincide with
115 // the volume path inside TGeo geometry (for non-alignable volumes)
116 UShort_t fVolUID; // Unique volume ID
118 Double32_t fDiag[6]; // diagonal elements of the correlation matrix for shifts and rotations (dx,dy,dz,dpsi,dtheta,dphi)
119 Double32_t fODia[15]; // [-1, 1,8] off-diagonal elements (in 8 bit precision) of the correlation matrix
121 ClassDef(AliAlignObj, 3)