]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSgeomMatrix.h
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / AliITSgeomMatrix.h
index 7043684e5f10dc0fe638b0b94d463e0e950df650..a5ca9e8785b45a0d1288ccc976e4e061bdc4635f 100644 (file)
 // By Bjorn S. Nilsen
 ////////////////////////////////////////////////////////////////////////
 
-class AliITSgeomMatrix{
+#include <TObject.h>
+
+class AliITSgeomMatrix : public TObject {
  public:
        AliITSgeomMatrix(); // Default constructor
+       // Standard constructor #1
        AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
                         const Double_t rot[3],const Double_t tran[3]);
+       // Standard constructor #2
         AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
-                        const Double_t matrix[3][3],const Double_t tran[3]);
-        AliITSgeomMatrix(const Double_t rotd[6]/*degrees Geant angles*/,
+                        Double_t matrix[3][3],const Double_t tran[3]);
+       // Standard constructor #3
+        AliITSgeomMatrix(const Double_t rotd[6]/*degrees GEANT angles*/,
                          const Int_t idt,const Int_t id[3],
                          const Double_t tran[3]);
+       // Copy operator
        AliITSgeomMatrix(const AliITSgeomMatrix &source);
+       // Alignment operator
        void operator=(const AliITSgeomMatrix &sourse); // copy
-       virtual ~AliITSgeomMatrix(){};
-       void print(ostream *os);
+       virtual ~AliITSgeomMatrix(){}; // default constructor.
+       // Prints a line describing the output format of the function Print.
+       void PrintComment(ostream *os);
+       // Prints out the content of this class in ASCII format.
+       void Print(ostream *os);
+       // Prints out the content of this class in ASCII format but includes
+       // formating and strings that make it more humanly readable.
        void PrintTitles(ostream *os);
-       void read(istream *is);
+       // Reads in the content of this class in the format of Print
+       void Read(istream *is);
 
+       // Given the rotation angles [radians] it fills frot and computes
+       // the rotation matrix fm.
        void SetAngles(const Double_t rot[3]){// [radians]
               for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
+       // Sets the translation vector and computes fCylR and fCylPhi.
        void SetTranslation(const Double_t tran[3]){
-                           for(Int_t i=0;i<3;i++) ftran[i] = tran[i];}
-       void SetMatrix(const Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
+                           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();}
+       // sets the rotation matrix and computes the rotation angles [radians]
+       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();}
+       // Sets the detector index value
        void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
+       // Sets the detector layer, ladder, detector (id) values.
        void SetIndex(const Int_t id[3]){
                           for(Int_t i=0;i<3;i++) fid[i] = id[i];}
+       // Returns the rotation angles [radians]
        void GetAngles(Double_t rot[3]){// [radians]
                           for(Int_t i=0;i<3;i++)  rot[i] = frot[i];}
+       // Returns the translation vector [cm]
        void GetTranslation(Double_t tran[3]){
                            for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
+       // Returns the translation vector in cylindrical
+       // coordinates [cm,radians]
+       void GetTranslationCylinderical(Double_t tran[3]){
+                           tran[0] = fCylR;
+                           tran[1] = fCylPhi;
+                           tran[2] = ftran[2];}
+       // Returns the values of the rotation matrix
        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;}
+       // Returns the detector index value.
+       Int_t GetDetectorIndex() const {return fDetectorIndex;}
+       // returns the modules index layer, ladder, detector
        void  GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];}
+       // Sets the rotation matrix based on the 6 GEANT rotation
+       // angles [radian]
        void  MatrixFromSixAngles(const Double_t *ang);
+       // Returns the 6 GEANT rotation angles [radians] from the
+       // existing rotation matrix.
        void  SixAnglesFromMatrix(Double_t *ang);
 
+       // Given a position in Cartesian ALICE global coordinates [cm]
+       // returns the position in Cartesian detector/module local
+       //coordinates [cm]
        void GtoLPosition(const Double_t g[3],Double_t l[3]);
+       // Given a position in Cartesian detector/module local coordinates [cm]
+       // returns the position in Cartesian ALICE global
+       //coordinates [cm]
        void LtoGPosition(const Double_t l[3],Double_t g[3]);
+       // Given a momentum in Cartesian ALICE global coordinates
+       // returns the momentum in Cartesian detector/module local
+       //coordinates
        void GtoLMomentum(const Double_t g[3],Double_t l[3]);
+       // Given a momentum in Cartesian detector/module local coordinates 
+       // returns the momentum in Cartesian ALICE global coordinates
        void LtoGMomentum(const Double_t l[3],Double_t g[3]);
-       void GtoLPositionError(const Double_t g[3][3],Double_t l[3][3]);
-       void LtoGPositionError(const Double_t l[3][3],Double_t g[3][3]);
+       // given a position error matrix in ALICE Cartesian global
+       // coordinates [cm] returns a position error matrix in detector/
+       // module local Cartesian local coordinates [cm]
+       void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]);
+       // given a position error matrix in detector/module Cartesian local
+       // coordinates [cm] returns a position error matrix in ALICE
+       // Cartesian global coordinates [cm]
+       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]);
+       // Given a position in Cartesian Tracking global coordinates [cm]
+       // returns the position in Cartesian detector/module local
+       // coordinates [cm]
        void LtoGPositionTracking(const Double_t l[3],Double_t g[3]);
+       // Given a position in Cartesian detector/module local coordinates [cm]
+       // returns the position in Cartesian Tracking global
+       //coordinates [cm]
        void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]);
+       // Given a momentum in Cartesian detector/module local coordinates 
+       // returns the momentum in Cartesian Tracking global coordinates
        void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]);
-       void GtoLPositionErrorTracking(const Double_t g[3][3],
+       // given a position error matrix in Tracking Cartesian global
+       // coordinates [cm] returns a position error matrix in detector/
+       // module local Cartesian local coordinates [cm]
+       void GtoLPositionErrorTracking(Double_t g[3][3],
                                       Double_t l[3][3]);
-       void LtoGPositionErrorTracking(const Double_t l[3][3],
+       // given a position error matrix in detector/module Cartesian local
+       // coordinates [cm] returns a position error matrix in Tracking
+       // Cartesian global coordinates [cm]
+       void LtoGPositionErrorTracking(Double_t l[3][3],
                                       Double_t g[3][3]);
+       // Computes the distance squared [cm^2] between a point t[3] and
+       // this module/detector
        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
+       // Given the rotation matrix fm it fills the rotation angles frot
        void MatrixFromAngle();
+       // Given the rotation angles frot it fills the rotation matrix fm
        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 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 Cylindrical 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.