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