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