]>
Commit | Line | Data |
---|---|---|
df5240ea | 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 | ||
85f1e34a | 14 | #include <TObject.h> |
15 | ||
8253cd9a | 16 | class AliITSgeomMatrix : public TObject { |
df5240ea | 17 | public: |
18 | AliITSgeomMatrix(); // Default constructor | |
85f1e34a | 19 | // Standard constructor #1 |
df5240ea | 20 | AliITSgeomMatrix(const Int_t idt,const Int_t id[3], |
21 | const Double_t rot[3],const Double_t tran[3]); | |
85f1e34a | 22 | // Standard constructor #2 |
df5240ea | 23 | AliITSgeomMatrix(const Int_t idt,const Int_t id[3], |
d962cab4 | 24 | Double_t matrix[3][3],const Double_t tran[3]); |
85f1e34a | 25 | // Standard constructor #3 |
26 | AliITSgeomMatrix(const Double_t rotd[6]/*degrees GEANT angles*/, | |
df5240ea | 27 | const Int_t idt,const Int_t id[3], |
28 | const Double_t tran[3]); | |
85f1e34a | 29 | // Copy operator |
df5240ea | 30 | AliITSgeomMatrix(const AliITSgeomMatrix &source); |
85f1e34a | 31 | // Alignment operator |
df5240ea | 32 | void operator=(const AliITSgeomMatrix &sourse); // copy |
85f1e34a | 33 | virtual ~AliITSgeomMatrix(){}; // default constructor. |
34 | // Prints a line describing the output format of the function Print. | |
8253cd9a | 35 | void PrintComment(ostream *os); |
85f1e34a | 36 | // Prints out the content of this class in ASCII format. |
8253cd9a | 37 | void Print(ostream *os); |
85f1e34a | 38 | // Prints out the content of this class in ASCII format but includes |
39 | // formating and strings that make it more humanly readable. | |
df5240ea | 40 | void PrintTitles(ostream *os); |
85f1e34a | 41 | // Reads in the content of this class in the format of Print |
8253cd9a | 42 | void Read(istream *is); |
df5240ea | 43 | |
85f1e34a | 44 | // Given the rotation angles [radians] it fills frot and computes |
45 | // the rotation matrix fm. | |
df5240ea | 46 | void SetAngles(const Double_t rot[3]){// [radians] |
47 | for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();} | |
85f1e34a | 48 | // Sets the translation vector and computes fCylR and fCylPhi. |
df5240ea | 49 | void SetTranslation(const Double_t tran[3]){ |
d8cc8493 | 50 | for(Int_t i=0;i<3;i++) ftran[i] = tran[i]; |
51 | fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ | |
52 | ftran[1]*ftran[1]); | |
53 | fCylPhi = TMath::ATan2(ftran[1],ftran[0]); | |
54 | if(fCylPhi<0.0) fCylPhi += TMath::Pi();} | |
85f1e34a | 55 | // sets the rotation matrix and computes the rotation angles [radians] |
d962cab4 | 56 | void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++) |
df5240ea | 57 | for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();} |
85f1e34a | 58 | // Sets the detector index value |
df5240ea | 59 | void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;} |
85f1e34a | 60 | // Sets the detector layer, ladder, detector (id) values. |
df5240ea | 61 | void SetIndex(const Int_t id[3]){ |
62 | for(Int_t i=0;i<3;i++) fid[i] = id[i];} | |
85f1e34a | 63 | // Returns the rotation angles [radians] |
df5240ea | 64 | void GetAngles(Double_t rot[3]){// [radians] |
65 | for(Int_t i=0;i<3;i++) rot[i] = frot[i];} | |
85f1e34a | 66 | // Returns the translation vector [cm] |
df5240ea | 67 | void GetTranslation(Double_t tran[3]){ |
68 | for(Int_t i=0;i<3;i++) tran[i] = ftran[i];} | |
85f1e34a | 69 | // Returns the translation vector in cylindrical |
70 | // coordinates [cm,radians] | |
d8cc8493 | 71 | void GetTranslationCylinderical(Double_t tran[3]){ |
72 | tran[0] = fCylR; | |
73 | tran[1] = fCylPhi; | |
74 | tran[2] = ftran[2];} | |
85f1e34a | 75 | // Returns the values of the rotation matrix |
df5240ea | 76 | void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++) |
77 | for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];} | |
85f1e34a | 78 | // Returns the detector index value. |
79 | Int_t GetDetectorIndex() const {return fDetectorIndex;} | |
80 | // returns the modules index layer, ladder, detector | |
df5240ea | 81 | void GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];} |
85f1e34a | 82 | // Sets the rotation matrix based on the 6 GEANT rotation |
83 | // angles [radian] | |
df5240ea | 84 | void MatrixFromSixAngles(const Double_t *ang); |
85f1e34a | 85 | // Returns the 6 GEANT rotation angles [radians] from the |
86 | // existing rotation matrix. | |
df5240ea | 87 | void SixAnglesFromMatrix(Double_t *ang); |
88 | ||
85f1e34a | 89 | // Given a position in Cartesian ALICE global coordinates [cm] |
90 | // returns the position in Cartesian detector/module local | |
91 | //coordinates [cm] | |
df5240ea | 92 | void GtoLPosition(const Double_t g[3],Double_t l[3]); |
85f1e34a | 93 | // Given a position in Cartesian detector/module local coordinates [cm] |
94 | // returns the position in Cartesian ALICE global | |
95 | //coordinates [cm] | |
df5240ea | 96 | void LtoGPosition(const Double_t l[3],Double_t g[3]); |
85f1e34a | 97 | // Given a momentum in Cartesian ALICE global coordinates |
98 | // returns the momentum in Cartesian detector/module local | |
99 | //coordinates | |
df5240ea | 100 | void GtoLMomentum(const Double_t g[3],Double_t l[3]); |
85f1e34a | 101 | // Given a momentum in Cartesian detector/module local coordinates |
102 | // returns the momentum in Cartesian ALICE global coordinates | |
df5240ea | 103 | void LtoGMomentum(const Double_t l[3],Double_t g[3]); |
85f1e34a | 104 | // given a position error matrix in ALICE Cartesian global |
105 | // coordinates [cm] returns a position error matrix in detector/ | |
106 | // module local Cartesian local coordinates [cm] | |
8d5bd3f9 | 107 | void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]); |
85f1e34a | 108 | // given a position error matrix in detector/module Cartesian local |
109 | // coordinates [cm] returns a position error matrix in ALICE | |
110 | // Cartesian global coordinates [cm] | |
8d5bd3f9 | 111 | void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]); |
df5240ea | 112 | // Tracking Related Routines |
113 | void GtoLPositionTracking(const Double_t g[3],Double_t l[3]); | |
85f1e34a | 114 | // Given a position in Cartesian Tracking global coordinates [cm] |
115 | // returns the position in Cartesian detector/module local | |
116 | // coordinates [cm] | |
df5240ea | 117 | void LtoGPositionTracking(const Double_t l[3],Double_t g[3]); |
85f1e34a | 118 | // Given a position in Cartesian detector/module local coordinates [cm] |
119 | // returns the position in Cartesian Tracking global | |
120 | //coordinates [cm] | |
df5240ea | 121 | void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]); |
85f1e34a | 122 | // Given a momentum in Cartesian detector/module local coordinates |
123 | // returns the momentum in Cartesian Tracking global coordinates | |
df5240ea | 124 | void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]); |
85f1e34a | 125 | // given a position error matrix in Tracking Cartesian global |
126 | // coordinates [cm] returns a position error matrix in detector/ | |
127 | // module local Cartesian local coordinates [cm] | |
8d5bd3f9 | 128 | void GtoLPositionErrorTracking(Double_t g[3][3], |
df5240ea | 129 | Double_t l[3][3]); |
85f1e34a | 130 | // given a position error matrix in detector/module Cartesian local |
131 | // coordinates [cm] returns a position error matrix in Tracking | |
132 | // Cartesian global coordinates [cm] | |
8d5bd3f9 | 133 | void LtoGPositionErrorTracking(Double_t l[3][3], |
df5240ea | 134 | Double_t g[3][3]); |
85f1e34a | 135 | // Computes the distance squared [cm^2] between a point t[3] and |
136 | // this module/detector | |
df5240ea | 137 | Double_t Distance2(const Double_t t[3]){Double_t d=0.0,q; |
138 | for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;} | |
139 | return d;} | |
140 | private: // private functions | |
85f1e34a | 141 | // Given the rotation matrix fm it fills the rotation angles frot |
df5240ea | 142 | void MatrixFromAngle(); |
85f1e34a | 143 | // Given the rotation angles frot it fills the rotation matrix fm |
df5240ea | 144 | void AngleFromMatrix(); |
145 | private: // Data members. | |
146 | Int_t fDetectorIndex; // Detector type index (like fShapeIndex was) | |
147 | Int_t fid[3]; // layer, ladder, detector numbers. | |
8253cd9a | 148 | Double_t frot[3]; //! vector of rotations about x,y,z [radians]. |
df5240ea | 149 | Double_t ftran[3]; // Translation vector of module x,y,z. |
85f1e34a | 150 | Double_t fCylR,fCylPhi; //! Translation vector in Cylindrical coord. |
df5240ea | 151 | Double_t fm[3][3]; // Rotation matrix based on frot. |
152 | ||
d8cc8493 | 153 | // Note, fCylR and fCylPhi are added as data members because it costs |
154 | // about a factor of 10 to compute them over looking them up. Since | |
155 | // they are used in some tracking algorithms this can be a large cost | |
156 | // in computing time. They are not written out but computed. | |
157 | ||
df5240ea | 158 | ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom. |
159 | }; | |
160 | // Input and output function for standard C++ input/output. | |
161 | ostream &operator<<(ostream &os,AliITSgeomMatrix &source); | |
162 | istream &operator>>(istream &os,AliITSgeomMatrix &source); | |
163 | ||
164 | #endif |