]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAlignObj.h
Updates (N. Bastid)
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.h
index baccf704dc951e1b94113fae286d12b0d62f0dae..3a5578bde3766cef25e6c8b5f766d37345f42ac8 100644 (file)
@@ -1,23 +1,41 @@
 #ifndef ALIALIGNOBJ_H
 #define ALIALIGNOBJ_H
 
-/*************************************************************************
- * AliAlignObj: alignment base class for the storage of alignment        *
- *   information for a single volume, that is a translation, a rotation  *
- *   and a the identity of the volume itself in form of a TGeo path and  *
- *   as a unique integer identifier                                      *
- *************************************************************************/
+//************************************************************************
+// AliAlignObj: alignment base class for the storage of alignment        *
+//   information for a single volume, that is a translation, a rotation  *
+//   and a the identity of the volume itself in form of a TGeo path and  *
+//   as a unique integer identifier                                      *
+//************************************************************************
 #include "TObject.h"
 #include "TString.h"
 #include "TGeoMatrix.h"
 
+class AliTrackPoint;
+class AliTrackPointArray;
+
 class AliAlignObj : public TObject {
 
  public:
 
+  enum ELayerID{kInvalidLayer=0,
+               kFirstLayer=1,
+               kSPD1=1, kSPD2=2,
+               kSDD1=3, kSDD2=4,
+               kSSD1=5, kSSD2=6,
+               kTPC1=7, kTPC2=8,
+               kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
+               kTOF=15,
+               kPHOS1=16, kPHOS2=17,
+               kRICH=18,
+               kMUON=19,
+               kLastLayer=20};
   AliAlignObj();
+  AliAlignObj(const char* volpath, UShort_t voluid);
+  AliAlignObj(const char* volpath, ELayerID detId, Int_t modId);
   AliAlignObj(const AliAlignObj& theAlignObj);
   AliAlignObj& operator= (const AliAlignObj& theAlignObj);
+  AliAlignObj& operator*=(const AliAlignObj& theAlignObj);
   virtual ~AliAlignObj();
 
   //Setters
@@ -27,107 +45,70 @@ class AliAlignObj : public TObject {
   virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
   virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
                Double_t theta, Double_t phi) = 0;
+  virtual Bool_t SetLocalPars(Double_t x, Double_t y, Double_t z,
+                             Double_t psi, Double_t theta, Double_t phi);
   virtual void SetMatrix(const TGeoMatrix& m) = 0;
   void  SetVolPath(const TString& volpath) {fVolPath=volpath;}
-  void  SetVolUID(const UShort_t voluid) {fVolUID=voluid;}
+  void  SetVolUID(UShort_t voluid) {fVolUID=voluid;}
+  void  SetVolUID(ELayerID layerId, Int_t modId);
 
   //Getters
   const char  *GetVolPath()    const {return fVolPath.Data();}
   UShort_t     GetVolUID()     const {return fVolUID;}
+  void         GetVolUID(ELayerID &layerId, Int_t &modId) const;
   virtual void GetTranslation(Double_t* tr)  const=0;
   virtual Bool_t GetAngles(Double_t* angles) const=0;
   virtual void GetPars(Double_t transl[], Double_t rot[]) const=0;
   virtual void GetMatrix(TGeoHMatrix& m) const=0;
 
+  Bool_t   IsSortable() const {return kTRUE;}
+  Int_t         GetLevel() const;
+  virtual Int_t Compare(const TObject* obj) const;
+
+  virtual AliAlignObj& Inverse() const=0;
+
+  void  Transform(AliTrackPoint &p) const;
+  void  Transform(AliTrackPointArray &array) const;
+
   void  Print(Option_t *) const;
 
+  static Int_t       LayerSize(Int_t layerId);
+  static const char* LayerName(Int_t layerId);
+
+  static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
+  static UShort_t LayerToVolUID(Int_t    layerId, Int_t modId);
+  static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
+  static ELayerID VolUIDToLayer(UShort_t voluid);
+
+  static const char* GetVolPath(UShort_t voluid);
+  static const char* GetVolPath(ELayerID layerId, Int_t modId);
+
+  Bool_t ApplyToGeometry();
+  static Bool_t   GetFromGeometry(const char *path, AliAlignObj &alobj);
+
+  static void         InitAlignObjFromGeometry();
+  static AliAlignObj* GetAlignObj(UShort_t voluid);
+  static AliAlignObj* GetAlignObj(ELayerID layerId, Int_t modId);
+
  protected:
 
   void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
   Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
 
+  static void InitVolPaths();
+
   //Volume identifiers
-  TString fVolPath; // Volume path inside TGeo geometry
-  UShort_t fVolUID; // Unique volume ID
-  
-  ClassDef(AliAlignObj, 1)
-};
+  TString  fVolPath; // Volume path inside TGeo geometry
+  UShort_t fVolUID;  // Unique volume ID
 
