#ifndef ALIITSGEOMMATRIX_H #define ALIITSGEOMMATRIX_H /* Copyright(c) 2000, ALICE Experiment at CERN, All rights reserved. * * see cxx source for full Copyright notice. */ /* $Id: */ //////////////////////////////////////////////////////////////////////// // ITS geometry manipulation routines on the module level. This class is // to replace the structure ITS_geom in the class AliITSgeom. // Created May 30 2000. // version 0.0.0 // By Bjorn S. Nilsen //////////////////////////////////////////////////////////////////////// class AliITSgeomMatrix : public TObject { public: AliITSgeomMatrix(); // Default constructor AliITSgeomMatrix(const Int_t idt,const Int_t id[3], const Double_t rot[3],const Double_t tran[3]); AliITSgeomMatrix(const Int_t idt,const Int_t id[3], Double_t matrix[3][3],const Double_t tran[3]); AliITSgeomMatrix(const Double_t rotd[6]/*degrees Geant angles*/, const Int_t idt,const Int_t id[3], const Double_t tran[3]); AliITSgeomMatrix(const AliITSgeomMatrix &source); void operator=(const AliITSgeomMatrix &sourse); // copy virtual ~AliITSgeomMatrix(){}; void PrintComment(ostream *os); void Print(ostream *os); void PrintTitles(ostream *os); void Read(istream *is); void SetAngles(const Double_t rot[3]){// [radians] for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();} void SetTranslation(const Double_t tran[3]){ for(Int_t i=0;i<3;i++) ftran[i] = tran[i]; fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ ftran[1]*ftran[1]); fCylPhi = TMath::ATan2(ftran[1],ftran[0]); if(fCylPhi<0.0) fCylPhi += TMath::Pi();} void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++) for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();} void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;} void SetIndex(const Int_t id[3]){ for(Int_t i=0;i<3;i++) fid[i] = id[i];} void GetAngles(Double_t rot[3]){// [radians] for(Int_t i=0;i<3;i++) rot[i] = frot[i];} void GetTranslation(Double_t tran[3]){ for(Int_t i=0;i<3;i++) tran[i] = ftran[i];} void GetTranslationCylinderical(Double_t tran[3]){ tran[0] = fCylR; tran[1] = fCylPhi; tran[2] = ftran[2];} void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++) for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];} Int_t GetDetectorIndex() {return fDetectorIndex;} void GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];} void MatrixFromSixAngles(const Double_t *ang); void SixAnglesFromMatrix(Double_t *ang); void GtoLPosition(const Double_t g[3],Double_t l[3]); void LtoGPosition(const Double_t l[3],Double_t g[3]); void GtoLMomentum(const Double_t g[3],Double_t l[3]); void LtoGMomentum(const Double_t l[3],Double_t g[3]); void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]); void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]); // Tracking Related Routines void GtoLPositionTracking(const Double_t g[3],Double_t l[3]); void LtoGPositionTracking(const Double_t l[3],Double_t g[3]); void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]); void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]); void GtoLPositionErrorTracking(Double_t g[3][3], Double_t l[3][3]); void LtoGPositionErrorTracking(Double_t l[3][3], Double_t g[3][3]); Double_t Distance2(const Double_t t[3]){Double_t d=0.0,q; for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;} return d;} private: // private functions void MatrixFromAngle(); void AngleFromMatrix(); private: // Data members. Int_t fDetectorIndex; // Detector type index (like fShapeIndex was) Int_t fid[3]; // layer, ladder, detector numbers. Double_t frot[3]; //! vector of rotations about x,y,z [radians]. Double_t ftran[3]; // Translation vector of module x,y,z. Double_t fCylR,fCylPhi; //! Translation vector in Cylinderical coord. Double_t fm[3][3]; // Rotation matrix based on frot. // Note, fCylR and fCylPhi are added as data members because it costs // about a factor of 10 to compute them over looking them up. Since // they are used in some tracking algorithms this can be a large cost // in computing time. They are not written out but computed. ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom. }; // Input and output function for standard C++ input/output. ostream &operator<<(ostream &os,AliITSgeomMatrix &source); istream &operator>>(istream &os,AliITSgeomMatrix &source); #endif