f7336fa3 |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
16 | /* |
17 | $Log$ |
793ff80c |
18 | Revision 1.1.4.7 2000/10/16 01:16:53 cblume |
19 | Changed timebin 0 to be the one closest to the readout |
20 | |
21 | Revision 1.1.4.6 2000/10/15 23:35:57 cblume |
22 | Include geometry constants as static member |
23 | |
24 | Revision 1.1.4.5 2000/10/06 16:49:46 cblume |
25 | Made Getters const |
26 | |
27 | Revision 1.1.4.4 2000/10/04 16:34:58 cblume |
28 | Replace include files by forward declarations |
29 | |
30 | Revision 1.1.4.3 2000/09/22 14:43:40 cblume |
31 | Allow the pad/timebin-dimensions to be changed after initialization |
32 | |
33 | Revision 1.1.4.2 2000/09/18 13:37:01 cblume |
34 | Minor coding corrections |
35 | |
36 | Revision 1.5 2000/10/02 21:28:19 fca |
37 | Removal of useless dependecies via forward declarations |
38 | |
39 | Revision 1.4 2000/06/08 18:32:58 cblume |
40 | Make code compliant to coding conventions |
41 | |
42 | Revision 1.3 2000/06/07 16:25:37 cblume |
43 | Try to remove compiler warnings on Sun and HP |
44 | |
45 | Revision 1.2 2000/05/08 16:17:27 cblume |
46 | Merge TRD-develop |
47 | |
48 | Revision 1.1.4.1 2000/05/08 14:45:55 cblume |
49 | Bug fix in RotateBack(). Geometry update |
50 | |
94de3818 |
51 | Revision 1.4 2000/06/08 18:32:58 cblume |
52 | Make code compliant to coding conventions |
53 | |
8230f242 |
54 | Revision 1.3 2000/06/07 16:25:37 cblume |
55 | Try to remove compiler warnings on Sun and HP |
56 | |
9d0b222b |
57 | Revision 1.2 2000/05/08 16:17:27 cblume |
58 | Merge TRD-develop |
59 | |
6f1e466d |
60 | Revision 1.1.4.1 2000/05/08 14:45:55 cblume |
61 | Bug fix in RotateBack(). Geometry update |
62 | |
63 | Revision 1.1 2000/02/28 19:00:44 cblume |
64 | Add new TRD classes |
65 | |
f7336fa3 |
66 | */ |
67 | |
68 | /////////////////////////////////////////////////////////////////////////////// |
69 | // // |
70 | // TRD geometry class // |
71 | // // |
72 | /////////////////////////////////////////////////////////////////////////////// |
73 | |
793ff80c |
74 | #include "AliMC.h" |
75 | |
f7336fa3 |
76 | #include "AliTRDgeometry.h" |
77 | #include "AliTRDrecPoint.h" |
94de3818 |
78 | #include "AliMC.h" |
f7336fa3 |
79 | |
80 | ClassImp(AliTRDgeometry) |
81 | |
793ff80c |
82 | //_____________________________________________________________________________ |
83 | |
84 | // |
85 | // The geometry constants |
86 | // |
87 | const Int_t AliTRDgeometry::fgkNsect = kNsect; |
88 | const Int_t AliTRDgeometry::fgkNplan = kNplan; |
89 | const Int_t AliTRDgeometry::fgkNcham = kNcham; |
90 | const Int_t AliTRDgeometry::fgkNdet = kNdet; |
91 | |
92 | // |
93 | // Dimensions of the detector |
94 | // |
95 | const Float_t AliTRDgeometry::fgkRmin = 294.0; |
96 | const Float_t AliTRDgeometry::fgkRmax = 368.0; |
97 | |
98 | const Float_t AliTRDgeometry::fgkZmax1 = 378.35; |
99 | const Float_t AliTRDgeometry::fgkZmax2 = 302.0; |
100 | |
101 | const Float_t AliTRDgeometry::fgkSheight = 74.0; |
102 | const Float_t AliTRDgeometry::fgkSwidth1 = 99.613; |
103 | const Float_t AliTRDgeometry::fgkSwidth2 = 125.707; |
104 | const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0; |
105 | const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5; |
106 | const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5; |
107 | |
108 | const Float_t AliTRDgeometry::fgkCheight = 11.0; |
109 | const Float_t AliTRDgeometry::fgkCspace = 1.6; |
110 | const Float_t AliTRDgeometry::fgkCathick = 1.0; |
111 | const Float_t AliTRDgeometry::fgkCcthick = 1.0; |
112 | const Float_t AliTRDgeometry::fgkCaframe = 2.675; |
113 | const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight |
114 | - AliTRDgeometry::fgkCaframe; |
115 | |
116 | // |
117 | // Thickness of the the material layers |
118 | // |
119 | const Float_t AliTRDgeometry::fgkSeThick = 0.02; |
120 | const Float_t AliTRDgeometry::fgkRaThick = 4.8; |
121 | const Float_t AliTRDgeometry::fgkPeThick = 0.20; |
122 | const Float_t AliTRDgeometry::fgkMyThick = 0.005; |
123 | const Float_t AliTRDgeometry::fgkXeThick = 3.5; |
124 | const Float_t AliTRDgeometry::fgkDrThick = 3.0; |
125 | const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick |
126 | - AliTRDgeometry::fgkDrThick; |
127 | const Float_t AliTRDgeometry::fgkCuThick = 0.001; |
128 | const Float_t AliTRDgeometry::fgkSuThick = 0.06; |
129 | const Float_t AliTRDgeometry::fgkFeThick = 0.0044; |
130 | const Float_t AliTRDgeometry::fgkCoThick = 0.02; |
131 | const Float_t AliTRDgeometry::fgkWaThick = 0.01; |
132 | |
133 | // |
134 | // Position of the material layers |
135 | // |
136 | const Float_t AliTRDgeometry::fgkSeZpos = -4.1525; |
137 | const Float_t AliTRDgeometry::fgkRaZpos = -1.7425; |
138 | const Float_t AliTRDgeometry::fgkPeZpos = 0.0000; |
139 | const Float_t AliTRDgeometry::fgkMyZpos = 0.6600; |
140 | const Float_t AliTRDgeometry::fgkDrZpos = 2.1625; |
141 | const Float_t AliTRDgeometry::fgkAmZpos = 4.1125; |
142 | const Float_t AliTRDgeometry::fgkCuZpos = -1.3370; |
143 | const Float_t AliTRDgeometry::fgkSuZpos = 0.0000; |
144 | const Float_t AliTRDgeometry::fgkFeZpos = 1.3053; |
145 | const Float_t AliTRDgeometry::fgkCoZpos = 1.3175; |
146 | const Float_t AliTRDgeometry::fgkWaZpos = 1.3325; |
147 | |
f7336fa3 |
148 | //_____________________________________________________________________________ |
149 | AliTRDgeometry::AliTRDgeometry():AliGeometry() |
150 | { |
151 | // |
152 | // AliTRDgeometry default constructor |
153 | // |
154 | |
155 | Init(); |
156 | |
157 | } |
158 | |
159 | //_____________________________________________________________________________ |
160 | AliTRDgeometry::~AliTRDgeometry() |
161 | { |
8230f242 |
162 | // |
163 | // AliTRDgeometry destructor |
164 | // |
f7336fa3 |
165 | |
166 | } |
167 | |
168 | //_____________________________________________________________________________ |
169 | void AliTRDgeometry::Init() |
170 | { |
171 | // |
172 | // Initializes the geometry parameter |
173 | // |
174 | |
793ff80c |
175 | Int_t isect; |
f7336fa3 |
176 | |
177 | // The width of the chambers |
793ff80c |
178 | fCwidth[0] = 99.6; |
179 | fCwidth[1] = 104.1; |
180 | fCwidth[2] = 108.5; |
181 | fCwidth[3] = 112.9; |
182 | fCwidth[4] = 117.4; |
183 | fCwidth[5] = 121.8; |
f7336fa3 |
184 | |
185 | // The maximum number of pads |
186 | // and the position of pad 0,0,0 |
187 | // |
188 | // chambers seen from the top: |
189 | // +----------------------------+ |
190 | // | | |
793ff80c |
191 | // | | ^ |
192 | // | | rphi| |
193 | // | | | |
194 | // |0 | | |
195 | // +----------------------------+ +------> |
f7336fa3 |
196 | // z |
793ff80c |
197 | // chambers seen from the side: ^ |
198 | // +----------------------------+ drift| |
199 | // |0 | | |
200 | // | | | |
201 | // +----------------------------+ +------> |
f7336fa3 |
202 | // z |
203 | // |
793ff80c |
204 | // IMPORTANT: time bin 0 is now the one closest to the readout !!! |
205 | // |
f7336fa3 |
206 | |
207 | // The pad column (rphi-direction) |
793ff80c |
208 | SetColPadSize(1.0); |
209 | |
210 | // The time bucket |
211 | SetTimeBinSize(0.1); |
212 | |
213 | // The rotation matrix elements |
214 | Float_t phi = 0; |
215 | for (isect = 0; isect < fgkNsect; isect++) { |
216 | phi = -2.0 * kPI / (Float_t) fgkNsect * ((Float_t) isect + 0.5); |
217 | fRotA11[isect] = TMath::Cos(phi); |
218 | fRotA12[isect] = TMath::Sin(phi); |
219 | fRotA21[isect] = TMath::Sin(phi); |
220 | fRotA22[isect] = TMath::Cos(phi); |
221 | phi = -1.0 * phi; |
222 | fRotB11[isect] = TMath::Cos(phi); |
223 | fRotB12[isect] = TMath::Sin(phi); |
224 | fRotB21[isect] = TMath::Sin(phi); |
225 | fRotB22[isect] = TMath::Cos(phi); |
226 | } |
227 | |
228 | } |
229 | |
230 | //_____________________________________________________________________________ |
231 | void AliTRDgeometry::SetColPadSize(Float_t size) |
232 | { |
233 | // |
234 | // Redefines the pad size in column direction |
235 | // |
236 | |
237 | fColPadSize = size; |
238 | for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { |
239 | fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * fgkCcthick) |
f7336fa3 |
240 | / fColPadSize - 0.5); |
793ff80c |
241 | fCol0[iplan] = -fCwidth[iplan]/2. + fgkCcthick; |
f7336fa3 |
242 | } |
243 | |
793ff80c |
244 | } |
245 | |
246 | //_____________________________________________________________________________ |
247 | void AliTRDgeometry::SetTimeBinSize(Float_t size) |
248 | { |
249 | // |
250 | // Redefines the time bin size |
251 | // |
252 | |
253 | fTimeBinSize = size; |
254 | fTimeMax = 1 + TMath::Nint(fgkDrThick / fTimeBinSize - 0.5); |
255 | for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { |
256 | fTime0[iplan] = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick |
257 | + iplan * (fgkCheight + fgkCspace); |
258 | } |
f7336fa3 |
259 | |
260 | } |
261 | |
262 | //_____________________________________________________________________________ |
263 | void AliTRDgeometry::CreateGeometry(Int_t *idtmed) |
264 | { |
265 | // |
266 | // Create the TRD geometry |
267 | // |
268 | // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99 |
269 | // |
270 | // The volumes: |
271 | // TRD1-3 (Air) --- The TRD mother volumes for one sector. |
272 | // To be placed into the spaceframe. |
273 | // |
274 | // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout) |
275 | // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers |
276 | // (driftchamber + radiator) |
277 | // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers |
278 | // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the |
279 | // inner(/middle/outer) chambers |
280 | // |
281 | // The material layers in one chamber: |
282 | // UL01 (G10) --- The gas seal of the radiator |
283 | // UL02 (CO2) --- The gas in the radiator |
284 | // UL03 (PE) --- The foil stack |
285 | // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode |
286 | // UL05 (Xe) --- The driftvolume |
287 | // UL06 (Xe) --- The amplification region |
288 | // |
289 | // UL07 (Cu) --- The pad plane |
290 | // UL08 (G10) --- The Nomex honeycomb support structure |
291 | // UL09 (Cu) --- FEE and signal lines |
292 | // UL10 (PE) --- The cooling devices |
293 | // UL11 (Water) --- The cooling water |
294 | |
8230f242 |
295 | const Int_t kNparCha = 3; |
f7336fa3 |
296 | |
8230f242 |
297 | Float_t parDum[3]; |
298 | Float_t parCha[kNparCha]; |
f7336fa3 |
299 | |
300 | Float_t xpos, ypos, zpos; |
301 | |
302 | // The aluminum frames - readout + electronics (Al) |
303 | // The inner chambers |
8230f242 |
304 | gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0); |
f7336fa3 |
305 | // The middle chambers |
8230f242 |
306 | gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0); |
f7336fa3 |
307 | // The outer chambers |
8230f242 |
308 | gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0); |
f7336fa3 |
309 | |
310 | // The inner part of the aluminum frames (Air) |
311 | // The inner chambers |
8230f242 |
312 | gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
313 | // The middle chambers |
8230f242 |
314 | gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
315 | // The outer chambers |
8230f242 |
316 | gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
317 | |
318 | // The carbon frames - radiator + driftchamber (C) |
319 | // The inner chambers |
8230f242 |
320 | gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0); |
f7336fa3 |
321 | // The middle chambers |
8230f242 |
322 | gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0); |
f7336fa3 |
323 | // The outer chambers |
8230f242 |
324 | gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0); |
f7336fa3 |
325 | |
326 | // The inner part of the carbon frames (Air) |
327 | // The inner chambers |
8230f242 |
328 | gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
329 | // The middle chambers |
8230f242 |
330 | gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
331 | // The outer chambers |
8230f242 |
332 | gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0); |
f7336fa3 |
333 | |
334 | // The material layers inside the chambers |
8230f242 |
335 | parCha[0] = -1.; |
336 | parCha[1] = -1.; |
f7336fa3 |
337 | // G10 layer (radiator seal) |
793ff80c |
338 | parCha[2] = fgkSeThick/2; |
8230f242 |
339 | gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha); |
f7336fa3 |
340 | // CO2 layer (radiator) |
793ff80c |
341 | parCha[2] = fgkRaThick/2; |
8230f242 |
342 | gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha); |
f7336fa3 |
343 | // PE layer (radiator) |
793ff80c |
344 | parCha[2] = fgkPeThick/2; |
8230f242 |
345 | gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha); |
f7336fa3 |
346 | // Mylar layer (entrance window + HV cathode) |
793ff80c |
347 | parCha[2] = fgkMyThick/2; |
8230f242 |
348 | gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha); |
f7336fa3 |
349 | // Xe/Isobutane layer (drift volume, sensitive) |
793ff80c |
350 | parCha[2] = fgkDrThick/2.; |
8230f242 |
351 | gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha); |
f7336fa3 |
352 | // Xe/Isobutane layer (amplification volume, not sensitive) |
793ff80c |
353 | parCha[2] = fgkAmThick/2.; |
8230f242 |
354 | gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha); |
f7336fa3 |
355 | |
356 | // Cu layer (pad plane) |
793ff80c |
357 | parCha[2] = fgkCuThick/2; |
8230f242 |
358 | gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha); |
f7336fa3 |
359 | // G10 layer (support structure) |
793ff80c |
360 | parCha[2] = fgkSuThick/2; |
8230f242 |
361 | gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha); |
f7336fa3 |
362 | // Cu layer (FEE + signal lines) |
793ff80c |
363 | parCha[2] = fgkFeThick/2; |
8230f242 |
364 | gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha); |
f7336fa3 |
365 | // PE layer (cooling devices) |
793ff80c |
366 | parCha[2] = fgkCoThick/2; |
8230f242 |
367 | gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha); |
f7336fa3 |
368 | // Water layer (cooling) |
793ff80c |
369 | parCha[2] = fgkWaThick/2; |
8230f242 |
370 | gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha); |
f7336fa3 |
371 | |
372 | // Position the layers in the chambers |
373 | xpos = 0; |
374 | ypos = 0; |
375 | |
376 | // G10 layer (radiator seal) |
793ff80c |
377 | zpos = fgkSeZpos; |
f7336fa3 |
378 | gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY"); |
379 | gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); |
380 | gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); |
381 | // CO2 layer (radiator) |
793ff80c |
382 | zpos = fgkRaZpos; |
f7336fa3 |
383 | gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY"); |
384 | gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); |
385 | gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); |
386 | // PE layer (radiator) |
387 | zpos = 0; |
388 | gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY"); |
389 | // Mylar layer (entrance window + HV cathode) |
793ff80c |
390 | zpos = fgkMyZpos; |
f7336fa3 |
391 | gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY"); |
392 | gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); |
393 | gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); |
394 | // Xe/Isobutane layer (drift volume) |
793ff80c |
395 | zpos = fgkDrZpos; |
f7336fa3 |
396 | gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY"); |
397 | gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); |
398 | gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); |
399 | // Xe/Isobutane layer (amplification volume) |
793ff80c |
400 | zpos = fgkAmZpos; |
f7336fa3 |
401 | gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY"); |
402 | gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); |
403 | gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); |
404 | |
405 | // Cu layer (pad plane) |
793ff80c |
406 | zpos = fgkCuZpos; |
f7336fa3 |
407 | gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY"); |
408 | gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); |
409 | gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); |
410 | // G10 layer (support structure) |
793ff80c |
411 | zpos = fgkSuZpos; |
f7336fa3 |
412 | gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY"); |
413 | gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); |
414 | gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); |
415 | // Cu layer (FEE + signal lines) |
793ff80c |
416 | zpos = fgkFeZpos; |
f7336fa3 |
417 | gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY"); |
418 | gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); |
419 | gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); |
420 | // PE layer (cooling devices) |
793ff80c |
421 | zpos = fgkCoZpos; |
f7336fa3 |
422 | gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY"); |
423 | gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); |
424 | gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); |
425 | // Water layer (cooling) |
793ff80c |
426 | zpos = fgkWaZpos; |
f7336fa3 |
427 | gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY"); |
428 | gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY"); |
429 | gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY"); |
430 | |
431 | } |
432 | |
433 | //_____________________________________________________________________________ |
94de3818 |
434 | Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const |
f7336fa3 |
435 | { |
436 | // |
437 | // Converts local pad-coordinates (row,col,time) into |
438 | // global ALICE reference frame coordinates (x,y,z) |
439 | // |
440 | |
793ff80c |
441 | Int_t icham = GetChamber(idet); // Chamber info (0-4) |
442 | Int_t isect = GetSector(idet); // Sector info (0-17) |
443 | Int_t iplan = GetPlane(idet); // Plane info (0-5) |
f7336fa3 |
444 | |
6f1e466d |
445 | return Local2Global(iplan,icham,isect,local,global); |
f7336fa3 |
446 | |
447 | } |
448 | |
449 | //_____________________________________________________________________________ |
450 | Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect |
94de3818 |
451 | , Float_t *local, Float_t *global) const |
f7336fa3 |
452 | { |
453 | // |
454 | // Converts local pad-coordinates (row,col,time) into |
455 | // global ALICE reference frame coordinates (x,y,z) |
456 | // |
457 | |
793ff80c |
458 | Int_t idet = GetDetector(iplan,icham,isect); // Detector number |
f7336fa3 |
459 | |
793ff80c |
460 | Float_t padRow = local[0]; // Pad Row position |
461 | Float_t padCol = local[1]; // Pad Column position |
462 | Float_t timeSlice = local[2]; // Time "position" |
f7336fa3 |
463 | |
793ff80c |
464 | Float_t row0 = GetRow0(iplan,icham,isect); |
465 | Float_t col0 = GetCol0(iplan); |
466 | Float_t time0 = GetTime0(iplan); |
f7336fa3 |
467 | |
793ff80c |
468 | Float_t rot[3]; |
f7336fa3 |
469 | |
470 | // calculate (x,y,z) position in rotated chamber |
f7336fa3 |
471 | rot[0] = time0 + timeSlice * fTimeBinSize; |
6f1e466d |
472 | rot[1] = col0 + padCol * fColPadSize; |
f7336fa3 |
473 | rot[2] = row0 + padRow * fRowPadSize; |
474 | |
475 | // Rotate back to original position |
476 | return RotateBack(idet,rot,global); |
477 | |
478 | } |
479 | |
480 | //_____________________________________________________________________________ |
793ff80c |
481 | Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const |
f7336fa3 |
482 | { |
483 | // |
484 | // Rotates all chambers in the position of sector 0 and transforms |
485 | // the coordinates in the ALICE restframe <pos> into the |
486 | // corresponding local frame <rot>. |
487 | // |
488 | |
793ff80c |
489 | Int_t sector = GetSector(d); |
f7336fa3 |
490 | |
793ff80c |
491 | rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector]; |
492 | rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector]; |
f7336fa3 |
493 | rot[2] = pos[2]; |
494 | |
495 | return kTRUE; |
496 | |
497 | } |
498 | |
499 | //_____________________________________________________________________________ |
94de3818 |
500 | Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const |
f7336fa3 |
501 | { |
502 | // |
503 | // Rotates a chambers from the position of sector 0 into its |
504 | // original position and transforms the corresponding local frame |
505 | // coordinates <rot> into the coordinates of the ALICE restframe <pos>. |
506 | // |
507 | |
793ff80c |
508 | Int_t sector = GetSector(d); |
f7336fa3 |
509 | |
793ff80c |
510 | pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector]; |
511 | pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector]; |
6f1e466d |
512 | pos[2] = rot[2]; |
f7336fa3 |
513 | |
514 | return kTRUE; |
515 | |
516 | } |
517 | |
518 | //_____________________________________________________________________________ |
94de3818 |
519 | Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const |
f7336fa3 |
520 | { |
521 | // |
522 | // Convert plane / chamber / sector into detector number |
523 | // |
524 | |
793ff80c |
525 | return (p + c * fgkNplan + s * fgkNplan * fgkNcham); |
f7336fa3 |
526 | |
527 | } |
528 | |
529 | //_____________________________________________________________________________ |
94de3818 |
530 | Int_t AliTRDgeometry::GetPlane(Int_t d) const |
f7336fa3 |
531 | { |
532 | // |
533 | // Reconstruct the plane number from the detector number |
534 | // |
535 | |
793ff80c |
536 | return ((Int_t) (d % fgkNplan)); |
f7336fa3 |
537 | |
538 | } |
539 | |
540 | //_____________________________________________________________________________ |
94de3818 |
541 | Int_t AliTRDgeometry::GetChamber(Int_t d) const |
f7336fa3 |
542 | { |
543 | // |
544 | // Reconstruct the chamber number from the detector number |
545 | // |
546 | |
793ff80c |
547 | return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan); |
f7336fa3 |
548 | |
549 | } |
550 | |
551 | //_____________________________________________________________________________ |
94de3818 |
552 | Int_t AliTRDgeometry::GetSector(Int_t d) const |
f7336fa3 |
553 | { |
554 | // |
555 | // Reconstruct the sector number from the detector number |
556 | // |
557 | |
793ff80c |
558 | return ((Int_t) (d / (fgkNplan * fgkNcham))); |
f7336fa3 |
559 | |
560 | } |
561 | |
562 | //_____________________________________________________________________________ |
793ff80c |
563 | void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos |
564 | , TMatrix &mat) const |
f7336fa3 |
565 | { |
566 | // |
567 | // Returns the global coordinate and error matrix of a AliTRDrecPoint |
568 | // |
569 | |
570 | GetGlobal(p,pos); |
9d0b222b |
571 | mat.Zero(); |
f7336fa3 |
572 | |
573 | } |
574 | |
575 | //_____________________________________________________________________________ |
94de3818 |
576 | void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const |
f7336fa3 |
577 | { |
578 | // |
579 | // Returns the global coordinate and error matrix of a AliTRDrecPoint |
580 | // |
581 | |
582 | Int_t detector = ((AliTRDrecPoint *) p)->GetDetector(); |
583 | |
584 | Float_t global[3]; |
585 | Float_t local[3]; |
6f1e466d |
586 | local[0] = ((AliTRDrecPoint *) p)->GetLocalRow(); |
587 | local[1] = ((AliTRDrecPoint *) p)->GetLocalCol(); |
588 | local[2] = ((AliTRDrecPoint *) p)->GetLocalTime(); |
f7336fa3 |
589 | |
590 | if (Local2Global(detector,local,global)) { |
591 | pos.SetX(global[0]); |
592 | pos.SetY(global[1]); |
593 | pos.SetZ(global[2]); |
594 | } |
595 | else { |
596 | pos.SetX(0.0); |
597 | pos.SetY(0.0); |
598 | pos.SetZ(0.0); |
599 | } |
600 | |
601 | } |