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