]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomMatrix.h
7043684e5f10dc0fe638b0b94d463e0e950df650
[u/mrichter/AliRoot.git] / ITS / AliITSgeomMatrix.h
1 #ifndef ALIITSGEOMMATRIX_H
2 #define ALIITSGEOMMATRIX_H
3 /* Copyright(c) 2000, ALICE Experiment at CERN, All rights reserved. *
4  * see cxx source for full Copyright notice.                         */
5 /* $Id: */
6 ////////////////////////////////////////////////////////////////////////
7 // ITS geometry manipulation routines on the module level. This class is
8 // to replace the structure ITS_geom in the class AliITSgeom.
9 // Created May 30 2000.
10 // version 0.0.0
11 // By Bjorn S. Nilsen
12 ////////////////////////////////////////////////////////////////////////
13
14 class AliITSgeomMatrix{
15  public:
16         AliITSgeomMatrix(); // Default constructor
17         AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
18                          const Double_t rot[3],const Double_t tran[3]);
19         AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
20                          const Double_t matrix[3][3],const Double_t tran[3]);
21         AliITSgeomMatrix(const Double_t rotd[6]/*degrees Geant angles*/,
22                          const Int_t idt,const Int_t id[3],
23                          const Double_t tran[3]);
24         AliITSgeomMatrix(const AliITSgeomMatrix &source);
25         void operator=(const AliITSgeomMatrix &sourse); // copy
26         virtual ~AliITSgeomMatrix(){};
27         void print(ostream *os);
28         void PrintTitles(ostream *os);
29         void read(istream *is);
30
31         void SetAngles(const Double_t rot[3]){// [radians]
32               for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
33         void SetTranslation(const Double_t tran[3]){
34                             for(Int_t i=0;i<3;i++) ftran[i] = tran[i];}
35         void SetMatrix(const Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
36          for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
37         void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
38         void SetIndex(const Int_t id[3]){
39                            for(Int_t i=0;i<3;i++) fid[i] = id[i];}
40         void GetAngles(Double_t rot[3]){// [radians]
41                            for(Int_t i=0;i<3;i++)  rot[i] = frot[i];}
42         void GetTranslation(Double_t tran[3]){
43                             for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
44         void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++)
45                          for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
46         Int_t GetDetectorIndex() {return fDetectorIndex;}
47         void  GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];}
48         void  MatrixFromSixAngles(const Double_t *ang);
49         void  SixAnglesFromMatrix(Double_t *ang);
50
51         void GtoLPosition(const Double_t g[3],Double_t l[3]);
52         void LtoGPosition(const Double_t l[3],Double_t g[3]);
53         void GtoLMomentum(const Double_t g[3],Double_t l[3]);
54         void LtoGMomentum(const Double_t l[3],Double_t g[3]);
55         void GtoLPositionError(const Double_t g[3][3],Double_t l[3][3]);
56         void LtoGPositionError(const Double_t l[3][3],Double_t g[3][3]);
57         // Tracking Related Routines
58         void GtoLPositionTracking(const Double_t g[3],Double_t l[3]);
59         void LtoGPositionTracking(const Double_t l[3],Double_t g[3]);
60         void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]);
61         void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]);
62         void GtoLPositionErrorTracking(const Double_t g[3][3],
63                                        Double_t l[3][3]);
64         void LtoGPositionErrorTracking(const Double_t l[3][3],
65                                        Double_t g[3][3]);
66         Double_t Distance2(const Double_t t[3]){Double_t d=0.0,q;
67                  for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
68                  return d;}
69  private: // private functions
70         void MatrixFromAngle();
71         void AngleFromMatrix();
72  private: // Data members.
73         Int_t    fDetectorIndex; // Detector type index (like fShapeIndex was)
74         Int_t    fid[3];         // layer, ladder, detector numbers.
75         Double_t frot[3];        // vector of rotations about x,y,z [radians].
76         Double_t ftran[3];       // Translation vector of module x,y,z.
77         Double_t fm[3][3];       // Rotation matrix based on frot.
78
79         ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
80 };
81 // Input and output function for standard C++ input/output.
82 ostream &operator<<(ostream &os,AliITSgeomMatrix &source);
83 istream &operator>>(istream &os,AliITSgeomMatrix &source);
84
85 #endif