AliRoot Core  3dc7879 (3dc7879)
AliAlignObj.h
Go to the documentation of this file.
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 <Rtypes.h>
17 #include "AliGeomManager.h"
18 #include <TMatrixD.h>
19 #include <TMatrixDSym.h>
20 
21 
22 class AliTrackPoint;
23 class AliTrackPointArray;
24 class TGeoMatrix;
25 
26 class AliAlignObj : public TObject {
27 
28  public:
29 
30  AliAlignObj();
31  AliAlignObj(const char* symname, UShort_t voluid);
32  AliAlignObj(const char* symname, UShort_t voluid, Double_t* cmat);
33  AliAlignObj(const char* symname, AliGeomManager::ELayerID detId, Int_t modId);
34  AliAlignObj(const AliAlignObj& theAlignObj);
35  AliAlignObj& operator= (const AliAlignObj& theAlignObj);
36  AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
37  virtual ~AliAlignObj();
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;
42  virtual Bool_t SetLocalTranslation(Double_t x, Double_t y, Double_t z);
43  virtual Bool_t SetLocalTranslation(const TGeoMatrix& m);
44  virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
45  virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
46  virtual Bool_t SetLocalRotation(Double_t psi, Double_t theta, Double_t phi);
47  virtual Bool_t SetLocalRotation(const TGeoMatrix& m);
48  virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
49  Double_t theta, Double_t phi);
50  virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
51  Double_t psi, Double_t theta, Double_t phi);
52  virtual Bool_t SetMatrix(const TGeoMatrix& m);
53  virtual Bool_t SetLocalMatrix(const TGeoMatrix& m);
54  void SetSymName(const TString& symname) {fVolPath=symname;}
55  void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
56  void SetVolUID(AliGeomManager::ELayerID layerId, Int_t modId);
57  void SetCorrMatrix(Double_t *cov);
58  void SetCorrMatrix(TMatrixDSym& mcov);
59  Bool_t SetFromLocalCov(Double_t *lCov);
60  Bool_t SetFromLocalCov(TMatrixDSym& lCov);
61 
62  //Getters
63  const char *GetSymName() const {return fVolPath.Data();}
64  UShort_t GetVolUID() const {return fVolUID;}
65  void GetVolUID(AliGeomManager::ELayerID &layerId, Int_t &modId) const;
66  virtual void GetTranslation(Double_t* tr) const=0;
67  virtual Bool_t GetLocalTranslation(Double_t* tr) const;
68  virtual Bool_t GetAngles(Double_t* angles) const=0;
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;
72  virtual void GetMatrix(TGeoHMatrix& m) const=0;
73  virtual Bool_t GetLocalMatrix(TGeoHMatrix& m) const;
74  void GetCovMatrix(Double_t *cov) const;
75  void GetCovMatrix(TMatrixDSym& mcov) const;
76  Bool_t GetJacobian(TMatrixD& mJ) const;
77  Bool_t GetLocalCovMatrix(Double_t *cov) const;
78  Bool_t GetLocalCovMatrix(TMatrixDSym& lCov) const;
79 
80  Bool_t IsSortable() const {return kTRUE;}
81  Int_t GetLevel() const;
82  virtual Int_t Compare(const TObject* obj) const;
83 
84  virtual AliAlignObj& Inverse() const=0;
85 
86  void Transform(AliTrackPoint &p, Bool_t copycov=kFALSE) const;
87  void Transform(AliTrackPointArray &array) const;
88 
89  void Print(Option_t *) const;
90 
91  static Int_t LayerSize(Int_t layerId) {return AliGeomManager::LayerSize(layerId);}
92  static const char* LayerName(Int_t layerId) {return AliGeomManager::LayerName(layerId);}
93 
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);}
102 
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);}
105 
106  Bool_t ApplyToGeometry(Bool_t ovlpcheck=kFALSE);
107  static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj) {return AliGeomManager::GetFromGeometry(symname, alobj);}
108 
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);}
111 
112  static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m) {return AliGeomManager::GetOrigGlobalMatrix(symname, m);}
113 
114  protected:
115 
116  void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
117  Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
118 
119  //Volume identifiers
120  TString fVolPath; // Symbolic volume name; in case could coincide with
121  // the volume path inside TGeo geometry (for non-alignable volumes)
122  UShort_t fVolUID; // Unique volume ID
123 
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
126 
127  ClassDef(AliAlignObj, 3)
128 };
129 
130 #endif
static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj)
Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const
AliAlignObj & operator=(const AliAlignObj &theAlignObj)
Definition: AliAlignObj.cxx:83
static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId)
Definition: AliAlignObj.h:100
virtual ~AliAlignObj()
void SetCorrMatrix(Double_t *cov)
static const char * SymName(UShort_t voluid)
static Int_t LayerSize(Int_t layerId)
Definition: AliAlignObj.h:91
static AliAlignObj * GetAlignObj(UShort_t voluid)
static const char * LayerName(Int_t layerId)
virtual Bool_t SetLocalRotation(Double_t psi, Double_t theta, Double_t phi)
void Print(Option_t *) const
static UShort_t LayerToVolUID(Int_t layerId, Int_t modId)
Definition: AliAlignObj.h:95
static const char * SymName(UShort_t voluid)
Definition: AliAlignObj.h:103
void SetSymName(const TString &symname)
Definition: AliAlignObj.h:54
static AliAlignObj * GetAlignObj(AliGeomManager::ELayerID layerId, Int_t modId)
Definition: AliAlignObj.h:110
void Transform(AliTrackPoint &p, Bool_t copycov=kFALSE) const
virtual Bool_t GetPars(Double_t transl[], Double_t angles[]) const
Float_t p[]
Definition: kNNTest.C:133
virtual AliAlignObj & Inverse() const =0
Bool_t ApplyToGeometry(Bool_t ovlpcheck=kFALSE)
void AnglesToMatrix(const Double_t *angles, Double_t *rot) const
virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi)=0
static TGeoHMatrix * GetOrigGlobalMatrix(Int_t index)
static AliGeomManager::ELayerID VolUIDToLayerSafe(UShort_t voluid)
Definition: AliAlignObj.h:101
static Int_t LayerSize(Int_t layerId)
static UShort_t LayerToVolUIDSafe(Int_t layerId, Int_t modId)
Definition: AliAlignObj.h:99
static ELayerID VolUIDToLayerSafe(UShort_t voluid, Int_t &modId)
void GetCovMatrix(Double_t *cov) const
virtual Bool_t GetLocalTranslation(Double_t *tr) const
virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi, Double_t theta, Double_t phi)
TObjArray * array
Definition: AnalyzeLaser.C:12
static AliAlignObj * GetAlignObj(UShort_t voluid)
Definition: AliAlignObj.h:109
static const char * SymName(AliGeomManager::ELayerID layerId, Int_t modId)
Definition: AliAlignObj.h:104
virtual Bool_t GetLocalPars(Double_t transl[], Double_t angles[]) const
Int_t GetLevel() const
static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId)
Definition: AliAlignObj.h:96
Double32_t fDiag[6]
Definition: AliAlignObj.h:124
static AliGeomManager::ELayerID VolUIDToLayer(UShort_t voluid)
Definition: AliAlignObj.h:97
Bool_t GetJacobian(TMatrixD &mJ) const
static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId)
void SetVolUID(UShort_t voluid)
Definition: AliAlignObj.h:55
virtual Bool_t GetLocalMatrix(TGeoHMatrix &m) const
virtual Int_t Compare(const TObject *obj) const
Bool_t IsSortable() const
Definition: AliAlignObj.h:80
virtual Bool_t SetMatrix(const TGeoMatrix &m)
virtual Bool_t GetAngles(Double_t *angles) const =0
static UShort_t LayerToVolUIDSafe(AliGeomManager::ELayerID layerId, Int_t modId)
Definition: AliAlignObj.h:98
Double32_t fODia[15]
Definition: AliAlignObj.h:125
static Bool_t GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m)
Definition: AliAlignObj.h:112
virtual Bool_t SetLocalTranslation(Double_t x, Double_t y, Double_t z)
Bool_t GetLocalCovMatrix(Double_t *cov) const
static Bool_t GetFromGeometry(const char *symname, AliAlignObj &alobj)
Definition: AliAlignObj.h:107
virtual void GetTranslation(Double_t *tr) const =0
static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId)
const char * GetSymName() const
Definition: AliAlignObj.h:63
UShort_t GetVolUID() const
Definition: AliAlignObj.h:64
virtual Bool_t GetLocalAngles(Double_t *angles) const
virtual void GetMatrix(TGeoHMatrix &m) const =0
TString fVolPath
Definition: AliAlignObj.h:120
virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z, Double_t psi, Double_t theta, Double_t phi)
AliAlignObj & operator*=(const AliAlignObj &theAlignObj)
Definition: AliAlignObj.cxx:95
static UShort_t LayerToVolUID(AliGeomManager::ELayerID layerId, Int_t modId)
Definition: AliAlignObj.h:94
Bool_t SetFromLocalCov(Double_t *lCov)
static const char * LayerName(Int_t layerId)
Definition: AliAlignObj.h:92
virtual Bool_t SetLocalMatrix(const TGeoMatrix &m)
static UShort_t LayerToVolUIDSafe(ELayerID layerId, Int_t modId)
UShort_t fVolUID
Definition: AliAlignObj.h:122
virtual void SetTranslation(Double_t x, Double_t y, Double_t z)=0