-/*****************************************************************************
- * AliAlignObjAngles: derived alignment class storing alignment information  *
- *   for a single volume in form of three doubles for the translation        *
- *   and three doubles for the rotation expressed with the euler angles      *
- *   in the xyz-convention (http://mathworld.wolfram.com/EulerAngles.html),  *
- *   also known as roll, pitch, yaw. PLEASE NOTE THE ANGLES SIGNS ARE        *
- *   INVERSE WITH RESPECT TO THIS REFERENCE!!! In this way the representation*
- *   is fully consistent with the TGeo Rotation methods.                     *
- *****************************************************************************/
-class AliAlignObjAngles : public AliAlignObj{
- public:
-  AliAlignObjAngles();
-  AliAlignObjAngles(const AliAlignObjAngles& theAlignObj);
-  AliAlignObjAngles& operator= (const AliAlignObjAngles& theAlignObj);
-  virtual ~AliAlignObjAngles();
-  
-  //Setters
-  virtual void SetTranslation(Double_t x, Double_t y, Double_t z){
-    fTranslation[0]=x; fTranslation[1]=y; fTranslation[2]=z;}
-  virtual void SetTranslation(const TGeoMatrix& m);
-  virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi){
-    fRotation[0]=psi; fRotation[1]=theta; fRotation[2]=phi;}
-  virtual Bool_t SetRotation(const TGeoMatrix& m);
-  virtual void SetMatrix(const TGeoMatrix& m);
-  virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
-                  Double_t theta, Double_t phi){
-    fTranslation[0]=x; fTranslation[1]=y; fTranslation[2]=z;
-    fRotation[0]=psi; fRotation[1]=theta; fRotation[2]=phi;}
-  
-  //Getters
-  virtual void GetTranslation(Double_t *tr)  const {
-    tr[0] = fTranslation[0]; tr[1] = fTranslation[1]; tr[2] = fTranslation[2];}
-  virtual Bool_t GetAngles(Double_t* angles)   const {
-    angles[0] = fRotation[0]; angles[1] = fRotation[1];
-    angles[2] = fRotation[2]; return kTRUE;}
-  virtual void GetPars(Double_t tr[], Double_t angles[]) const;
-  virtual void GetMatrix(TGeoHMatrix& m) const;
-  
- protected:
-  Double_t fTranslation[3]; // Translation vector
-  Double_t fRotation[3]; // Roll-pitch-yaw angles
-  
-  ClassDef(AliAlignObjAngles, 1)
-};
+  static Int_t       fgLayerSize[kLastLayer - kFirstLayer]; // Size of layers
+  static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers
 
-/**************************************************************************
- * AliAlignObjMatrix: derived alignment class storing alignment           *
- *   information for a single volume in form of TGeoHMatrix, which        *
- *   includes the information for a translation, a rotation and a scale   *
- *************************************************************************/
-class AliAlignObjMatrix : public AliAlignObj {
- public:
-  AliAlignObjMatrix();
-  AliAlignObjMatrix(const AliAlignObjMatrix& theAlignObj);
-  AliAlignObjMatrix& operator= (const AliAlignObjMatrix& theAlignObj);
-  virtual ~AliAlignObjMatrix();
-  
-  //Setters
-  virtual void SetTranslation(Double_t x, Double_t y, Double_t z);
-  virtual void SetTranslation(const TGeoMatrix& m);
-  virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi);
-  virtual Bool_t SetRotation(const TGeoMatrix& m);
-  virtual void SetMatrix(const TGeoMatrix& m);
-  virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
-                  Double_t theta, Double_t phi);
-  //Getters
-  virtual void GetTranslation(Double_t* tr)  const;
-  virtual Bool_t GetAngles(Double_t* angles)  const;
-  virtual void GetPars(Double_t tr[], Double_t rot[]) const;
-  virtual void GetMatrix(TGeoHMatrix& m) const;
-  
- protected:
-  TGeoHMatrix fMatrix; // Transformation matrix
-  
-  ClassDef(AliAlignObjMatrix, 1)
+  static TString*    fgVolPath[kLastLayer - kFirstLayer]; // Volume path
+
+  static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects
+
+  ClassDef(AliAlignObj, 2)
 };
 
 #endif