]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAlignObjMatrix.cxx
AliPIDResponse related
[u/mrichter/AliRoot.git] / STEER / AliAlignObjMatrix.cxx
index 69386253ab315f520a18ff0b6242e9b10fe0cd79..a9fcd8db1a9029072872b74528d13de96f9b816f 100644 (file)
 
 #include "AliAlignObj.h"
 #include "AliAlignObjMatrix.h"
-//#include "AliLog.h"
 
 ClassImp(AliAlignObjMatrix)
 
 //_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix() : AliAlignObj()
+AliAlignObjMatrix::AliAlignObjMatrix() : 
+  AliAlignObj(),
+  fMatrix()
 {
   // Default constructor
   //
 }
 
 //_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, UShort_t voluid, Double_t x, Double_t y, Double_t z, Double_t psi, Double_t theta, Double_t phi) : AliAlignObj()
-{
-  // standard constructor with 3 translation + 3 rotation parameters
-  //
-  fVolPath=volpath;
-  fVolUID=voluid;
-  SetTranslation(x, y, z);
-  SetRotation(psi, theta, phi);
-}
-
-//_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, ELayerID detId, Int_t volId, Double_t x, Double_t y, Double_t z, Double_t psi, Double_t theta, Double_t phi, Bool_t global) throw (const Char_t *) : AliAlignObj()
+AliAlignObjMatrix::AliAlignObjMatrix(const char* symname, UShort_t volUId, Double_t x, Double_t y, Double_t z, Double_t psi, Double_t theta, Double_t phi, Bool_t global) throw (const Char_t *) :
+  AliAlignObj(symname,volUId),
+  fMatrix()
 {
   // standard constructor with 3 translation + 3 rotation parameters
   // If the user explicitly sets the global variable to kFALSE then the
@@ -52,11 +44,8 @@ AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, ELayerID detId, Int_t
   // This requires to have a gGeoMenager active instance, otherwise the
   // constructor will fail (no object created)
   // 
-  fVolPath=volpath;
-  SetVolUID(detId,volId);
   if(global){
-    SetTranslation(x, y, z);
-    SetRotation(psi, theta, phi);
+    SetPars(x, y, z, psi, theta, phi);
   }else{
     if(!SetLocalPars(x,y,z,psi,theta,phi)) throw "Alignment object creation failed (TGeo instance needed)!\n";
   }
@@ -64,19 +53,29 @@ AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, ELayerID detId, Int_t
 
 
 //_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, UShort_t voluid, TGeoMatrix& m) : AliAlignObj()
+AliAlignObjMatrix::AliAlignObjMatrix(const char* symname, UShort_t volUId, TGeoMatrix& m, Bool_t global) throw (const Char_t *) :
+  AliAlignObj(symname,volUId),
+  fMatrix()
 {
   // standard constructor with TGeoMatrix
+  // If the user explicitly sets the global variable to kFALSE then the
+  // parameters are interpreted as giving the local transformation.
+  // This requires to have a gGeoMenager active instance, otherwise the
+  // constructor will fail (no object created)
   //
-  fVolPath=volpath;
-  fVolUID=voluid;
-  SetTranslation(m);
-  SetRotation(m);
+
+  if (global) {
+    SetMatrix(m);
+  }
+  else {
+    if (!SetLocalMatrix(m)) throw "Alignment object creation failed (TGeo instance needed)!\n";
+  }
 }
 
 //_____________________________________________________________________________
 AliAlignObjMatrix::AliAlignObjMatrix(const AliAlignObj& theAlignObj) :
-  AliAlignObj(theAlignObj)
+  AliAlignObj(theAlignObj),
+  fMatrix()
 {
   //copy constructor
   //
@@ -84,8 +83,8 @@ AliAlignObjMatrix::AliAlignObjMatrix(const AliAlignObj& theAlignObj) :
   theAlignObj.GetTranslation(tr);
   SetTranslation(tr[0],tr[1],tr[2]);
   Double_t rot[3];
-  theAlignObj.GetAngles(rot);
-  SetRotation(rot[0],rot[1],rot[2]);
+  if (theAlignObj.GetAngles(rot))
+    SetRotation(rot[0],rot[1],rot[2]);
 }
 
 //_____________________________________________________________________________
@@ -99,8 +98,9 @@ AliAlignObjMatrix &AliAlignObjMatrix::operator =(const AliAlignObj& theAlignObj)
   theAlignObj.GetTranslation(tr);
   SetTranslation(tr[0],tr[1],tr[2]);
   Double_t rot[3];
-  theAlignObj.GetAngles(rot);
-  SetRotation(rot[0],rot[1],rot[2]);
+  if (theAlignObj.GetAngles(rot))
+    SetRotation(rot[0],rot[1],rot[2]);
+
   return *this;
 }
 
