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