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