Coverity 16571
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.h
c18195b9 1#ifndef ALIALIGNOBJ_H
fdf65bb5 4//************************************************************************
ff2dbca1 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 *
befe2c08 13//************************************************************************
e9304cb8 14#include <TObject.h>
15#include <TString.h>
90dbf5fb 16#include <Rtypes.h>
25be1e5c 17#include "AliGeomManager.h"
46175b3a 18#include <TMatrixD.h>
19#include <TMatrixDSym.h>
25be1e5c 20
c18195b9 21
03b18860 22class AliTrackPoint;
23class AliTrackPointArray;
2499b21b 24class TGeoMatrix;
03b18860 25
c18195b9 26class AliAlignObj : public TObject {
28 public:
d9cc42ed 30 AliAlignObj();
b760c02e 31 AliAlignObj(const char* symname, UShort_t voluid);
90dbf5fb 32 AliAlignObj(const char* symname, UShort_t voluid, Double_t* cmat);
25be1e5c 33 AliAlignObj(const char* symname, AliGeomManager::ELayerID detId, Int_t modId);
d9cc42ed 34 AliAlignObj(const AliAlignObj& theAlignObj);
35 AliAlignObj& operator= (const AliAlignObj& theAlignObj);
36 AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
37 virtual ~AliAlignObj();
c18195b9 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;
32898fe7 42 virtual Bool_t SetLocalTranslation(Double_t x, Double_t y, Double_t z);
43 virtual Bool_t SetLocalTranslation(const TGeoMatrix& m);
c18195b9 44 virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
45 virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
32898fe7 46 virtual Bool_t SetLocalRotation(Double_t psi, Double_t theta, Double_t phi);
47 virtual Bool_t SetLocalRotation(const TGeoMatrix& m);
c18195b9 48 virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
b760c02e 49 Double_t theta, Double_t phi);
1bfe7ffc 50 virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
51 Double_t psi, Double_t theta, Double_t phi);
b760c02e 52 virtual Bool_t SetMatrix(const TGeoMatrix& m);
53 virtual Bool_t SetLocalMatrix(const TGeoMatrix& m);
54 void SetSymName(const TString& symname) {fVolPath=symname;}
cab6c0d0 55 void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
25be1e5c 56 void SetVolUID(AliGeomManager::ELayerID layerId, Int_t modId);
90dbf5fb 57 void SetCorrMatrix(Double_t *cov);
e9304cb8 58 void SetCorrMatrix(TMatrixDSym& mcov);
46175b3a 59 Bool_t SetFromLocalCov(Double_t *lCov);
60 Bool_t SetFromLocalCov(TMatrixDSym& lCov);
c18195b9 61
62 //Getters
b760c02e 63 const char *GetSymName() const {return fVolPath.Data();}
c18195b9 64 UShort_t GetVolUID() const {return fVolUID;}
25be1e5c 65 void GetVolUID(AliGeomManager::ELayerID &layerId, Int_t &modId) const;
c18195b9 66 virtual void GetTranslation(Double_t* tr) const=0;
32898fe7 67 virtual Bool_t GetLocalTranslation(Double_t* tr) const;
c18195b9 68 virtual Bool_t GetAngles(Double_t* angles) const=0;
32898fe7 69 virtual Bool_t GetLocalAngles(Double_t* angles) const;
70 virtual Bool_t GetPars(Double_t transl[], Double_t angles[]) const;
71 virtual Bool_t GetLocalPars(Double_t transl[], Double_t angles[]) const;
c18195b9 72 virtual void GetMatrix(TGeoHMatrix& m) const=0;
32898fe7 73 virtual Bool_t GetLocalMatrix(TGeoHMatrix& m) const;
90dbf5fb 74 void GetCovMatrix(Double_t *cov) const;
e9304cb8 75 void GetCovMatrix(TMatrixDSym& mcov) const;
46175b3a 76 Bool_t GetJacobian(TMatrixD& mJ) const;
77 Bool_t GetLocalCovMatrix(Double_t *cov) const;
78 Bool_t GetLocalCovMatrix(TMatrixDSym& lCov) const;
c18195b9 79
d9cc42ed 80 Bool_t IsSortable() const {return kTRUE;}
4b94e753 81 Int_t GetLevel() const;
82 virtual Int_t Compare(const TObject* obj) const;
03b18860 84 virtual AliAlignObj& Inverse() const=0;
6b1b1a3b 86 void Transform(AliTrackPoint &p, Bool_t copycov=kFALSE) const;
03b18860 87 void Transform(AliTrackPointArray &array) const;
c18195b9 89 void Print(Option_t *) const;
25be1e5c 91 static Int_t LayerSize(Int_t layerId) {return AliGeomManager::LayerSize(layerId);}
92 static const char* LayerName(Int_t layerId) {return AliGeomManager::LayerName(layerId);}
98937d93 93
25be1e5c 94 static UShort_t LayerToVolUID(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::LayerToVolUID(layerId, modId);}
95 static UShort_t LayerToVolUID(Int_t layerId, Int_t modId) {return AliGeomManager::LayerToVolUID(layerId, modId);}
96 static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId) {return AliGeomManager::VolUIDToLayer(voluid, modId);}
97 static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid) {return AliGeomManager::VolUIDToLayer(voluid);}
98 static UShort_t LayerToVolUIDSafe(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::LayerToVolUIDSafe(layerId, modId);}
99 static UShort_t LayerToVolUIDSafe(Int_t layerId, Int_t modId) {return AliGeomManager::LayerToVolUIDSafe(layerId, modId);}
100 static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId) {return AliGeomManager::VolUIDToLayerSafe(voluid, modId);}
101 static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid) {return AliGeomManager::VolUIDToLayerSafe(voluid);}
03b18860 102
25be1e5c 103 static const char* SymName(UShort_t voluid) {return AliGeomManager::SymName(voluid);}
104 static const char* SymName(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::SymName(layerId, modId);}
03b18860 105
5590c6c3 106 Bool_t ApplyToGeometry(Bool_t ovlpcheck=kFALSE);
25be1e5c 107 static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj) {return AliGeomManager::GetFromGeometry(symname, alobj);}
995ad051 108
25be1e5c 109 static AliAlignObj* GetAlignObj(UShort_t voluid) {return AliGeomManager::GetAlignObj(voluid);}
110 static AliAlignObj* GetAlignObj(AliGeomManager::ELayerID layerId, Int_t modId) {return AliGeomManager::GetAlignObj(layerId, modId);}
c5304981 111
25be1e5c 112 static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m) {return AliGeomManager::GetOrigGlobalMatrix(symname, m);}
276cb1b1 113
c18195b9 114 protected:
116 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
117 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
119 //Volume identifiers
b760c02e 120 TString fVolPath; // Symbolic volume name; in case could coincide with
ff2dbca1 121 // the volume path inside TGeo geometry (for non-alignable volumes)
98937d93 122 UShort_t fVolUID; // Unique volume ID
90dbf5fb 124 Double32_t fDiag[6]; // diagonal elements of the correlation matrix for shifts and rotations (dx,dy,dz,dpsi,dtheta,dphi)
125 Double32_t fODia[15]; // [-1, 1,8] off-diagonal elements (in 8 bit precision) of the correlation matrix
127 ClassDef(AliAlignObj, 3)
c18195b9 128};
c18195b9 130#endif