X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliAlignObjAngles.cxx;h=704e8581c270796c8c4e47c5732ff81b86c14853;hb=30bda8ef7270a200dfe2dcf55badbedb6d36a9ac;hp=ece8da0782d17f19a27991f139e205df4bf5d3de;hpb=c5304981ab2070d906f10498f4d96d9460b95240;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliAlignObjAngles.cxx b/STEER/AliAlignObjAngles.cxx index ece8da0782d..704e8581c27 100644 --- a/STEER/AliAlignObjAngles.cxx +++ b/STEER/AliAlignObjAngles.cxx @@ -21,7 +21,6 @@ #include "AliAlignObj.h" #include "AliAlignObjAngles.h" -//#include "AliLog.h" ClassImp(AliAlignObjAngles) @@ -35,36 +34,36 @@ AliAlignObjAngles::AliAlignObjAngles() : AliAlignObj() } //_____________________________________________________________________________ -AliAlignObjAngles::AliAlignObjAngles(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() +AliAlignObjAngles::AliAlignObjAngles(const char* volpath, 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(volpath,volUId) { // standard constructor with 3 translation + 3 rotation parameters - // - fVolPath=volpath; - fVolUID=voluid; - fTranslation[0]=x; fTranslation[1]=y; fTranslation[2]=z; - fRotation[0]=psi; fRotation[1]=theta; fRotation[2]=phi; -} - -//_____________________________________________________________________________ -AliAlignObjAngles::AliAlignObjAngles(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() -{ - // standard constructor with 3 translation + 3 rotation parameters - // - fVolPath=volpath; - SetVolUID(detId,volId); - fTranslation[0]=x; fTranslation[1]=y; fTranslation[2]=z; - fRotation[0]=psi; fRotation[1]=theta; fRotation[2]=phi; + // 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){ + 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"; + } } //_____________________________________________________________________________ -AliAlignObjAngles::AliAlignObjAngles(const char* volpath, UShort_t voluid, TGeoMatrix& m) : AliAlignObj() +AliAlignObjAngles::AliAlignObjAngles(const char* volpath, UShort_t volUId, TGeoMatrix& m, Bool_t global) throw (const Char_t *) : AliAlignObj(volpath,volUId) { // 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 (!SetMatrix(m)) throw "Alignment object creation failed (can't extract roll-pitch-yall angles from the matrix)!\n"; + + if (!global) { + if (!SetLocalPars(fTranslation[0],fTranslation[1],fTranslation[2],fRotation[0],fRotation[1],fRotation[2])) throw "Alignment object creation failed (TGeo instance needed)!\n"; + } } //_____________________________________________________________________________ @@ -77,8 +76,8 @@ AliAlignObjAngles::AliAlignObjAngles(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]); } //_____________________________________________________________________________ @@ -93,8 +92,9 @@ AliAlignObjAngles &AliAlignObjAngles::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; } @@ -108,11 +108,13 @@ AliAlignObjAngles::~AliAlignObjAngles() //_____________________________________________________________________________ void AliAlignObjAngles::SetTranslation(const TGeoMatrix& m) { + // set the translation parameters extracting them from the matrix + // passed as argument + // if(m.IsTranslation()){ const Double_t* tr = m.GetTranslation(); fTranslation[0]=tr[0]; fTranslation[1]=tr[1]; fTranslation[2]=tr[2]; }else{ -// AliWarning("Argument matrix is not a translation! Setting zero-translation."); fTranslation[0] = fTranslation[1] = fTranslation[2] = 0.; } } @@ -120,33 +122,22 @@ void AliAlignObjAngles::SetTranslation(const TGeoMatrix& m) //_____________________________________________________________________________ Bool_t AliAlignObjAngles::SetRotation(const TGeoMatrix& m) { + // set the rotation parameters extracting them from the matrix + // passed as argument + // if(m.IsRotation()){ const Double_t* rot = m.GetRotationMatrix(); return MatrixToAngles(rot,fRotation); }else{ -// AliWarning("Argument matrix is not a rotation! Setting yaw-pitch-roll to zero."); fRotation[0] = fRotation[1] = fRotation[2] = 0.; return kTRUE; } } -//_____________________________________________________________________________ -void AliAlignObjAngles::SetMatrix(const TGeoMatrix& m) -{ - SetTranslation(m); - SetRotation(m); -} - -//_____________________________________________________________________________ -void AliAlignObjAngles::GetPars(Double_t tr[], Double_t angles[]) const -{ - GetTranslation(tr); - GetAngles(angles); -} - //_____________________________________________________________________________ void AliAlignObjAngles::GetMatrix(TGeoHMatrix& m) const { + // get the transformation matrix from the data memebers parameters m.SetTranslation(&fTranslation[0]); Double_t rot[9]; AnglesToMatrix(fRotation,rot); @@ -156,8 +147,9 @@ void AliAlignObjAngles::GetMatrix(TGeoHMatrix& m) const //_____________________________________________________________________________ AliAlignObj& AliAlignObjAngles::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 AliAlignObjAngles a; a = *this;