@@ -114,6 +114,9 @@ AliAlignObjMatrix::~AliAlignObjMatrix()
 //_____________________________________________________________________________
 void AliAlignObjMatrix::SetTranslation(Double_t x, Double_t y, Double_t z)
 {
+  // set the translation coefficients of the data member matrix
+  // from the parameters passed as arguments
+  // 
   Double_t tr[3];
   tr[0]=x; tr[1]=y; tr[2]=z;
   fMatrix.SetTranslation(tr);
@@ -122,6 +125,9 @@ void AliAlignObjMatrix::SetTranslation(Double_t x, Double_t y, Double_t z)
 //_____________________________________________________________________________
 void AliAlignObjMatrix::SetTranslation(const TGeoMatrix& m)
 {
+  // set the translation coefficients of the data member matrix
+  // from the matrix passed as argument
+  // 
   const Double_t *tr = m.GetTranslation();
   fMatrix.SetTranslation(tr);
 }
@@ -129,6 +135,8 @@ void AliAlignObjMatrix::SetTranslation(const TGeoMatrix& m)
 //_____________________________________________________________________________
 void AliAlignObjMatrix::SetRotation(Double_t psi, Double_t theta, Double_t phi)
 {
+  // set the rotation parameters from the parameters passed as arguments
+  // 
   Double_t angles[3] = {psi, theta, phi};
   Double_t rot[9];
   AnglesToMatrix(angles,rot);
@@ -138,30 +146,14 @@ void AliAlignObjMatrix::SetRotation(Double_t psi, Double_t theta, Double_t phi)
 //_____________________________________________________________________________
 Bool_t AliAlignObjMatrix::SetRotation(const TGeoMatrix& m)
 {
+  // set the rotation coefficients of the data member matrix
+  // from the matrix passed as argument
+  // 
   const Double_t* rot = m.GetRotationMatrix();
   fMatrix.SetRotation(rot);
   return kTRUE;
 }
 
-//_____________________________________________________________________________
-void AliAlignObjMatrix::SetMatrix(const TGeoMatrix& m)
-{
-  // Set rotation matrix and translation
-  // using TGeoMatrix
-  SetTranslation(m);
-  SetRotation(m);
-}
-
-//_____________________________________________________________________________
-void AliAlignObjMatrix::SetPars(Double_t x, Double_t y, Double_t z,
-                      Double_t psi, Double_t theta, Double_t phi)
-{
-  // Set rotation matrix and translation
-  // using 3 angles and 3 translations
-  SetTranslation(x,y,z);
-  SetRotation(psi,theta,phi);
-}
-
 //_____________________________________________________________________________
 void AliAlignObjMatrix::GetTranslation(Double_t *tr) const
 {
@@ -180,13 +172,6 @@ Bool_t AliAlignObjMatrix::GetAngles(Double_t *angles) const
   return MatrixToAngles(rot,angles);
 }
 
-//_____________________________________________________________________________
-void AliAlignObjMatrix::GetPars(Double_t tr[], Double_t angles[]) const
-{
-  GetTranslation(tr);
-  GetAngles(angles);
-}
-
 //_____________________________________________________________________________
 void AliAlignObjMatrix::GetMatrix(TGeoHMatrix& m) const
 {
@@ -201,8 +186,9 @@ void AliAlignObjMatrix::GetMatrix(TGeoHMatrix& m) const
 //_____________________________________________________________________________
 AliAlignObj& AliAlignObjMatrix::Inverse() const
 {
-  // Return a temporary inverse of the alignment
-  // object. This means 'mis
+  // Return a temporary "inverse" of the alignment object, that is return
+  // an object with inverted transformation matrix.
+  //
    static AliAlignObjMatrix a;
    a = *this;