]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAlignObjMatrix.cxx
Added test for existence of the vertex (fixes crash)
[u/mrichter/AliRoot.git] / STEER / AliAlignObjMatrix.cxx
index 9b8a553f2ab8544066f4c9166b6fd859fcdb2499..7360895744686b8bf28f47b32a8ac3a702c6a7e4 100644 (file)
@@ -33,40 +33,52 @@ AliAlignObjMatrix::AliAlignObjMatrix() : AliAlignObj()
 }
 
 //_____________________________________________________________________________
-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()
+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(volpath, voluid)
 {
   // 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) : AliAlignObj()
+AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, ELayerID layerId, 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(volpath,layerId,volId)
 {
   // standard constructor with 3 translation + 3 rotation parameters
+  // 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)
+  // 
+  if(global){
+    SetTranslation(x, y, z);
+    SetRotation(psi, theta, phi);
+  }else{
+    if(!SetLocalPars(x,y,z,psi,theta,phi)) throw "Alignment object creation failed (TGeo instance needed)!\n";
+  }
+}
+
+
+//_____________________________________________________________________________
+AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, UShort_t volUID, TGeoMatrix& m) : AliAlignObj(volpath,volUID)
+{
+  // standard constructor with TGeoMatrix
   //
-  fVolPath=volpath;
-  SetVolUID(detId,volId);
-  SetTranslation(x, y, z);
-  SetRotation(psi, theta, phi);
+  SetTranslation(m);
+  SetRotation(m);
 }
 
 //_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, UShort_t voluid, TGeoMatrix& m) : AliAlignObj()
+AliAlignObjMatrix::AliAlignObjMatrix(const char* volpath, ELayerID layerId, Int_t volId, TGeoMatrix& m) : AliAlignObj(volpath,layerId,volId)
 {
   // standard constructor with TGeoMatrix
   //
-  fVolPath=volpath;
-  fVolUID=voluid;
   SetTranslation(m);
   SetRotation(m);
 }
 
 //_____________________________________________________________________________
-AliAlignObjMatrix::AliAlignObjMatrix(const AliAlignObjMatrix& theAlignObj) :
+AliAlignObjMatrix::AliAlignObjMatrix(const AliAlignObj& theAlignObj) :
   AliAlignObj(theAlignObj)
 {
   //copy constructor
@@ -80,7 +92,7 @@ AliAlignObjMatrix::AliAlignObjMatrix(const AliAlignObjMatrix& theAlignObj) :
 }
 
 //_____________________________________________________________________________
-AliAlignObjMatrix &AliAlignObjMatrix::operator =(const AliAlignObjMatrix& theAlignObj)
+AliAlignObjMatrix &AliAlignObjMatrix::operator =(const AliAlignObj& theAlignObj)
 {  
   // assignment operator
   //