]>
Commit | Line | Data |
---|---|---|
256c7399 | 1 | // $Id$ |
b661165c | 2 | // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no> |
494fad94 | 3 | //*-- Copyright © ASV |
a4e75a99 | 4 | // changes done by Constantin Loizides <mailto:loizides@ikf.physik.uni-frankfurt.de> |
256c7399 | 5 | |
108615fc | 6 | |
7 | #include "AliL3Logging.h" | |
8 | #include "AliL3Transform.h" | |
108615fc | 9 | #include <math.h> |
b661165c | 10 | |
11 | //_____________________________________________________________ | |
108615fc | 12 | // AliL3Transform |
13 | // | |
14 | // Transformation class for ALICE TPC. | |
494fad94 | 15 | // |
16 | // Class which contains all detector specific parameters for the TPC, | |
17 | // and different useful functions for coordinate transforms. | |
18 | // | |
19 | // The class is completely static, which means that no object needs | |
20 | // to be instantiated. Function calls should then be done like: | |
21 | // | |
22 | // AliL3Transform::GetEta(xyz); | |
23 | // | |
24 | // IMPORTANT: If used as is, default detector parameters will be used, | |
25 | // and you really have to make sure that these correspond to | |
26 | // the AliROOT version you are currently working on!! | |
27 | // You should therefore always initialize the parameters by | |
28 | // | |
29 | // AliL3Transform::Init(path); | |
30 | // | |
31 | // where path is a char*, giving the path to where file containing | |
32 | // the detector parameter is located. This file should be called | |
33 | // "l3transform.config", and can be created with macro exa/Make_Init.C. | |
34 | ||
35 | ClassImp(AliL3Transform) | |
36 | ||
ef79795d | 37 | Double_t AliL3Transform::fBField = 0.2; |
293aee2f | 38 | Int_t AliL3Transform::fBFieldFactor = 1; |
494fad94 | 39 | Int_t AliL3Transform::fVersion = 0; |
40 | Int_t AliL3Transform::fNTimeBins = 446 ; | |
41 | Int_t AliL3Transform::fNRowLow = 64 ; | |
42 | Int_t AliL3Transform::fNRowUp = 112 ; | |
43 | Int_t AliL3Transform::fNSectorLow = 36 ; | |
44 | Int_t AliL3Transform::fNSectorUp = 36 ; | |
45 | Int_t AliL3Transform::fNSector = 72 ; | |
46 | Double_t AliL3Transform::fPadPitchWidthLow = 0.400000 ; | |
47 | Double_t AliL3Transform::fPadPitchWidthUp = 0.600000 ; | |
48 | Double_t AliL3Transform::fZWidth = 0.56599998474121093750 ; | |
49 | Double_t AliL3Transform::fZSigma = 0.22880849748219134199 ; | |
50 | Double_t AliL3Transform::fZOffset = 0.68642549244657402596; | |
768861a0 | 51 | Double_t AliL3Transform::fDiffT = 0.0219999998807907104; |
52 | Double_t AliL3Transform::fDiffL = 0.0219999998807907104; | |
53 | Double_t AliL3Transform::fAnodeWireSpacing = 0.25; | |
54 | Double_t AliL3Transform::fInnerPadLength = 0.75; | |
55 | Double_t AliL3Transform::fOuterPadLength = 1.; | |
56 | Double_t AliL3Transform::fInnerPRFSigma = 0.203811079263687134; | |
57 | Double_t AliL3Transform::fOuterPRFSigma = 0.299324512481689453; | |
58 | Double_t AliL3Transform::fTimeSigma = 0.228808626532554626; | |
494fad94 | 59 | Double_t AliL3Transform::fZLength = 250.; |
60 | Int_t AliL3Transform::fNSlice = 36 ; | |
61 | Int_t AliL3Transform::fNRow = 176 ; | |
62 | Double_t AliL3Transform::fNRotShift = 0.5 ; | |
63 | Double_t AliL3Transform::fPi = 3.141592653589793 ; | |
9ca67380 | 64 | Int_t AliL3Transform::fNPatches = 6; |
65 | Int_t AliL3Transform::fRows[6][2] = {{0,31},{32,63},{64,91},{92,119},{120,143},{144,175}}; | |
66 | Int_t AliL3Transform::fNRows[6] = {32,32,28,28,24,32}; | |
494fad94 | 67 | Double_t AliL3Transform::fX[176] = {84.570007324218750, |
68 | 85.320007324218750, | |
69 | 86.070007324218750, | |
70 | 86.820007324218750, | |
71 | 87.570007324218750, | |
72 | 88.320007324218750, | |
73 | 89.070007324218750, | |
74 | 89.820007324218750, | |
75 | 90.570007324218750, | |
76 | 91.320007324218750, | |
77 | 92.070007324218750, | |
78 | 92.820007324218750, | |
79 | 93.570007324218750, | |
80 | 94.320007324218750, | |
81 | 95.070007324218750, | |
82 | 95.820007324218750, | |
83 | 96.570007324218750, | |
84 | 97.320007324218750, | |
85 | 98.070007324218750, | |
86 | 98.820007324218750, | |
87 | 99.570007324218750, | |
88 | 100.320007324218750, | |
89 | 101.070007324218750, | |
90 | 101.820007324218750, | |
91 | 102.570007324218750, | |
92 | 103.320007324218750, | |
93 | 104.070007324218750, | |
94 | 104.820007324218750, | |
95 | 105.570007324218750, | |
96 | 106.320007324218750, | |
97 | 107.070007324218750, | |
98 | 107.820007324218750, | |
99 | 108.570007324218750, | |
100 | 109.320007324218750, | |
101 | 110.070007324218750, | |
102 | 110.820007324218750, | |
103 | 111.570007324218750, | |
104 | 112.320007324218750, | |
105 | 113.070007324218750, | |
106 | 113.820007324218750, | |
107 | 114.570007324218750, | |
108 | 115.320007324218750, | |
109 | 116.070007324218750, | |
110 | 116.820007324218750, | |
111 | 117.570007324218750, | |
112 | 118.320007324218750, | |
113 | 119.070007324218750, | |
114 | 119.820007324218750, | |
115 | 120.570007324218750, | |
116 | 121.320007324218750, | |
117 | 122.070007324218750, | |
118 | 122.820007324218750, | |
119 | 123.570007324218750, | |
120 | 124.320007324218750, | |
121 | 125.070007324218750, | |
122 | 125.820007324218750, | |
123 | 126.570007324218750, | |
124 | 127.320007324218750, | |
125 | 128.070007324218750, | |
126 | 128.820007324218750, | |
127 | 129.570007324218750, | |
128 | 130.320007324218750, | |
129 | 131.070007324218750, | |
130 | 131.820007324218750, | |
131 | 135.054992675781250, | |
132 | 136.054992675781250, | |
133 | 137.054992675781250, | |
134 | 138.054992675781250, | |
135 | 139.054992675781250, | |
136 | 140.054992675781250, | |
137 | 141.054992675781250, | |
138 | 142.054992675781250, | |
139 | 143.054992675781250, | |
140 | 144.054992675781250, | |
141 | 145.054992675781250, | |
142 | 146.054992675781250, | |
143 | 147.054992675781250, | |
144 | 148.054992675781250, | |
145 | 149.054992675781250, | |
146 | 150.054992675781250, | |
147 | 151.054992675781250, | |
148 | 152.054992675781250, | |
149 | 153.054992675781250, | |
150 | 154.054992675781250, | |
151 | 155.054992675781250, | |
152 | 156.054992675781250, | |
153 | 157.054992675781250, | |
154 | 158.054992675781250, | |
155 | 159.054992675781250, | |
156 | 160.054992675781250, | |
157 | 161.054992675781250, | |
158 | 162.054992675781250, | |
159 | 163.054992675781250, | |
160 | 164.054992675781250, | |
161 | 165.054992675781250, | |
162 | 166.054992675781250, | |
163 | 167.054992675781250, | |
164 | 168.054992675781250, | |
165 | 169.054992675781250, | |
166 | 170.054992675781250, | |
167 | 171.054992675781250, | |
168 | 172.054992675781250, | |
169 | 173.054992675781250, | |
170 | 174.054992675781250, | |
171 | 175.054992675781250, | |
172 | 176.054992675781250, | |
173 | 177.054992675781250, | |
174 | 178.054992675781250, | |
175 | 179.054992675781250, | |
176 | 180.054992675781250, | |
177 | 181.054992675781250, | |
178 | 182.054992675781250, | |
179 | 183.054992675781250, | |
180 | 184.054992675781250, | |
181 | 185.054992675781250, | |
182 | 186.054992675781250, | |
183 | 187.054992675781250, | |
184 | 188.054992675781250, | |
185 | 189.054992675781250, | |
186 | 190.054992675781250, | |
187 | 191.054992675781250, | |
188 | 192.054992675781250, | |
189 | 193.054992675781250, | |
190 | 194.054992675781250, | |
191 | 195.054992675781250, | |
192 | 196.054992675781250, | |
193 | 197.054992675781250, | |
194 | 198.054992675781250, | |
195 | 199.054992675781250, | |
196 | 200.054992675781250, | |
197 | 201.054992675781250, | |
198 | 202.054992675781250, | |
199 | 203.054992675781250, | |
200 | 204.054992675781250, | |
201 | 205.054992675781250, | |
202 | 206.054992675781250, | |
203 | 207.054992675781250, | |
204 | 208.054992675781250, | |
205 | 209.054992675781250, | |
206 | 210.054992675781250, | |
207 | 211.054992675781250, | |
208 | 212.054992675781250, | |
209 | 213.054992675781250, | |
210 | 214.054992675781250, | |
211 | 215.054992675781250, | |
212 | 216.054992675781250, | |
213 | 217.054992675781250, | |
214 | 218.054992675781250, | |
215 | 219.054992675781250, | |
216 | 220.054992675781250, | |
217 | 221.054992675781250, | |
218 | 222.054992675781250, | |
219 | 223.054992675781250, | |
220 | 224.054992675781250, | |
221 | 225.054992675781250, | |
222 | 226.054992675781250, | |
223 | 227.054992675781250, | |
224 | 228.054992675781250, | |
225 | 229.054992675781250, | |
226 | 230.054992675781250, | |
227 | 231.054992675781250, | |
228 | 232.054992675781250, | |
229 | 233.054992675781250, | |
230 | 234.054992675781250, | |
231 | 235.054992675781250, | |
232 | 236.054992675781250, | |
233 | 237.054992675781250, | |
234 | 238.054992675781250, | |
235 | 239.054992675781250, | |
236 | 240.054992675781250, | |
237 | 241.054992675781250, | |
238 | 242.054992675781250, | |
239 | 243.054992675781250, | |
240 | 244.054992675781250, | |
241 | 245.054992675781250, | |
242 | 246.054992675781250, | |
243 | }; | |
244 | ||
245 | Int_t AliL3Transform::fNPads[176] = {67, | |
246 | 67, | |
247 | 67, | |
248 | 69, | |
249 | 69, | |
250 | 69, | |
251 | 71, | |
252 | 71, | |
253 | 71, | |
254 | 73, | |
255 | 73, | |
256 | 73, | |
257 | 75, | |
258 | 75, | |
259 | 75, | |
260 | 77, | |
261 | 77, | |
262 | 77, | |
263 | 79, | |
264 | 79, | |
265 | 79, | |
266 | 81, | |
267 | 81, | |
268 | 81, | |
269 | 83, | |
270 | 83, | |
271 | 83, | |
272 | 85, | |
273 | 85, | |
274 | 85, | |
275 | 87, | |
276 | 87, | |
277 | 87, | |
278 | 89, | |
279 | 89, | |
280 | 89, | |
281 | 91, | |
282 | 91, | |
283 | 91, | |
284 | 93, | |
285 | 93, | |
286 | 93, | |
287 | 95, | |
288 | 95, | |
289 | 95, | |
290 | 97, | |
291 | 97, | |
292 | 97, | |
293 | 99, | |
294 | 99, | |
295 | 99, | |
296 | 101, | |
297 | 101, | |
298 | 101, | |
299 | 103, | |
300 | 103, | |
301 | 103, | |
302 | 105, | |
303 | 105, | |
304 | 105, | |
305 | 107, | |
306 | 107, | |
307 | 107, | |
308 | 109, | |
309 | 73, | |
310 | 75, | |
311 | 75, | |
312 | 75, | |
313 | 77, | |
314 | 77, | |
315 | 77, | |
316 | 77, | |
317 | 79, | |
318 | 79, | |
319 | 79, | |
320 | 81, | |
321 | 81, | |
322 | 81, | |
323 | 83, | |
324 | 83, | |
325 | 83, | |
326 | 83, | |
327 | 85, | |
328 | 85, | |
329 | 85, | |
330 | 87, | |
331 | 87, | |
332 | 87, | |
333 | 87, | |
334 | 89, | |
335 | 89, | |
336 | 89, | |
337 | 91, | |
338 | 91, | |
339 | 91, | |
340 | 93, | |
341 | 93, | |
342 | 93, | |
343 | 93, | |
344 | 95, | |
345 | 95, | |
346 | 95, | |
347 | 97, | |
348 | 97, | |
349 | 97, | |
350 | 97, | |
351 | 99, | |
352 | 99, | |
353 | 99, | |
354 | 101, | |
355 | 101, | |
356 | 101, | |
357 | 103, | |
358 | 103, | |
359 | 103, | |
360 | 103, | |
361 | 105, | |
362 | 105, | |
363 | 105, | |
364 | 107, | |
365 | 107, | |
366 | 107, | |
367 | 107, | |
368 | 109, | |
369 | 109, | |
370 | 109, | |
371 | 111, | |
372 | 111, | |
373 | 111, | |
374 | 113, | |
375 | 113, | |
376 | 113, | |
377 | 113, | |
378 | 115, | |
379 | 115, | |
380 | 115, | |
381 | 117, | |
382 | 117, | |
383 | 117, | |
384 | 117, | |
385 | 119, | |
386 | 119, | |
387 | 119, | |
388 | 121, | |
389 | 121, | |
390 | 121, | |
391 | 123, | |
392 | 123, | |
393 | 123, | |
394 | 123, | |
395 | 125, | |
396 | 125, | |
397 | 125, | |
398 | 127, | |
399 | 127, | |
400 | 127, | |
401 | 127, | |
402 | 129, | |
403 | 129, | |
404 | 129, | |
405 | 131, | |
406 | 131, | |
407 | 131, | |
408 | 133, | |
409 | 133, | |
410 | 133, | |
411 | 133, | |
412 | 135, | |
413 | 135, | |
414 | 135, | |
415 | 137, | |
416 | 137, | |
417 | 137, | |
418 | 137, | |
419 | 139, | |
420 | 139, | |
421 | }; | |
422 | ||
423 | ||
424 | ||
425 | void AliL3Transform::Init(const Char_t* path) | |
f59eed2d | 426 | { |
494fad94 | 427 | //Overwrite the parameters with values stored in file "l3transform.config" in path. |
428 | //If file does not exist, old default values will be used. | |
b25c64e5 | 429 | |
f59eed2d | 430 | Char_t *pathname=new Char_t[1024]; |
a4e75a99 | 431 | strcpy(pathname,path); |
432 | strcat(pathname,"/l3transform.config"); | |
494fad94 | 433 | |
a4e75a99 | 434 | FILE *fptr=fopen(pathname,"r"); |
435 | if(!fptr){ | |
b25c64e5 | 436 | LOG(AliL3Log::kWarning,"AliL3Transform::Init","File Open") |
437 | <<"Pointer to Config File \""<<pathname<<"\" 0x0!"<<ENDLOG; | |
a4e75a99 | 438 | return; |
439 | } | |
440 | ||
f59eed2d | 441 | Char_t d1[250], d2[100], d3[100]; |
442 | Int_t dummy=0; | |
443 | Double_t ddummy=0.0; | |
a4e75a99 | 444 | |
445 | while(!feof(fptr)) { | |
446 | fscanf(fptr,"%s",d1); | |
447 | ||
293aee2f | 448 | if(strcmp(d1,"fBFieldFactor")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fBFieldFactor=(Int_t)dummy;fBField=fBFieldFactor*0.2;} |
449 | else if(strcmp(d1,"fNTimeBins")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNTimeBins=(Int_t)dummy;} | |
a4e75a99 | 450 | else if(strcmp(d1,"fNRowLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowLow=(Int_t)dummy;} |
768861a0 | 451 | if(fNRowLow != 64) |
452 | LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow") | |
453 | <<"Number of inner PadRows should be 64! Check and fgrep the code for 64 to see the consequences of this major change!"<<ENDLOG; | |
a4e75a99 | 454 | else if(strcmp(d1,"fNRowUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp=(Int_t)dummy;} |
455 | else if(strcmp(d1,"fNSectorLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorLow=(Int_t)dummy;} | |
456 | else if(strcmp(d1,"fNSectorUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorUp=(Int_t)dummy;} | |
457 | else if(strcmp(d1,"fNSector")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSector=(Int_t)dummy;} | |
458 | else if(strcmp(d1,"fPadPitchWidthLow")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthLow=(Double_t)ddummy;} | |
459 | else if(strcmp(d1,"fPadPitchWidthUp")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthUp=(Double_t)ddummy;} | |
460 | else if(strcmp(d1,"fZWidth")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZWidth=(Double_t)ddummy;} | |
461 | else if(strcmp(d1,"fZSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZSigma=(Double_t)ddummy;} | |
740da2a6 | 462 | else if(strcmp(d1,"fZLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZLength=(Double_t)ddummy;} |
463 | else if(strcmp(d1,"fZOffset")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZOffset=(Double_t)ddummy;} | |
a4e75a99 | 464 | else if(strcmp(d1,"fNSlice")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSlice=(Int_t)dummy;} |
768861a0 | 465 | else if(strcmp(d1,"fDiffT")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffT=(Double_t)ddummy;} |
466 | else if(strcmp(d1,"fDiffL")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffL=(Double_t)ddummy;} | |
467 | else if(strcmp(d1,"fInnerPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPadLength=(Double_t)ddummy;} | |
468 | else if(strcmp(d1,"fOuterPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuterPadLength=(Double_t)ddummy;} | |
469 | else if(strcmp(d1,"fInnerPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPRFSigma=(Double_t)ddummy;} | |
470 | else if(strcmp(d1,"fOuterPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuterPRFSigma=(Double_t)ddummy;} | |
471 | else if(strcmp(d1,"fTimeSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fTimeSigma=(Double_t)ddummy;} | |
a4e75a99 | 472 | else if(strcmp(d1,"fNRow")==0){ |
473 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRow=(Int_t)dummy; | |
474 | if(fNRow!=176){ | |
475 | LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow")<<"Number of PadRows should be 176! Check and fgrep the code for 176 to see the consequences of this major change!"<<ENDLOG; | |
476 | } | |
477 | } | |
478 | else if(strcmp(d1,"fNRotShift")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fNRotShift=(Double_t)ddummy;} | |
479 | else if(strcmp(d1,"fPi")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPi=(Double_t)ddummy;} | |
480 | else if(strcmp(d1,"fX[0]")==0){ | |
481 | fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fX[0]=(Double_t)ddummy; | |
740da2a6 | 482 | for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fX[i]=(Double_t)ddummy;} |
a4e75a99 | 483 | } |
484 | else if(strcmp(d1,"fNPads[0]")==0){ | |
485 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNPads[0]=(Int_t)dummy; | |
486 | for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fNPads[i]=(Int_t)dummy;} | |
487 | } | |
488 | } | |
489 | ||
a4e75a99 | 490 | fclose(fptr); |
491 | delete pathname; | |
89693986 | 492 | fVersion=1; //new version |
494fad94 | 493 | |
a4e75a99 | 494 | } |
495 | ||
108615fc | 496 | Double_t AliL3Transform::GetEta(Float_t *xyz) |
497 | { | |
498 | Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]); | |
499 | Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2])); | |
500 | return eta; | |
501 | } | |
502 | ||
740da2a6 | 503 | void AliL3Transform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz) |
504 | { | |
505 | rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]); | |
506 | rpe[1] = atan2(xyz[1],xyz[0]); | |
507 | rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2])); | |
508 | } | |
509 | ||
3a1c3849 | 510 | Double_t AliL3Transform::GetEta(Int_t padrow,Int_t pad,Int_t time) |
bd7e82e0 | 511 | { |
512 | Float_t xyz[3]; | |
3a1c3849 | 513 | Int_t sector,row; |
514 | Slice2Sector(0,padrow,sector,row); | |
515 | Raw2Local(xyz,sector,row,pad,time); | |
bd7e82e0 | 516 | |
517 | return GetEta(xyz); | |
518 | } | |
519 | ||
108615fc | 520 | Double_t AliL3Transform::GetPhi(Float_t *xyz) |
521 | { | |
108615fc | 522 | Double_t phi = atan2(xyz[1],xyz[0]); |
523 | //if(phi<0) phi=phi+2*TMath::Pi(); | |
524 | return phi; | |
525 | } | |
526 | ||
494fad94 | 527 | Bool_t AliL3Transform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row) |
528 | { | |
108615fc | 529 | if(slicerow<0&&slicerow>=fNRow) return kFALSE; |
530 | if(slice<0||slice>=fNSlice) return kFALSE; | |
531 | ||
532 | if(slicerow<fNRowLow){ | |
533 | sector = slice; | |
534 | row = slicerow; | |
535 | } | |
536 | else { | |
537 | sector = slice+fNSlice; | |
538 | row = slicerow-fNRowLow; | |
539 | } | |
540 | return kTRUE; | |
541 | } | |
542 | ||
494fad94 | 543 | Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t sector) |
544 | { | |
108615fc | 545 | if(sector<0||sector>=fNSector) return kFALSE; |
546 | if(sector<fNSectorLow) slice = sector; | |
547 | else slice = sector - fNSectorLow; | |
548 | return kTRUE; | |
549 | } | |
550 | ||
494fad94 | 551 | Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t & slicerow,Int_t sector, Int_t row) |
552 | { | |
108615fc | 553 | if(sector<0||sector>=fNSector||row<0) return kFALSE; |
554 | if(sector<fNSectorLow){ | |
555 | if(row>=fNRowLow) return kFALSE; | |
556 | slice = sector; | |
557 | slicerow = row; | |
558 | } | |
559 | else{ | |
560 | if(row>=fNRowUp) return kFALSE; | |
561 | slice = sector - fNSectorLow; | |
562 | slicerow = row + fNRowLow; | |
563 | } | |
564 | return kTRUE; | |
565 | } | |
566 | ||
567 | Double_t AliL3Transform::Row2X(Int_t slicerow){ | |
568 | if(slicerow<0||slicerow>=fNRow) return 0; | |
569 | return fX[slicerow]; | |
570 | } | |
571 | ||
572 | void AliL3Transform::Local2Global(Float_t *xyz,Int_t slice) | |
573 | { | |
574 | //Transformation to global coordinate system | |
575 | Float_t x0 = xyz[0]; | |
576 | Float_t y0 = xyz[1]; | |
577 | Float_t cs,sn; | |
494fad94 | 578 | cs = cos( (2*fPi/18) * (slice+fNRotShift) ); |
579 | sn = sin( (2*fPi/18) * (slice+fNRotShift) ); | |
108615fc | 580 | xyz[0]=x0*cs-y0*sn; |
581 | xyz[1]=x0*sn+y0*cs; | |
582 | xyz[2]=xyz[2];//global z=local z | |
583 | } | |
584 | ||
585 | void AliL3Transform::Local2GlobalAngle(Float_t *angle,Int_t slice){ | |
740da2a6 | 586 | angle[0] = fmod(angle[0]+(slice+fNRotShift)*(2*fPi/18),2*fPi); |
108615fc | 587 | } |
588 | ||
589 | void AliL3Transform::Global2LocalAngle(Float_t *angle,Int_t slice){ | |
740da2a6 | 590 | angle[0] = angle[0]-(slice+fNRotShift)*(2*fPi/18); |
108615fc | 591 | if(angle[0]<0) angle[0]+=2*fPi; |
592 | } | |
593 | ||
594 | void AliL3Transform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time) | |
595 | { | |
596 | //Transformation from rawdata to local coordinate system | |
597 | ||
598 | Int_t slice,slicerow; | |
599 | Sector2Slice(slice, slicerow, sector, row); | |
600 | ||
740da2a6 | 601 | //X-Value |
108615fc | 602 | xyz[0]=Row2X(slicerow); |
740da2a6 | 603 | |
604 | //Y-Value | |
108615fc | 605 | Int_t npads= fNPads[slicerow]; |
606 | if(sector<fNSectorLow) | |
607 | xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthLow; | |
608 | else | |
609 | xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthUp; | |
740da2a6 | 610 | |
611 | //Z-Value (remember PULSA Delay) | |
612 | //xyz[2]=fZWidth*time-3.*fZSigma; | |
613 | xyz[2]=fZWidth*time-fZOffset; | |
0e0b1e59 | 614 | if(slice < 18) |
740da2a6 | 615 | xyz[2]=fZLength-xyz[2]; |
0e0b1e59 | 616 | else |
740da2a6 | 617 | xyz[2]=xyz[2]-fZLength; |
494fad94 | 618 | |
108615fc | 619 | } |
620 | ||
621 | void AliL3Transform::Local2Global(Float_t *xyz,Int_t sector,Int_t row) | |
622 | { | |
623 | //Transformation to global coordinate system | |
624 | Int_t slice,slicerow; | |
625 | Sector2Slice(slice, slicerow, sector, row); | |
626 | Float_t r=Row2X(slicerow); | |
494fad94 | 627 | Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) ); |
628 | Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) ); | |
108615fc | 629 | |
630 | xyz[0]=r*cs-xyz[1]*sn; | |
631 | xyz[1]=r*sn+xyz[1]*cs; | |
632 | xyz[2]=xyz[2];//global z=local z | |
633 | } | |
634 | ||
635 | Double_t AliL3Transform::GetMaxY(Int_t slicerow) | |
636 | { | |
494fad94 | 637 | |
108615fc | 638 | if(slicerow < fNRowLow) |
639 | return fPadPitchWidthLow*fNPads[slicerow]/2; | |
640 | ||
641 | else | |
642 | return fPadPitchWidthUp*fNPads[slicerow]/2; | |
494fad94 | 643 | |
108615fc | 644 | } |
645 | ||
2342214c | 646 | void AliL3Transform::Global2Local(Float_t *xyz,Int_t sector,Bool_t isSlice) |
108615fc | 647 | { |
2342214c | 648 | |
108615fc | 649 | Int_t slice; |
2342214c | 650 | if(!isSlice) |
651 | Sector2Slice(slice, sector); | |
652 | else | |
653 | slice = sector; | |
494fad94 | 654 | Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) ); |
655 | Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) ); | |
108615fc | 656 | Float_t x1 = xyz[0]*cs + xyz[1]*sn; |
657 | Float_t y1 = -xyz[0]*sn + xyz[1]*cs; | |
658 | xyz[0] = x1; | |
659 | xyz[1] = y1; | |
660 | } | |
661 | ||
662 | void AliL3Transform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time) | |
663 | { | |
664 | //Transformation from raw to global coordinates | |
665 | ||
666 | Raw2Local(xyz,sector,row,pad,time); | |
667 | Local2Global(xyz,sector,row); | |
668 | } | |
669 | ||
670 | void AliL3Transform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row) | |
671 | { | |
672 | //Transformation from local coordinates to raw | |
494fad94 | 673 | |
108615fc | 674 | Int_t slice,slicerow; |
675 | Sector2Slice(slice, slicerow, sector, row); | |
676 | ||
677 | if(sector<fNSectorLow) | |
678 | xyz[1]=xyz[1]/fPadPitchWidthLow+0.5*(fNPads[slicerow]-1); | |
679 | else | |
680 | xyz[1]=xyz[1]/fPadPitchWidthUp+0.5*(fNPads[slicerow]-1); | |
681 | Int_t sign=-1; | |
682 | Int_t nis=fNSectorLow; | |
683 | Int_t nos=fNSectorUp; | |
684 | ||
685 | if ((sector<nis/2) || ((sector-nis)<nos/2)) sign=1; | |
1727f1c9 | 686 | xyz[2]=fZLength-sign*xyz[2]; |
687 | xyz[2]=(xyz[2]+fZOffset)/fZWidth; | |
494fad94 | 688 | |
108615fc | 689 | } |
690 | ||
691 | void AliL3Transform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row) | |
692 | { | |
693 | //Transformation from global coordinates to raw. | |
694 | ||
695 | Global2Local(xyz,sector); | |
696 | Local2Raw(xyz,sector,row); | |
697 | ||
698 | } |