]>
Commit | Line | Data |
---|---|---|
b79e4bc3 | 1 | #ifndef ALIITSGEOM_H |
2 | #define ALIITSGEOM_H | |
3da30618 | 3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
58005f18 | 8 | ///////////////////////////////////////////////////////////////////////// |
9 | // ITS geometry manipulation routines. | |
10 | // Created April 15 1999. | |
11 | // version: 0.0.0 | |
12 | // By: Bjorn S. Nilsen | |
13 | // | |
14 | // A package of geometry routines to do transformations between | |
15 | // local, detector active area, and ALICE global coordinate system in such | |
16 | // a way as to allow for detector alignment studies and the like. All of | |
17 | // the information needed to do the coordinate transformation are kept in | |
18 | // a specialized structure for ease of implementation. | |
19 | ///////////////////////////////////////////////////////////////////////// | |
5c9c741e | 20 | #include <iostream.h> |
e8189707 | 21 | #include <TObjArray.h> |
22 | #include <TVector.h> | |
23 | ||
269f57ed | 24 | #include "AliITSgeomMatrix.h" |
58005f18 | 25 | |
8253cd9a | 26 | class ifstream; |
27 | class ofstream; | |
28 | ||
29 | ||
5c9c741e | 30 | typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector; |
58005f18 | 31 | |
32 | //_______________________________________________________________________ | |
33 | ||
34 | class AliITSgeom : public TObject { | |
b79e4bc3 | 35 | |
58005f18 | 36 | public: |
269f57ed | 37 | AliITSgeom(); // Default constructor |
38 | AliITSgeom(const char *filename); // Constructor | |
8253cd9a | 39 | AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets, |
40 | Int_t nmods); // Constructor | |
41 | // this function allocates a AliITSgeomMatrix for a particular | |
42 | // module. | |
43 | void CreatMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det, | |
44 | AliITSDetector idet,Double_t tran[3],Double_t rot[10]); | |
45 | void ReadNewFile(const char *filename); // Constructor for new format. | |
46 | void WriteNewFile(const char *filename); // Output for new format. | |
269f57ed | 47 | AliITSgeom(AliITSgeom &source); // Copy constructor |
48 | void operator=(AliITSgeom &source);// = operator | |
49 | virtual ~AliITSgeom(); // Default destructor | |
50 | // Getters | |
51 | Int_t GetTransformationType() const {return fTrans;} | |
52 | // | |
8253cd9a | 53 | // returns kTRUE if the tranformation defined by this class is |
54 | // for Global Geant coordiante system to the local Geant coordinate system | |
55 | // of the detector. These are the transformation used by GEANT. | |
269f57ed | 56 | Bool_t IsGeantToGeant() const {return (fTrans == 0);} |
8253cd9a | 57 | // returns kTRUE if the tranformation defined by this class is |
58 | // for Global Geant coordiante system to the local "Tracking" coordinate | |
59 | // system of the detector. These are the transformation used by the | |
60 | // Tracking code. | |
269f57ed | 61 | Bool_t IsGeantToTracking() const {return ((fTrans&&0xfffe)!= 0);} |
8253cd9a | 62 | // returns kTRUE if the tranformation defined by this class is |
63 | // for Global Geant coordiante system to the local Geant coordinate system | |
64 | // of the detector but may have been displaced by some typicaly small | |
65 | // abount. These are modified transformation simular to that used by GEANT. | |
269f57ed | 66 | Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);} |
8253cd9a | 67 | // returns kTRUE if the shape defined by ishape has been defined in this |
68 | // set of transformations. Typical values of ishape are kSPD, kSDD, kSSD, | |
69 | // SSD2. | |
70 | Bool_t IsShapeDefined(Int_t ishape){ | |
5c9c741e | 71 | if(fShape!=0){return ((fShape->At(ishape))!=0);}else return kFALSE;} |
269f57ed | 72 | // |
8253cd9a | 73 | // This function returns a pointer to the particular AliITSgeomMatrix |
74 | // class for a specific module index. | |
75 | AliITSgeomMatrix *GetGeomMatrix(Int_t index){ | |
76 | return (AliITSgeomMatrix*)(fGm->At(index));} | |
269f57ed | 77 | // This function returns the number of detectors/ladder for a give |
78 | // layer. In particular it returns fNdet[layer-1]. | |
79 | Int_t GetNdetectors(const Int_t lay) const {return fNdet[lay-1];} | |
80 | // This function returns the number of ladders for a give layer. In | |
81 | // particular it returns fNlad[layer-1]. | |
82 | Int_t GetNladders(const Int_t lay) const {return fNlad[lay-1];} | |
83 | // This function returns the number of layers defined in the ITS | |
84 | // geometry. In particular it returns fNlayers. | |
85 | Int_t GetNlayers() const {return fNlayers;} | |
86 | Int_t GetModuleIndex(const Int_t lay,const Int_t lad,const Int_t det); | |
87 | // This function returns the module index number given the layer, | |
88 | // ladder and detector numbers put into the array id[3]. | |
89 | Int_t GetModuleIndex(const Int_t *id){ | |
90 | return GetModuleIndex(id[0],id[1],id[2]);} | |
91 | void GetModuleId(const Int_t index,Int_t &lay,Int_t &lad,Int_t &det); | |
92 | // | |
93 | Int_t GetStartDet(const Int_t dtype ); | |
94 | Int_t GetLastDet(const Int_t dtype); | |
95 | // Returns the starting module index number for SPD detector, | |
96 | // assuming the modules are placed in the "standard" cylindrical | |
97 | // ITS structure. | |
98 | Int_t GetStartSPD() {return GetModuleIndex(1,1,1);} | |
99 | // Returns the ending module index number for SPD detector, | |
100 | // assuming the modules are placed in the "standard" cylindrical | |
101 | // ITS structure. | |
102 | Int_t GetLastSPD() {return GetModuleIndex(2,fNlad[1],fNdet[1]);} | |
103 | // Returns the starting module index number for SDD detector, | |
104 | // assuming the modules are placed in the "standard" cylindrical | |
105 | // ITS structure. | |
106 | Int_t GetStartSDD() {return GetModuleIndex(3,1,1);} | |
107 | // Returns the ending module index number for SDD detector, | |
108 | // assuming the modules are placed in the "standard" cylindrical | |
109 | // ITS structure. | |
110 | Int_t GetLastSDD() {return GetModuleIndex(4,fNlad[3],fNdet[3]);} | |
111 | // Returns the starting module index number for SSD detector, | |
112 | // assuming the modules are placed in the "standard" cylindrical | |
113 | // ITS structure. | |
114 | Int_t GetStartSSD() {return GetModuleIndex(5,1,1);} | |
115 | // Returns the ending module index number for SSD detector, | |
116 | // assuming the modules are placed in the "standard" cylindrical | |
117 | // ITS structure. | |
118 | Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);} | |
119 | // Returns the last module index number. | |
120 | Int_t GetIndexMax() {return fNmodules;} | |
121 | // | |
122 | // This function returns the rotation angles for a give module | |
123 | // in the Double point array ang[3]. The angles are in radians | |
124 | void GetAngles(const Int_t index,Double_t *ang) { | |
8253cd9a | 125 | GetGeomMatrix(index)->GetAngles(ang);} |
269f57ed | 126 | // This function returns the rotation angles for a give module |
127 | // in the three floating point variables provided. rx = frx, | |
128 | // fy = fry, rz = frz. The angles are in radians | |
129 | void GetAngles(const Int_t index,Float_t &rx,Float_t &ry,Float_t &rz) { | |
130 | Double_t a[3];GetAngles(index,a); | |
131 | rx = a[0];ry = a[1];rz = a[2];} | |
132 | // This function returns the rotation angles for a give detector on | |
133 | // a give ladder in a give layer in the three floating point variables | |
134 | // provided. rx = frx, fy = fry, rz = frz. The angles are in radians | |
135 | void GetAngles(const Int_t lay,const Int_t lad,const Int_t det, | |
136 | Float_t &rx,Float_t &ry,Float_t &rz) { | |
137 | GetAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} | |
138 | // | |
139 | // This function returns the 6 GEANT rotation angles for a give | |
140 | // module in the double point array ang[3]. The angles are in degrees | |
141 | void GetGeantAngles(const Int_t index,Double_t *ang){ | |
8253cd9a | 142 | GetGeomMatrix(index)->SixAnglesFromMatrix(ang);} |
269f57ed | 143 | // |
144 | // This function returns the Cartesian translation for a give | |
145 | // module in the Double array t[3]. The units are | |
146 | // those of the Monte Carlo, generally cm. | |
147 | void GetTrans(const Int_t index,Double_t *t) { | |
8253cd9a | 148 | GetGeomMatrix(index)->GetTranslation(t);} |
269f57ed | 149 | // This function returns the Cartesian translation for a give |
150 | // module index in the three floating point variables provided. | |
151 | // x = fx0, y = fy0, z = fz0. The units are those of the Mont | |
152 | // Carlo, generally cm. | |
153 | void GetTrans(const Int_t index,Float_t &x,Float_t &y,Float_t &z) { | |
154 | Double_t t[3];GetTrans(index,t); | |
155 | x = t[0];y = t[1];z = t[2];} | |
156 | // This function returns the Cartesian translation for a give | |
157 | // detector on a give ladder in a give layer in the three floating | |
158 | // point variables provided. x = fx0, y = fy0, z = fz0. The units are | |
159 | // those of the Monte Carlo, generally cm. | |
160 | void GetTrans(const Int_t lay,const Int_t lad,const Int_t det, | |
161 | Float_t &x,Float_t &y,Float_t &z) { | |
162 | GetTrans(GetModuleIndex(lay,lad,det),x,y,z);} | |
163 | // | |
164 | // This function returns the Cartesian translation [cm] and the | |
165 | // 6 GEANT rotation angles [degrees]for a given layer ladder and | |
166 | // detector number, in the TVector x (at least 9 elements large). | |
167 | void GetCenterThetaPhi(const Int_t lay,const Int_t lad,const Int_t det, | |
168 | TVector &x){Double_t t[3],ang[6]; | |
169 | Int_t index=GetModuleIndex(lay,lad,det); | |
170 | GetTrans(index,t);GetGeantAngles(index,ang); | |
171 | x(0) = t[0];x(1) = t[1];x(2) = t[2]; | |
172 | x(3) = ang[0];x(4) = ang[1];x(5) = ang[2]; | |
173 | x(6) = ang[3];x(7) = ang[4];x(8) = ang[5];} | |
174 | // | |
175 | // This function returns the rotation matrix in Double | |
176 | // precision for a given module. | |
177 | void GetRotMatrix(const Int_t index,Double_t mat[3][3]){ | |
8253cd9a | 178 | GetGeomMatrix(index)->GetMatrix(mat);} |
269f57ed | 179 | // This function returns the rotation matrix in a Double |
180 | // precision pointer for a given module. mat[i][j] => mat[3*i+j]. | |
181 | void GetRotMatrix(const Int_t index,Double_t *mat){ | |
182 | Double_t rot[3][3];GetRotMatrix(index,rot); | |
183 | for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];} | |
184 | // This function returns the rotation matrix in a floating | |
185 | // precision pointer for a given layer ladder and detector module. | |
186 | // mat[i][j] => mat[3*i+j]. | |
187 | void GetRotMatrix(const Int_t lay,const Int_t lad,const Int_t det, | |
188 | Float_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} | |
189 | // This function returns the rotation matrix in a Double | |
190 | // precision pointer for a given layer ladder and detector module. | |
191 | // mat[i][j] => mat[3*i+j]. | |
192 | void GetRotMatrix(const Int_t lay,const Int_t lad,const Int_t det, | |
193 | Double_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} | |
194 | // This function returns the rotation matrix in a floating | |
195 | // precision pointer for a given module. mat[i][j] => mat[3*i+j]. | |
196 | void GetRotMatrix(const Int_t index,Float_t *mat){ | |
8253cd9a | 197 | Double_t rot[3][3]; |
198 | GetGeomMatrix(index)->GetMatrix(rot); | |
269f57ed | 199 | for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];} |
200 | // | |
8253cd9a | 201 | // Will define fShape if it isn't already defined. |
202 | void DefineShapes(const Int_t size=4) | |
203 | {if(fShape==0) fShape = new TObjArray(size);else fShape->Expand(size);} | |
204 | // this function returns a pointer to the class decribing a particluar | |
205 | // detectory type based on AliITSDetector value. This will return a pointer | |
206 | // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD, | |
207 | // for example. | |
208 | virtual TObject *GetShape(const AliITSDetector idet) | |
209 | {return fShape->At((Int_t)idet);}; | |
269f57ed | 210 | // This function returns a pointer to the class describing the |
211 | // detector for a particular module index. This will return a pointer | |
212 | // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD, | |
213 | // for example. | |
8253cd9a | 214 | virtual TObject *GetShape(const Int_t index){ |
215 | return fShape->At(GetGeomMatrix(index)-> | |
216 | GetDetectorIndex());} | |
269f57ed | 217 | // This function returns a pointer to the class describing the |
218 | // detector for a particular layer ladder and detector numbers. This | |
219 | // will return a pointer to one of the classes AliITSgeomSPD, | |
220 | // AliITSgeomSDD, or AliITSgeomSSD, for example. | |
221 | virtual TObject *GetShape(const Int_t lay,const Int_t lad,const Int_t det) | |
222 | {return GetShape(GetModuleIndex(lay,lad,det));} | |
269f57ed | 223 | // |
224 | // Setters | |
225 | // Sets the rotation angles and matrix for a give module index | |
226 | // via the double precision array a[3] [radians]. | |
227 | void SetByAngles(const Int_t index,const Double_t a[]){ | |
8253cd9a | 228 | GetGeomMatrix(index)->SetAngles(a);} |
269f57ed | 229 | // Sets the rotation angles and matrix for a give module index |
230 | // via the 3 floating precision variables rx, ry, and rz [radians]. | |
231 | void SetByAngles(const Int_t index, | |
232 | const Float_t rx,const Float_t ry,const Float_t rz) { | |
233 | Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz; | |
8253cd9a | 234 | GetGeomMatrix(index)->SetAngles(a);} |
269f57ed | 235 | // Sets the rotation angles and matrix for a give layer, ladder, |
236 | // and detector numbers via the 3 floating precision variables rx, | |
237 | // ry, and rz [radians]. | |
238 | void SetByAngles(const Int_t lay,const Int_t lad,const Int_t det, | |
239 | const Float_t rx,const Float_t ry,const Float_t rz) { | |
240 | SetByAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} | |
241 | // | |
242 | // Sets the rotation angles and matrix for a give module index | |
243 | // via the Double precision array a[6] [degree]. The angles are those | |
244 | // defined by GEANT 3.12. | |
245 | void SetByGeantAngles(const Int_t index,const Double_t *ang){ | |
8253cd9a | 246 | GetGeomMatrix(index)->MatrixFromSixAngles(ang);} |
269f57ed | 247 | // Sets the rotation angles and matrix for a give layer, ladder |
248 | // and detector, in the array id[3] via the Double precision array | |
249 | // a[6] [degree]. The angles are those defined by GEANT 3.12. | |
250 | void SetByGeantAngles(const Int_t *id,const Double_t *ang){ | |
251 | SetByGeantAngles(GetModuleIndex(id),ang);} | |
252 | // Sets the rotation angles and matrix for a give layer, ladder | |
253 | // and detector, via the Double precision array a[6] [degree]. The | |
254 | // angles are those defined by GEANT 3.12. | |
255 | void SetByGeantAngles(const Int_t lay,const Int_t lad,const Int_t det, | |
256 | const Double_t *ang){ | |
257 | SetByGeantAngles(GetModuleIndex(lay,lad,det),ang);} | |
258 | // | |
259 | // This function sets a new translation vector, given by the | |
260 | // array x[3], for the Cartesian coordinate transformation | |
261 | // for a give module index. | |
262 | void SetTrans(const Int_t index,Double_t x[]){ | |
8253cd9a | 263 | GetGeomMatrix(index)->SetTranslation(x);} |
269f57ed | 264 | // This function sets a new translation vector, given by the three |
265 | // variables x, y, and z, for the Cartesian coordinate transformation | |
266 | // for the detector defined by layer, ladder and detector. | |
267 | void SetTrans(const Int_t lay,const Int_t lad,const Int_t det, | |
268 | Float_t x,Float_t y,Float_t z){Double_t t[3]; | |
269 | t[0] = x;t[1] = y;t[2] = z; | |
270 | SetTrans(GetModuleIndex(lay,lad,det),t);} | |
271 | // | |
272 | // This function adds one more shape element to the TObjArray | |
273 | // fShape. It is primarily used in the constructor functions of the | |
274 | // AliITSgeom class. The pointer *shape can be the pointer to any | |
275 | // class that is derived from TObject (this is true for nearly every | |
276 | // ROOT class). This does not appear to be working properly at this time. | |
277 | void AddShape(TObject *shp){fShape->AddLast(shp);} | |
278 | // This function deletes an existing shape element, of type TObject, | |
279 | // and replaces it with the one specified. This is primarily used to | |
280 | // changes the parameters to the segmentation class for a particular | |
281 | // type of detector. | |
282 | void ReSetShape(const Int_t dtype,TObject *shp){ | |
283 | fShape->RemoveAt(dtype);fShape->AddAt(shp,dtype);} | |
284 | // | |
285 | // transformations | |
286 | // Transforms from the ALICE Global coordinate system | |
287 | // to the detector local coordinate system for the detector | |
288 | // defined by the layer, ladder, and detector numbers. The | |
289 | // global and local coordinate are given in two floating point | |
290 | // arrays g[3], and l[3]. | |
291 | void GtoL(const Int_t lay,const Int_t lad,const Int_t det, | |
292 | const Float_t *g,Float_t *l){ | |
293 | GtoL(GetModuleIndex(lay,lad,det),g,l);} | |
294 | // Transforms from the ALICE Global coordinate system | |
295 | // to the detector local coordinate system for the detector | |
296 | // defined by the id[0], id[1], and id[2] numbers. The | |
297 | // global and local coordinate are given in two floating point | |
298 | // arrays g[3], and l[3]. | |
299 | void GtoL(const Int_t *id,const Float_t *g,Float_t *l){ | |
300 | GtoL(GetModuleIndex(id),g,l);} | |
301 | // Transforms from the ALICE Global coordinate system | |
302 | // to the detector local coordinate system for the detector | |
303 | // module index number. The global and local coordinate are | |
304 | // given in two floating point arrays g[3], and l[3]. | |
305 | void GtoL(const Int_t index,const Float_t *g,Float_t *l){ | |
d962cab4 | 306 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; |
8253cd9a | 307 | GetGeomMatrix(index)->GtoLPosition(dg,dl); |
d962cab4 | 308 | for(i=0;i<3;i++) l[i] =dl[i];} |
269f57ed | 309 | // Transforms from the ALICE Global coordinate system |
310 | // to the detector local coordinate system for the detector | |
311 | // defined by the layer, ladder, and detector numbers. The | |
312 | // global and local coordinate are given in two Double point | |
313 | // arrays g[3], and l[3]. | |
314 | void GtoL(const Int_t lay,const Int_t lad,const Int_t det, | |
315 | const Double_t *g,Double_t *l){ | |
316 | GtoL(GetModuleIndex(lay,lad,det),g,l);} | |
317 | // Transforms from the ALICE Global coordinate system | |
318 | // to the detector local coordinate system for the detector | |
319 | // defined by the id[0], id[1], and id[2] numbers. The | |
320 | // global and local coordinate are given in two Double point | |
321 | // arrays g[3], and l[3]. | |
322 | void GtoL(const Int_t *id,const Double_t *g,Double_t *l){ | |
323 | GtoL(GetModuleIndex(id),g,l);} | |
324 | // Transforms from the ALICE Global coordinate system | |
325 | // to the detector local coordinate system for the detector | |
326 | // module index number. The global and local coordinate are | |
327 | // given in two Double point arrays g[3], and l[3]. | |
328 | void GtoL(const Int_t index,const Double_t *g,Double_t *l){ | |
d962cab4 | 329 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; |
8253cd9a | 330 | GetGeomMatrix(index)->GtoLPosition(dg,dl); |
d962cab4 | 331 | for(i=0;i<3;i++) l[i] =dl[i];} |
269f57ed | 332 | // |
333 | // Transforms from the ALICE Global coordinate system | |
334 | // to the detector local coordinate system (used for ITS tracking) | |
335 | // for the detector module index number. The global and local | |
336 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
337 | void GtoLtracking(const Int_t index,const Double_t *g,Double_t *l){ | |
338 | if(IsGeantToTracking()) GtoL(index,g,l); | |
8253cd9a | 339 | else GetGeomMatrix(index)->GtoLPositionTracking(g,l);} |
269f57ed | 340 | // Transforms from the ALICE Global coordinate system |
341 | // to the detector local coordinate system (used for ITS tracking) | |
342 | // for the detector id[3]. The global and local | |
343 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
344 | void GtoLtracking(const Int_t *id,const Double_t *g,Double_t *l){ | |
345 | GtoLtracking(GetModuleIndex(id),g,l);} | |
346 | // Transforms from the ALICE Global coordinate system | |
347 | // to the detector local coordinate system (used for ITS tracking) | |
348 | // for the detector layer ladder and detector numbers. The global | |
349 | // and local coordinate are given in two Double point arrays g[3], | |
350 | // and l[3]. | |
351 | void GtoLtracking(const Int_t lay,const Int_t lad,const Int_t det, | |
352 | const Double_t *g,Double_t *l){ | |
353 | GtoLtracking(GetModuleIndex(lay,lad,det),g,l);} | |
354 | // | |
355 | // Transforms of momentum types of quantities from the ALICE | |
356 | // Global coordinate system to the detector local coordinate system | |
357 | // for the detector layer ladder and detector numbers. The global | |
358 | // and local coordinate are given in two float point arrays g[3], | |
359 | // and l[3]. | |
360 | void GtoLMomentum(const Int_t lay,const Int_t lad,const Int_t det, | |
361 | const Float_t *g,Float_t *l){ | |
362 | GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} | |
363 | // Transforms of momentum types of quantities from the ALICE | |
364 | // Global coordinate system to the detector local coordinate system | |
365 | // for the detector module index number. The global and local | |
366 | // coordinate are given in two float point arrays g[3], and l[3]. | |
367 | void GtoLMomentum(const Int_t index,const Float_t *g,Float_t *l){ | |
d962cab4 | 368 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; |
8253cd9a | 369 | GetGeomMatrix(index)->GtoLMomentum(dg,dl); |
d962cab4 | 370 | for(i=0;i<3;i++) l[i] =dl[i];} |
269f57ed | 371 | // Transforms of momentum types of quantities from the ALICE |
372 | // Global coordinate system to the detector local coordinate system | |
373 | // for the detector layer ladder and detector numbers. The global | |
374 | // and local coordinate are given in two Double point arrays g[3], | |
375 | // and l[3]. | |
376 | void GtoLMomentum(const Int_t lay,const Int_t lad,const Int_t det, | |
377 | const Double_t *g,Double_t *l){ | |
378 | GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} | |
379 | // Transforms of momentum types of quantities from the ALICE | |
380 | // Global coordinate system to the detector local coordinate system | |
381 | // for the detector module index number. The global and local | |
382 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
383 | void GtoLMomentum(const Int_t index,const Double_t *g,Double_t *l){ | |
d962cab4 | 384 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; |
8253cd9a | 385 | GetGeomMatrix(index)->GtoLMomentum(dg,dl); |
d962cab4 | 386 | for(i=0;i<3;i++) l[i] =dl[i];} |
269f57ed | 387 | // |
388 | // Transforms of momentum types of quantities from the ALICE | |
389 | // Global coordinate system to the detector local coordinate system | |
390 | // (used for ITS tracking) for the detector module index number. | |
391 | // The global and local coordinate are given in two Double point | |
392 | // arrays g[3], and l[3]. | |
393 | void GtoLMomentumTracking(const Int_t index,const Double_t *g,Double_t *l){ | |
394 | if(IsGeantToTracking()) GtoLMomentum(index,g,l); | |
8253cd9a | 395 | else GetGeomMatrix(index)->GtoLMomentumTracking(g,l);} |
269f57ed | 396 | // Transforms of momentum types of quantities from the ALICE |
397 | // Global coordinate system to the detector local coordinate system | |
398 | // (used for ITS tracking) for the detector id[3]. | |
399 | // The global and local coordinate are given in two Double point | |
400 | // arrays g[3], and l[3]. | |
401 | void GtoLMomentumTracking(const Int_t *id,const Double_t *g,Double_t *l){ | |
402 | GtoLMomentumTracking(GetModuleIndex(id),g,l);} | |
403 | // Transforms of momentum types of quantities from the ALICE | |
404 | // Global coordinate system to the detector local coordinate system | |
405 | // (used for ITS tracking) for the detector layer ladder and detector | |
406 | // numbers. The global and local coordinate are given in two Double point | |
407 | // arrays g[3], and l[3]. | |
408 | void GtoLMomentumTracking(const Int_t lay,const Int_t lad,const Int_t det, | |
409 | const Double_t *g,Double_t *l){ | |
410 | GtoLMomentumTracking(GetModuleIndex(lay,lad,det),g,l);} | |
411 | // | |
412 | // Transforms from the detector local coordinate system | |
413 | // to the ALICE Global coordinate system for the detector | |
414 | // defined by the layer, ladder, and detector numbers. The | |
415 | // global and local coordinate are given in two floating point | |
416 | // arrays g[3], and l[3]. | |
417 | void LtoG(const Int_t lay,const Int_t lad,const Int_t det, | |
418 | const Float_t *l,Float_t *g){ | |
419 | LtoG(GetModuleIndex(lay,lad,det),l,g);} | |
420 | // Transforms from the detector local coordinate system | |
421 | // to the ALICE Global coordinate system for the detector | |
422 | // defined by the id[0], id[1], and id[2] numbers. The | |
423 | // global and local coordinate are given in two floating point | |
424 | // arrays g[3], and l[3]. | |
425 | void LtoG(const Int_t *id,const Float_t *l,Float_t *g){ | |
426 | LtoG(GetModuleIndex(id),l,g);} | |
427 | // Transforms from the detector local coordinate system | |
428 | // to the ALICE Global coordinate system for the detector | |
429 | // module index number. The global and local coordinate are | |
430 | // given in two floating point arrays g[3], and l[3]. | |
431 | void LtoG(const Int_t index,const Float_t *l,Float_t *g){ | |
d962cab4 | 432 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; |
8253cd9a | 433 | GetGeomMatrix(index)->LtoGPosition(dl,dg); |
d962cab4 | 434 | for(i=0;i<3;i++) g[i] =dg[i];} |
269f57ed | 435 | // Transforms from the detector local coordinate system |
436 | // to the ALICE Global coordinate system for the detector | |
437 | // defined by the layer, ladder, and detector numbers. The | |
438 | // global and local coordinate are given in two Double point | |
439 | // arrays g[3], and l[3]. | |
440 | void LtoG(const Int_t lay,const Int_t lad,const Int_t det, | |
441 | const Double_t *l,Double_t *g){ | |
442 | LtoG(GetModuleIndex(lay,lad,det),l,g);} | |
443 | // Transforms from the detector local coordinate system | |
444 | // to the ALICE Global coordinate system for the detector | |
445 | // defined by the id[0], id[1], and id[2] numbers. The | |
446 | // global and local coordinate are given in two Double point | |
447 | // arrays g[3], and l[3]. | |
448 | void LtoG(const Int_t *id,const Double_t *l,Double_t *g){ | |
449 | LtoG(GetModuleIndex(id),l,g);} | |
450 | // Transforms from the detector local coordinate system | |
451 | // to the ALICE Global coordinate system for the detector | |
452 | // module index number. The global and local coordinate are | |
453 | // given in two Double point arrays g[3], and l[3]. | |
454 | void LtoG(const Int_t index,const Double_t *l,Double_t *g){ | |
d962cab4 | 455 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; |
8253cd9a | 456 | GetGeomMatrix(index)->LtoGPosition(dl,dg); |
d962cab4 | 457 | for(i=0;i<3;i++) g[i] =dg[i];} |
269f57ed | 458 | // |
459 | // Transforms from the detector local coordinate system (used | |
460 | // for ITS tracking) to the ALICE Global coordinate system | |
461 | // for the detector module index number. The global and local | |
462 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
463 | void LtoGtracking(const Int_t index,const Double_t *l,Double_t *g){ | |
464 | if(IsGeantToTracking()) LtoG(index,l,g); | |
8253cd9a | 465 | else GetGeomMatrix(index)->LtoGPositionTracking(l,g);} |
269f57ed | 466 | // Transforms from the detector local coordinate system (used |
467 | // for ITS tracking) to the ALICE Global coordinate system | |
468 | // for the detector id[3]. The global and local | |
469 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
470 | void LtoGtracking(const Int_t *id,const Double_t *l,Double_t *g){ | |
471 | LtoGtracking(GetModuleIndex(id),l,g);} | |
472 | // Transforms from the detector local coordinate system (used | |
473 | // for ITS tracking) to the detector local coordinate system | |
474 | // for the detector layer ladder and detector numbers. The global | |
475 | // and local coordinate are given in two Double point arrays g[3], | |
476 | // and l[3]. | |
477 | void LtoGtracking(const Int_t lay,const Int_t lad,const Int_t det, | |
478 | const Double_t *l,Double_t *g){ | |
479 | LtoGtracking(GetModuleIndex(lay,lad,det),l,g);} | |
480 | // | |
481 | // Transforms of momentum types of quantities from the detector | |
482 | // local coordinate system to the ALICE Global coordinate system | |
483 | // for the detector layer ladder and detector numbers. The global | |
484 | // and local coordinate are given in two float point arrays g[3], | |
485 | // and l[3]. | |
486 | void LtoGMomentum(const Int_t lay,const Int_t lad,const Int_t det, | |
487 | const Float_t *l,Float_t *g){ | |
488 | LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} | |
489 | // Transforms of momentum types of quantities from the detector | |
490 | // local coordinate system to the ALICE Global coordinate system | |
491 | // for the detector module index number. The global and local | |
492 | // coordinate are given in two float point arrays g[3], and l[3]. | |
493 | void LtoGMomentum(const Int_t index,const Float_t *l,Float_t *g){ | |
d962cab4 | 494 | Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; |
8253cd9a | 495 | GetGeomMatrix(index)->LtoGMomentum(dl,dg); |
d962cab4 | 496 | for(i=0;i<3;i++) g[i] =dg[i];} |
269f57ed | 497 | // Transforms of momentum types of quantities from the detector |
498 | // local coordinate system to the ALICE Global coordinate system | |
499 | // for the detector layer ladder and detector numbers. The global | |
500 | // and local coordinate are given in two Double point arrays g[3], | |
501 | // and l[3]. | |
502 | void LtoGMomentum(const Int_t lay,const Int_t lad,const Int_t det, | |
503 | const Double_t *l,Double_t *g){ | |
504 | LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} | |
505 | // Transforms of momentum types of quantities from the detector | |
506 | // local coordinate system to the ALICE Global coordinate system | |
507 | // for the detector module index number. The global and local | |
508 | // coordinate are given in two Double point arrays g[3], and l[3]. | |
509 | void LtoGMomentum(const Int_t index,const Double_t *l,Double_t *g){ | |
8253cd9a | 510 | GetGeomMatrix(index)->LtoGMomentum(l,g);} |
269f57ed | 511 | // |
512 | // Transforms of momentum types of quantities from the detector | |
513 | // local coordinate system (used for ITS tracking) to the detector | |
514 | // system ALICE Global for the detector module index number. | |
515 | // The global and local coordinate are given in two Double point | |
516 | // arrays g[3], and l[3]. | |
517 | void LtoGMomentumTracking(const Int_t index,const Double_t *l,Double_t *g){ | |
518 | if(IsGeantToTracking()) LtoGMomentum(index,l,g); | |
8253cd9a | 519 | else GetGeomMatrix(index)->LtoGMomentumTracking(l,g);} |
269f57ed | 520 | // Transforms of momentum types of quantities from the detector |
521 | // local coordinate system (used for ITS tracking) to the ALICE | |
522 | // Global coordinate system for the detector id[3]. | |
523 | // The global and local coordinate are given in two Double point | |
524 | // arrays g[3], and l[3]. | |
525 | void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g){ | |
526 | LtoGMomentumTracking(GetModuleIndex(id),l,g);} | |
527 | // Transforms of momentum types of quantities from the detector | |
528 | // local coordinate system (used for ITS tracking) to the ALICE | |
529 | // Global coordinate system for the detector layer ladder and detector | |
530 | // numbers. The global and local coordinate are given in two Double point | |
531 | // arrays g[3], and l[3]. | |
532 | void LtoGMomentumTracking(const Int_t lay,const Int_t lad,const Int_t det, | |
533 | const Double_t *l,Double_t *g){ | |
534 | LtoGMomentumTracking(GetModuleIndex(lay,lad,det),l,g);} | |
535 | // | |
536 | // Transforms from one detector local coordinate system | |
537 | // to another detector local coordinate system for the detector | |
538 | // module index1 number to the detector module index2 number. The | |
539 | // local coordinates are given in two Double point arrays l1[3], | |
540 | // and l2[3]. | |
541 | void LtoL(const Int_t index1,const Int_t index2,Double_t *l1,Double_t *l2){ | |
542 | Double_t g[3]; LtoG(index1,l1,g);GtoL(index2,g,l2);} | |
543 | // Transforms from one detector local coordinate system | |
544 | // to another detector local coordinate system for the detector | |
545 | // id1[3] to the detector id2[3]. The local coordinates are given | |
546 | // in two Double point arrays l1[3], and l2[3]. | |
547 | void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2){ | |
548 | LtoL(GetModuleIndex(id1[0],id1[1],id1[2]), | |
549 | GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} | |
550 | // | |
551 | // Transforms from one detector local coordinate system (used for | |
552 | // ITS tracking) to another detector local coordinate system (used | |
553 | // for ITS tracking) for the detector module index1 number to the | |
554 | // detector module index2 number. The local coordinates are given | |
555 | // in two Double point arrays l1[3], and l2[3]. | |
556 | void LtoLtracking(const Int_t index1,const Int_t index2, | |
557 | Double_t *l1,Double_t *l2){ | |
558 | Double_t g[3]; LtoGtracking(index1,l1,g);GtoLtracking(index2,g,l2);} | |
559 | // Transforms from one detector local coordinate system (used for | |
560 | // ITS tracking) to another detector local coordinate system (used | |
561 | // for ITS tracking) for the detector id1[3] to the detector id2[3]. | |
562 | // The local coordinates are given in two Double point arrays l1[3], | |
563 | // and l2[3]. | |
564 | void LtoLtracking(const Int_t *id1,const Int_t *id2, | |
565 | Double_t *l1,Double_t *l2){ | |
566 | LtoLtracking(GetModuleIndex(id1[0],id1[1],id1[2]), | |
567 | GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} | |
568 | // | |
569 | // Transforms of momentum types of quantities from one detector | |
570 | // local coordinate system to another detector local coordinate | |
571 | // system for the detector module index1 number to the detector | |
572 | // module index2 number. The local coordinates are given in two | |
573 | // Double point arrays l1[3], and l2[3]. | |
574 | void LtoLMomentum(const Int_t index1,const Int_t index2, | |
575 | const Double_t *l1,Double_t *l2){ | |
576 | Double_t g[3]; LtoGMomentum(index1,l1,g);GtoLMomentum(index2,g,l2);} | |
577 | // Transforms of momentum types of quantities from one detector | |
578 | // local coordinate system to another detector local coordinate | |
579 | // system for the detector id1[3] to the detector id2[3]. The local | |
580 | // coordinates are given in two Double point arrays l1[3], and l2[3]. | |
b79e4bc3 | 581 | void LtoLMomentum(const Int_t *id1,const Int_t *id2, |
269f57ed | 582 | const Double_t *l1,Double_t *l2){ |
583 | LtoLMomentum(GetModuleIndex(id1[0],id1[1],id1[2]), | |
584 | GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} | |
585 | // | |
586 | // Transforms of momentum types of quantities from one detector | |
587 | // local coordinate system (used by ITS tracking) to another detector | |
588 | // local coordinate system (used by ITS tracking) for the detector | |
589 | // module index1 number to the detector module index2 number. The | |
590 | // local coordinates are given in two Double point arrays l1[3], | |
591 | // and l2[3]. | |
592 | void LtoLMomentumTracking(const Int_t index1,const Int_t index2, | |
593 | Double_t *l1,Double_t *l2){ | |
594 | Double_t g[3]; LtoGMomentumTracking(index1,l1,g); | |
595 | GtoLMomentumTracking(index2,g,l2);} | |
596 | // Transforms of momentum types of quantities from one detector | |
597 | // local coordinate system (used by ITS tracking) to another detector | |
598 | // local coordinate system (used by ITS tracking) for the detector | |
599 | // id1[3] to the detector id2[3]. The local coordinates are given in | |
600 | // two Double point arrays l1[3], and l2[3]. | |
601 | void LtoLMomentumTracking(const Int_t *id1,const Int_t *id2, | |
602 | Double_t *l1,Double_t *l2){ | |
603 | LtoLMomentumTracking(GetModuleIndex(id1[0],id1[1],id1[2]), | |
604 | GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} | |
605 | // | |
606 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
607 | // the ALICE Global coordinate system to a detector local coordinate | |
608 | // system. The specific detector is determined by the module index | |
609 | // number. | |
610 | void GtoLErrorMatrix(const Int_t index,const Double_t **g,Double_t **l){ | |
8253cd9a | 611 | GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);} |
269f57ed | 612 | // |
613 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
614 | // the ALICE Global coordinate system to a detector local coordinate | |
615 | // system (used by ITS tracking). The specific detector is determined | |
616 | // by the module index number. | |
617 | void GtoLErrorMatrixTracking(const Int_t index,const Double_t **g, | |
618 | Double_t **l){ | |
8253cd9a | 619 | if(IsGeantToTracking()) GetGeomMatrix(index)->GtoLPositionError(( |
d962cab4 | 620 | Double_t (*)[3])g,(Double_t (*)[3])l); |
8253cd9a | 621 | else GetGeomMatrix(index)->GtoLPositionErrorTracking( |
d962cab4 | 622 | (Double_t (*)[3])g,(Double_t (*)[3])l);} |
269f57ed | 623 | // |
624 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
625 | // the detector local coordinate system to a ALICE Global coordinate | |
626 | // system. The specific detector is determined by the module index | |
627 | // number. | |
628 | void LtoGErrorMatrix(const Int_t index,const Double_t **l,Double_t **g){ | |
8253cd9a | 629 | GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);} |
269f57ed | 630 | // |
631 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
632 | // the detector local coordinate system (used by ITS tracking) to a | |
633 | // ALICE Global coordinate system. The specific detector is determined | |
634 | // by the module index number. | |
635 | void LtoGErrorMatrixTracking(const Int_t index,const Double_t **l, | |
636 | Double_t **g){ | |
8253cd9a | 637 | if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(( |
d962cab4 | 638 | Double_t (*)[3])g,(Double_t (*)[3])l); |
8253cd9a | 639 | else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l, |
d962cab4 | 640 | (Double_t (*)[3])g);} |
269f57ed | 641 | // |
642 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
643 | // one detector local coordinate system to another detector local | |
644 | // coordinate system. The specific detector is determined by the | |
645 | // two module index number index1 and index2. | |
b79e4bc3 | 646 | void LtoLErrorMatrix(const Int_t index1,const Int_t index2, |
269f57ed | 647 | const Double_t **l1,Double_t **l2){ |
648 | Double_t g[3][3]; | |
649 | LtoGErrorMatrix(index1,l1,(Double_t **)g); | |
650 | GtoLErrorMatrix(index2,(const Double_t **)g,l2);} | |
651 | // | |
652 | // Transforms a matrix, like an Uncertainty or Error matrix from | |
653 | // one detector local coordinate system (used by ITS tracking) to | |
654 | // another detector local coordinate system (used by ITS tracking). | |
655 | // The specific detector is determined by the two module index number | |
656 | // index1 and index2. | |
657 | void LtoLErrorMatrixTraking(const Int_t index1,const Int_t index2, | |
658 | const Double_t **l1,Double_t **l2){Double_t g[3][3]; | |
659 | LtoGErrorMatrixTracking(index1,l1,(Double_t **)g); | |
660 | GtoLErrorMatrixTracking(index2,(const Double_t **)g,l2);} | |
661 | // Find Specific Modules | |
662 | Int_t GetNearest(const Double_t g[3],const Int_t lay=0); | |
663 | void GetNearest27(const Double_t g[3],Int_t n[27],const Int_t lay=0); | |
664 | // Returns the distance [cm] between the point g[3] and the center of | |
665 | // the detector/module specified by the the module index number. | |
666 | Double_t Distance(const Int_t index,const Double_t g[3]){ | |
8253cd9a | 667 | return TMath::Sqrt(GetGeomMatrix(index)->Distance2(g));} |
269f57ed | 668 | // Geometry manipulation |
669 | void GlobalChange(const Float_t *tran,const Float_t *rot); | |
670 | void GlobalCylindericalChange(const Float_t *tran,const Float_t *rot); | |
671 | void RandomChange(const Float_t *stran,const Float_t *srot); | |
672 | void RandomCylindericalChange(const Float_t *stran,const Float_t *srot); | |
673 | void GeantToTracking(AliITSgeom &source); // This converts the geometry | |
674 | // Other routines. | |
58005f18 | 675 | void PrintComparison(FILE *fp,AliITSgeom *other); |
269f57ed | 676 | void PrintData(FILE *fp,const Int_t lay,const Int_t lad,const Int_t det); |
58005f18 | 677 | ofstream &PrintGeom(ofstream &out); |
678 | ifstream &ReadGeom(ifstream &in); | |
e8189707 | 679 | |
085bb6ed | 680 | private: |
8253cd9a | 681 | char fVersion[20];// Transformation version. |
682 | Int_t fTrans; // Flag to keep track of which transformation | |
683 | Int_t fNmodules;// The total number of modules | |
684 | Int_t fNlayers; // The number of layers. | |
685 | Int_t *fNlad; //[fNlayers] Array of the number of ladders/layer(layer) | |
686 | Int_t *fNdet; //[fNlayers] Array of the number of detectors/ladder(layer) | |
687 | TObjArray *fGm; // Structure of trans. and rotation. | |
688 | TObjArray *fShape; // Array of shapes and detector information. | |
689 | ||
269f57ed | 690 | ClassDef(AliITSgeom,2) // ITS geometry class |
58005f18 | 691 | }; |
692 | ||
693 | #endif |