]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
2 | ||
3 | // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>, Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de> | |
4 | //*-- Copyright © ALICE HLT Group | |
cd058d23 | 5 | |
108615fc | 6 | |
118c26c3 | 7 | #include "AliL3StandardIncludes.h" |
3e87ef69 | 8 | #include "dirent.h" |
118c26c3 | 9 | |
5923e698 | 10 | #ifdef use_aliroot |
5e0f9911 | 11 | #include <AliRun.h> |
12 | #include <AliMagF.h> | |
13 | #include <AliTPCParamSR.h> | |
14 | #include <AliTPCPRF2D.h> | |
15 | #include <AliTPCRF1D.h> | |
3e87ef69 | 16 | #endif |
17 | #ifdef use_root | |
5e0f9911 | 18 | #include <TFile.h> |
2220326f | 19 | #include <TUnixSystem.h> |
20 | #include <TTimeStamp.h> | |
3e87ef69 | 21 | #include <TError.h> |
5923e698 | 22 | #endif |
b661165c | 23 | |
5e0f9911 | 24 | #include "AliL3Logging.h" |
25 | #include "AliL3Transform.h" | |
26 | ||
3e87ef69 | 27 | #if GCCVERSION == 3 |
28 | using namespace std; | |
29 | #endif | |
30 | ||
4499ed26 | 31 | /** \class AliL3Transform |
3e87ef69 | 32 | <pre> |
b661165c | 33 | //_____________________________________________________________ |
108615fc | 34 | // AliL3Transform |
35 | // | |
36 | // Transformation class for ALICE TPC. | |
494fad94 | 37 | // |
38 | // Class which contains all detector specific parameters for the TPC, | |
39 | // and different useful functions for coordinate transforms. | |
40 | // | |
41 | // The class is completely static, which means that no object needs | |
5923e698 | 42 | // to be instantiated. Function calls should then be done like, e.g.: |
494fad94 | 43 | // |
5923e698 | 44 | // Double_t eta = AliL3Transform::GetEta(xyz); |
494fad94 | 45 | // |
46 | // IMPORTANT: If used as is, default detector parameters will be used, | |
47 | // and you really have to make sure that these correspond to | |
48 | // the AliROOT version you are currently working on!! | |
49 | // You should therefore always initialize the parameters by | |
50 | // | |
51 | // AliL3Transform::Init(path); | |
52 | // | |
53 | // where path is a char*, giving the path to where file containing | |
54 | // the detector parameter is located. This file should be called | |
5923e698 | 55 | // "l3transform.config", and can be created with the function MakeInitFile. |
56 | // | |
57 | // You can also force reading the parameters from a AliTPCParam object | |
58 | // by setting the flag; | |
59 | // | |
2220326f | 60 | // AliL3Transform::Init(path,kTRUE); |
5923e698 | 61 | // |
2220326f | 62 | // where path is a char* |
3e87ef69 | 63 | // either providing the rootfile name containing the geometry or |
64 | // the path to the rootfile which should then be called alirunfile.root. | |
0ceee3a5 | 65 | // Note that for both of these cases you have to |
5923e698 | 66 | // compile with USEPACKAGE=ALIROOT set (see level3code/Makefile.conf). |
3e87ef69 | 67 | // |
68 | // Currently, there are 4 versions of the Transformer: | |
69 | // fVersion==fV_aliroot: ALIROOT-head compatible | |
70 | // fVersion==fV_cosmics: Cosmics data run (2003) compatible | |
71 | // fVersion==fV_default: means no config file has been loaded | |
72 | // fVersion==fV_deprecated: dont use old (before July 2003) style of transformer | |
73 | // | |
74 | </pre> | |
4499ed26 | 75 | */ |
494fad94 | 76 | |
3e87ef69 | 77 | |
494fad94 | 78 | ClassImp(AliL3Transform) |
79 | ||
5e0f9911 | 80 | |
3e87ef69 | 81 | const Double_t AliL3Transform::fAnodeWireSpacing = 0.25; //Taken from the TDR |
82 | const Double_t AliL3Transform::fBFACT = 0.0029980; //Conversion Factor | |
83 | const Double_t AliL3Transform::fPi = 3.141592653589793; | |
84 | ||
85 | //Defined by HLT and GSI | |
5923e698 | 86 | Int_t AliL3Transform::fNPatches = 6; |
3e87ef69 | 87 | Int_t AliL3Transform::fRows[6][2] = {{0,29},{30,62},{63,90},{91,116},{117,139},{140,158}}; |
88 | Int_t AliL3Transform::fNRows[6] = {30,33,28,26,23,19}; | |
89 | ||
90 | // The following definition is generated by MakeInitFile function | |
91 | Double_t AliL3Transform::fBField = 0.2; | |
92 | Double_t AliL3Transform::fSolenoidBField = 2; | |
93 | Double_t AliL3Transform::fBFieldFactor = 1; | |
94 | Int_t AliL3Transform::fVersion = fV_default; | |
95 | Int_t AliL3Transform::fNTimeBins = 446; | |
96 | Int_t AliL3Transform::fNRowLow = 63; | |
97 | Int_t AliL3Transform::fNRowUp = 96; | |
98 | Int_t AliL3Transform::fNRowUp1 = 64; | |
99 | Int_t AliL3Transform::fNRowUp2 = 32; | |
100 | Int_t AliL3Transform::fNSectorLow = 36; | |
101 | Int_t AliL3Transform::fNSectorUp = 36; | |
102 | Int_t AliL3Transform::fNSector = 72; | |
103 | Double_t AliL3Transform::fPadPitchWidthLow = 0.4; | |
104 | Double_t AliL3Transform::fPadPitchWidthUp = 0.6; | |
105 | Double_t AliL3Transform::fZWidth = 0.5660; | |
106 | Double_t AliL3Transform::fZSigma = 0.2288; | |
107 | Double_t AliL3Transform::fZLength = 250.0000; | |
108 | Double_t AliL3Transform::fZOffset = 0.6864; | |
109 | Double_t AliL3Transform::fDiffT = 0.0220; | |
110 | Double_t AliL3Transform::fDiffL = 0.0220; | |
111 | Double_t AliL3Transform::fOmegaTau = 0.1450; | |
112 | Double_t AliL3Transform::fInnerPadLength = 0.75; | |
113 | Double_t AliL3Transform::fOuter1PadLength = 1.00; | |
114 | Double_t AliL3Transform::fOuter2PadLength = 1.50; | |
115 | Double_t AliL3Transform::fInnerPRFSigma = 0.203811; | |
116 | Double_t AliL3Transform::fOuter1PRFSigma = 0.299325; | |
117 | Double_t AliL3Transform::fOuter2PRFSigma = 0.299323; | |
118 | Double_t AliL3Transform::fTimeSigma = 0.228809; | |
119 | Int_t AliL3Transform::fADCSat = 1024; | |
120 | Int_t AliL3Transform::fZeroSup = 0; | |
121 | Int_t AliL3Transform::fNSlice = 36; | |
122 | Int_t AliL3Transform::fNRow = 159; | |
123 | Double_t AliL3Transform::fNRotShift = 0.5; | |
124 | Int_t AliL3Transform::fSlice2Sector[36][2] = { { 0, 36}, | |
125 | { 1, 37}, | |
126 | { 2, 38}, | |
127 | { 3, 39}, | |
128 | { 4, 40}, | |
129 | { 5, 41}, | |
130 | { 6, 42}, | |
131 | { 7, 43}, | |
132 | { 8, 44}, | |
133 | { 9, 45}, | |
134 | {10, 46}, | |
135 | {11, 47}, | |
136 | {12, 48}, | |
137 | {13, 49}, | |
138 | {14, 50}, | |
139 | {15, 51}, | |
140 | {16, 52}, | |
141 | {17, 53}, | |
142 | {18, 54}, | |
143 | {19, 55}, | |
144 | {20, 56}, | |
145 | {21, 57}, | |
146 | {22, 58}, | |
147 | {23, 59}, | |
148 | {24, 60}, | |
149 | {25, 61}, | |
150 | {26, 62}, | |
151 | {27, 63}, | |
152 | {28, 64}, | |
153 | {29, 65}, | |
154 | {30, 66}, | |
155 | {31, 67}, | |
156 | {32, 68}, | |
157 | {33, 69}, | |
158 | {34, 70}, | |
159 | {35, 71} | |
160 | }; | |
161 | ||
162 | Int_t AliL3Transform::fSector2Slice[72] = { 0, | |
163 | 1, | |
164 | 2, | |
165 | 3, | |
166 | 4, | |
167 | 5, | |
168 | 6, | |
169 | 7, | |
170 | 8, | |
171 | 9, | |
172 | 10, | |
173 | 11, | |
174 | 12, | |
175 | 13, | |
176 | 14, | |
177 | 15, | |
178 | 16, | |
179 | 17, | |
180 | 18, | |
181 | 19, | |
182 | 20, | |
183 | 21, | |
184 | 22, | |
185 | 23, | |
186 | 24, | |
187 | 25, | |
188 | 26, | |
189 | 27, | |
190 | 28, | |
191 | 29, | |
192 | 30, | |
193 | 31, | |
194 | 32, | |
195 | 33, | |
196 | 34, | |
197 | 35, | |
198 | 0, | |
199 | 1, | |
200 | 2, | |
201 | 3, | |
202 | 4, | |
203 | 5, | |
204 | 6, | |
205 | 7, | |
206 | 8, | |
207 | 9, | |
208 | 10, | |
209 | 11, | |
210 | 12, | |
211 | 13, | |
212 | 14, | |
213 | 15, | |
214 | 16, | |
215 | 17, | |
216 | 18, | |
217 | 19, | |
218 | 20, | |
219 | 21, | |
220 | 22, | |
221 | 23, | |
222 | 24, | |
223 | 25, | |
224 | 26, | |
225 | 27, | |
226 | 28, | |
227 | 29, | |
228 | 30, | |
229 | 31, | |
230 | 32, | |
231 | 33, | |
232 | 34, | |
233 | 35 | |
234 | }; | |
235 | ||
236 | Int_t AliL3Transform::fSectorLow[72] = { 1, | |
237 | 1, | |
238 | 1, | |
239 | 1, | |
240 | 1, | |
241 | 1, | |
242 | 1, | |
243 | 1, | |
244 | 1, | |
245 | 1, | |
246 | 1, | |
247 | 1, | |
248 | 1, | |
249 | 1, | |
250 | 1, | |
251 | 1, | |
252 | 1, | |
253 | 1, | |
254 | 1, | |
255 | 1, | |
256 | 1, | |
257 | 1, | |
258 | 1, | |
259 | 1, | |
260 | 1, | |
261 | 1, | |
262 | 1, | |
263 | 1, | |
264 | 1, | |
265 | 1, | |
266 | 1, | |
267 | 1, | |
268 | 1, | |
269 | 1, | |
270 | 1, | |
271 | 1, | |
272 | 0, | |
273 | 0, | |
274 | 0, | |
275 | 0, | |
276 | 0, | |
277 | 0, | |
278 | 0, | |
279 | 0, | |
280 | 0, | |
281 | 0, | |
282 | 0, | |
283 | 0, | |
284 | 0, | |
285 | 0, | |
286 | 0, | |
287 | 0, | |
288 | 0, | |
289 | 0, | |
290 | 0, | |
291 | 0, | |
292 | 0, | |
293 | 0, | |
294 | 0, | |
295 | 0, | |
296 | 0, | |
297 | 0, | |
298 | 0, | |
299 | 0, | |
300 | 0, | |
301 | 0, | |
302 | 0, | |
303 | 0, | |
304 | 0, | |
305 | 0, | |
306 | 0, | |
307 | 0 | |
308 | }; | |
309 | ||
310 | Double_t AliL3Transform::fX[159] = { 85.195, | |
311 | 85.945, | |
312 | 86.695, | |
313 | 87.445, | |
314 | 88.195, | |
315 | 88.945, | |
316 | 89.695, | |
317 | 90.445, | |
318 | 91.195, | |
319 | 91.945, | |
320 | 92.695, | |
321 | 93.445, | |
322 | 94.195, | |
323 | 94.945, | |
324 | 95.695, | |
325 | 96.445, | |
326 | 97.195, | |
327 | 97.945, | |
328 | 98.695, | |
329 | 99.445, | |
330 | 100.195, | |
331 | 100.945, | |
332 | 101.695, | |
333 | 102.445, | |
334 | 103.195, | |
335 | 103.945, | |
336 | 104.695, | |
337 | 105.445, | |
338 | 106.195, | |
339 | 106.945, | |
340 | 107.695, | |
341 | 108.445, | |
342 | 109.195, | |
343 | 109.945, | |
344 | 110.695, | |
345 | 111.445, | |
346 | 112.195, | |
347 | 112.945, | |
348 | 113.695, | |
349 | 114.445, | |
350 | 115.195, | |
351 | 115.945, | |
352 | 116.695, | |
353 | 117.445, | |
354 | 118.195, | |
355 | 118.945, | |
356 | 119.695, | |
357 | 120.445, | |
358 | 121.195, | |
359 | 121.945, | |
360 | 122.695, | |
361 | 123.445, | |
362 | 124.195, | |
363 | 124.945, | |
364 | 125.695, | |
365 | 126.445, | |
366 | 127.195, | |
367 | 127.945, | |
368 | 128.695, | |
369 | 129.445, | |
370 | 130.195, | |
371 | 130.945, | |
372 | 131.695, | |
373 | 135.180, | |
374 | 136.180, | |
375 | 137.180, | |
376 | 138.180, | |
377 | 139.180, | |
378 | 140.180, | |
379 | 141.180, | |
380 | 142.180, | |
381 | 143.180, | |
382 | 144.180, | |
383 | 145.180, | |
384 | 146.180, | |
385 | 147.180, | |
386 | 148.180, | |
387 | 149.180, | |
388 | 150.180, | |
389 | 151.180, | |
390 | 152.180, | |
391 | 153.180, | |
392 | 154.180, | |
393 | 155.180, | |
394 | 156.180, | |
395 | 157.180, | |
396 | 158.180, | |
397 | 159.180, | |
398 | 160.180, | |
399 | 161.180, | |
400 | 162.180, | |
401 | 163.180, | |
402 | 164.180, | |
403 | 165.180, | |
404 | 166.180, | |
405 | 167.180, | |
406 | 168.180, | |
407 | 169.180, | |
408 | 170.180, | |
409 | 171.180, | |
410 | 172.180, | |
411 | 173.180, | |
412 | 174.180, | |
413 | 175.180, | |
414 | 176.180, | |
415 | 177.180, | |
416 | 178.180, | |
417 | 179.180, | |
418 | 180.180, | |
419 | 181.180, | |
420 | 182.180, | |
421 | 183.180, | |
422 | 184.180, | |
423 | 185.180, | |
424 | 186.180, | |
425 | 187.180, | |
426 | 188.180, | |
427 | 189.180, | |
428 | 190.180, | |
429 | 191.180, | |
430 | 192.180, | |
431 | 193.180, | |
432 | 194.180, | |
433 | 195.180, | |
434 | 196.180, | |
435 | 197.180, | |
436 | 198.180, | |
437 | 199.430, | |
438 | 200.930, | |
439 | 202.430, | |
440 | 203.930, | |
441 | 205.430, | |
442 | 206.930, | |
443 | 208.430, | |
444 | 209.930, | |
445 | 211.430, | |
446 | 212.930, | |
447 | 214.430, | |
448 | 215.930, | |
449 | 217.430, | |
450 | 218.930, | |
451 | 220.430, | |
452 | 221.930, | |
453 | 223.430, | |
454 | 224.930, | |
455 | 226.430, | |
456 | 227.930, | |
457 | 229.430, | |
458 | 230.930, | |
459 | 232.430, | |
460 | 233.930, | |
461 | 235.430, | |
462 | 236.930, | |
463 | 238.430, | |
464 | 239.930, | |
465 | 241.430, | |
466 | 242.930, | |
467 | 244.430, | |
468 | 245.930 | |
494fad94 | 469 | }; |
470 | ||
5923e698 | 471 | Int_t AliL3Transform::fNPads[159] = {67, |
494fad94 | 472 | 67, |
473 | 69, | |
474 | 69, | |
475 | 69, | |
476 | 71, | |
477 | 71, | |
478 | 71, | |
479 | 73, | |
480 | 73, | |
481 | 73, | |
482 | 75, | |
483 | 75, | |
484 | 75, | |
485 | 77, | |
486 | 77, | |
487 | 77, | |
488 | 79, | |
489 | 79, | |
490 | 79, | |
491 | 81, | |
492 | 81, | |
493 | 81, | |
494 | 83, | |
495 | 83, | |
496 | 83, | |
497 | 85, | |
498 | 85, | |
499 | 85, | |
500 | 87, | |
501 | 87, | |
502 | 87, | |
503 | 89, | |
504 | 89, | |
505 | 89, | |
506 | 91, | |
507 | 91, | |
508 | 91, | |
509 | 93, | |
510 | 93, | |
511 | 93, | |
512 | 95, | |
513 | 95, | |
514 | 95, | |
515 | 97, | |
516 | 97, | |
517 | 97, | |
518 | 99, | |
519 | 99, | |
520 | 99, | |
5923e698 | 521 | 99, |
494fad94 | 522 | 101, |
523 | 101, | |
524 | 101, | |
525 | 103, | |
526 | 103, | |
527 | 103, | |
528 | 105, | |
529 | 105, | |
530 | 105, | |
531 | 107, | |
532 | 107, | |
533 | 107, | |
494fad94 | 534 | 73, |
535 | 75, | |
536 | 75, | |
537 | 75, | |
5923e698 | 538 | 75, |
494fad94 | 539 | 77, |
540 | 77, | |
541 | 77, | |
542 | 79, | |
543 | 79, | |
544 | 79, | |
545 | 81, | |
546 | 81, | |
547 | 81, | |
5923e698 | 548 | 81, |
494fad94 | 549 | 83, |
550 | 83, | |
551 | 83, | |
552 | 85, | |
553 | 85, | |
554 | 85, | |
5923e698 | 555 | 85, |
494fad94 | 556 | 87, |
557 | 87, | |
558 | 87, | |
559 | 89, | |
560 | 89, | |
561 | 89, | |
562 | 91, | |
563 | 91, | |
564 | 91, | |
5923e698 | 565 | 91, |
494fad94 | 566 | 93, |
567 | 93, | |
568 | 93, | |
569 | 95, | |
570 | 95, | |
571 | 95, | |
5923e698 | 572 | 95, |
494fad94 | 573 | 97, |
574 | 97, | |
575 | 97, | |
576 | 99, | |
577 | 99, | |
578 | 99, | |
579 | 101, | |
580 | 101, | |
581 | 101, | |
5923e698 | 582 | 101, |
494fad94 | 583 | 103, |
584 | 103, | |
585 | 103, | |
586 | 105, | |
587 | 105, | |
588 | 105, | |
5923e698 | 589 | 105, |
494fad94 | 590 | 107, |
591 | 107, | |
592 | 107, | |
593 | 109, | |
594 | 109, | |
595 | 109, | |
596 | 111, | |
597 | 111, | |
598 | 111, | |
599 | 113, | |
600 | 113, | |
601 | 113, | |
494fad94 | 602 | 115, |
603 | 115, | |
494fad94 | 604 | 117, |
605 | 117, | |
494fad94 | 606 | 119, |
607 | 119, | |
608 | 121, | |
609 | 121, | |
610 | 121, | |
611 | 123, | |
612 | 123, | |
494fad94 | 613 | 125, |
614 | 125, | |
494fad94 | 615 | 127, |
616 | 127, | |
617 | 127, | |
618 | 129, | |
619 | 129, | |
494fad94 | 620 | 131, |
621 | 131, | |
622 | 133, | |
623 | 133, | |
494fad94 | 624 | 135, |
625 | 135, | |
626 | 135, | |
627 | 137, | |
628 | 137, | |
118c26c3 | 629 | 139 |
494fad94 | 630 | }; |
631 | ||
3e87ef69 | 632 | Double_t AliL3Transform::fCos[36] = { 0.9848077297, |
633 | 0.8660253882, | |
634 | 0.6427876353, | |
635 | 0.3420201540, | |
636 | 0.0000000000, | |
637 | -0.3420201540, | |
638 | -0.6427876353, | |
639 | -0.8660253882, | |
640 | -0.9848077297, | |
641 | -0.9848077297, | |
642 | -0.8660253882, | |
643 | -0.6427876353, | |
644 | -0.3420201540, | |
645 | -0.0000000000, | |
646 | 0.3420201540, | |
647 | 0.6427876353, | |
648 | 0.8660253882, | |
649 | 0.9848077297, | |
650 | 0.9848077297, | |
651 | 0.8660253882, | |
652 | 0.6427876353, | |
653 | 0.3420201540, | |
654 | 0.0000000000, | |
655 | -0.3420201540, | |
656 | -0.6427876353, | |
657 | -0.8660253882, | |
658 | -0.9848077297, | |
659 | -0.9848077297, | |
660 | -0.8660253882, | |
661 | -0.6427876353, | |
662 | -0.3420201540, | |
663 | -0.0000000000, | |
664 | 0.3420201540, | |
665 | 0.6427876353, | |
666 | 0.8660253882, | |
667 | 0.9848077297 | |
668 | }; | |
669 | ||
670 | Double_t AliL3Transform::fSin[36] = { 0.1736481786, | |
671 | 0.5000000000, | |
672 | 0.7660444379, | |
673 | 0.9396926165, | |
674 | 1.0000000000, | |
675 | 0.9396926165, | |
676 | 0.7660444379, | |
677 | 0.5000000000, | |
678 | 0.1736481786, | |
679 | -0.1736481786, | |
680 | -0.5000000000, | |
681 | -0.7660444379, | |
682 | -0.9396926165, | |
683 | -1.0000000000, | |
684 | -0.9396926165, | |
685 | -0.7660444379, | |
686 | -0.5000000000, | |
687 | -0.1736481786, | |
688 | 0.1736481786, | |
689 | 0.5000000000, | |
690 | 0.7660444379, | |
691 | 0.9396926165, | |
692 | 1.0000000000, | |
693 | 0.9396926165, | |
694 | 0.7660444379, | |
695 | 0.5000000000, | |
696 | 0.1736481786, | |
697 | -0.1736481786, | |
698 | -0.5000000000, | |
699 | -0.7660444379, | |
700 | -0.9396926165, | |
701 | -1.0000000000, | |
702 | -0.9396926165, | |
703 | -0.7660444379, | |
704 | -0.5000000000, | |
705 | -0.1736481786 | |
706 | }; | |
707 | ||
2220326f | 708 | Bool_t AliL3Transform::Init(Char_t* path,Bool_t UseAliTPCParam) |
f59eed2d | 709 | { |
494fad94 | 710 | //Overwrite the parameters with values stored in file "l3transform.config" in path. |
711 | //If file does not exist, old default values will be used. | |
5923e698 | 712 | //If flag UseAliTPCParam is set, the parameters will be read from the the rootfile |
713 | //which then has to be called path/digitfile.root | |
714 | ||
3e87ef69 | 715 | if(fVersion != fV_default) |
5923e698 | 716 | LOG(AliL3Log::kWarning,"AliL3Transform::Init","Init values") |
3e87ef69 | 717 | <<AliL3Log::kDec<<"You are initializing the parameters more than once; check your code please! "<<fVersion<<ENDLOG; |
b25c64e5 | 718 | |
3e87ef69 | 719 | if(UseAliTPCParam) //use rootfile to generate temporary init file |
720 | return ReadInit(path); | |
5923e698 | 721 | |
3e87ef69 | 722 | //create filename |
723 | Char_t pathname[1024]; | |
a4e75a99 | 724 | strcpy(pathname,path); |
3e87ef69 | 725 | |
726 | //test whether provided path is the file itself | |
02f030e3 | 727 | Int_t isdir = 0; |
3e87ef69 | 728 | DIR *testdir=opendir(pathname); |
729 | if(testdir){ | |
730 | isdir=1; | |
731 | closedir(testdir); | |
732 | } | |
733 | ||
734 | if(isdir) strcat(pathname,"/l3transform.config"); | |
735 | ||
736 | return ReadInitFile(pathname); | |
737 | } | |
738 | ||
739 | Bool_t AliL3Transform::ReadInitFile(Char_t* pathname) | |
740 | { | |
741 | //read transformer settings from pathname | |
742 | ||
a4e75a99 | 743 | FILE *fptr=fopen(pathname,"r"); |
744 | if(!fptr){ | |
b25c64e5 | 745 | LOG(AliL3Log::kWarning,"AliL3Transform::Init","File Open") |
746 | <<"Pointer to Config File \""<<pathname<<"\" 0x0!"<<ENDLOG; | |
2220326f | 747 | return kFALSE; |
a4e75a99 | 748 | } |
749 | ||
f59eed2d | 750 | Char_t d1[250], d2[100], d3[100]; |
751 | Int_t dummy=0; | |
752 | Double_t ddummy=0.0; | |
a4e75a99 | 753 | |
754 | while(!feof(fptr)) { | |
755 | fscanf(fptr,"%s",d1); | |
3e87ef69 | 756 | if(strcmp(d1,"fVersion")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fVersion=dummy;} |
757 | else if(strcmp(d1,"fBFieldFactor")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fBFieldFactor=(Double_t)ddummy;} | |
758 | else if(strcmp(d1,"fSolenoidBField")==0) | |
759 | { | |
760 | fscanf(fptr,"%s %lf %s",d2,&ddummy,d3); | |
761 | fSolenoidBField=(Double_t)ddummy; | |
762 | } | |
293aee2f | 763 | else if(strcmp(d1,"fNTimeBins")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNTimeBins=(Int_t)dummy;} |
e1964feb | 764 | else if(strcmp(d1,"fNRowLow")==0) |
765 | { | |
766 | fscanf(fptr,"%s %d %s",d2,&dummy,d3); | |
767 | fNRowLow=(Int_t)dummy; | |
768 | if(fNRowLow != 63) | |
769 | LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow") | |
770 | <<"Number of inner PadRows should be 63! Check and fgrep the code for 63 to see the consequences of this major change!"<<ENDLOG; | |
771 | } | |
a4e75a99 | 772 | else if(strcmp(d1,"fNRowUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp=(Int_t)dummy;} |
5923e698 | 773 | else if(strcmp(d1,"fNRowUp1")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp1=(Int_t)dummy;} |
774 | else if(strcmp(d1,"fNRowUp2")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp2=(Int_t)dummy;} | |
a4e75a99 | 775 | else if(strcmp(d1,"fNSectorLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorLow=(Int_t)dummy;} |
776 | else if(strcmp(d1,"fNSectorUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorUp=(Int_t)dummy;} | |
777 | else if(strcmp(d1,"fNSector")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSector=(Int_t)dummy;} | |
778 | else if(strcmp(d1,"fPadPitchWidthLow")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthLow=(Double_t)ddummy;} | |
779 | else if(strcmp(d1,"fPadPitchWidthUp")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthUp=(Double_t)ddummy;} | |
780 | else if(strcmp(d1,"fZWidth")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZWidth=(Double_t)ddummy;} | |
781 | else if(strcmp(d1,"fZSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZSigma=(Double_t)ddummy;} | |
740da2a6 | 782 | else if(strcmp(d1,"fZLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZLength=(Double_t)ddummy;} |
783 | else if(strcmp(d1,"fZOffset")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZOffset=(Double_t)ddummy;} | |
a4e75a99 | 784 | else if(strcmp(d1,"fNSlice")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSlice=(Int_t)dummy;} |
768861a0 | 785 | else if(strcmp(d1,"fDiffT")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffT=(Double_t)ddummy;} |
786 | else if(strcmp(d1,"fDiffL")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffL=(Double_t)ddummy;} | |
3e87ef69 | 787 | else if(strcmp(d1,"fOmegaTau")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOmegaTau=(Double_t)ddummy;} |
768861a0 | 788 | else if(strcmp(d1,"fInnerPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPadLength=(Double_t)ddummy;} |
5923e698 | 789 | else if(strcmp(d1,"fOuter1PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PadLength=(Double_t)ddummy;} |
790 | else if(strcmp(d1,"fOuter2PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PadLength=(Double_t)ddummy;} | |
768861a0 | 791 | else if(strcmp(d1,"fInnerPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPRFSigma=(Double_t)ddummy;} |
5923e698 | 792 | else if(strcmp(d1,"fOuter1PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PRFSigma=(Double_t)ddummy;} |
793 | else if(strcmp(d1,"fOuter2PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PRFSigma=(Double_t)ddummy;} | |
768861a0 | 794 | else if(strcmp(d1,"fTimeSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fTimeSigma=(Double_t)ddummy;} |
6f3df1c8 | 795 | else if(strcmp(d1,"fADCSat")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fADCSat=(Int_t)dummy;} |
3e87ef69 | 796 | else if(strcmp(d1,"fZeroSup")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fZeroSup=(Int_t)dummy;} |
a4e75a99 | 797 | else if(strcmp(d1,"fNRow")==0){ |
798 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRow=(Int_t)dummy; | |
5923e698 | 799 | if(fNRow!=159){ |
800 | LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow")<<"Number of PadRows should be 159! Check and fgrep the code for 159 to see the consequences of this major change!"<<ENDLOG; | |
a4e75a99 | 801 | } |
802 | } | |
803 | else if(strcmp(d1,"fNRotShift")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fNRotShift=(Double_t)ddummy;} | |
a4e75a99 | 804 | else if(strcmp(d1,"fX[0]")==0){ |
805 | fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fX[0]=(Double_t)ddummy; | |
740da2a6 | 806 | for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fX[i]=(Double_t)ddummy;} |
a4e75a99 | 807 | } |
808 | else if(strcmp(d1,"fNPads[0]")==0){ | |
809 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNPads[0]=(Int_t)dummy; | |
810 | for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fNPads[i]=(Int_t)dummy;} | |
811 | } | |
3e87ef69 | 812 | else if(strcmp(d1,"fNRows[0]")==0){ |
813 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRows[0]=(Int_t)dummy; | |
814 | for(Int_t i=1;i<fNPatches;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fNRows[i]=(Int_t)dummy;} | |
815 | } | |
816 | else if(strcmp(d1,"fRows[0][0]")==0){ | |
817 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fRows[0][0]=(Int_t)dummy; | |
818 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fRows[0][1]=(Int_t)dummy; | |
819 | for(Int_t i=1;i<fNPatches;i++){ | |
820 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fRows[i][0]=(Int_t)dummy; | |
821 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fRows[i][1]=(Int_t)dummy; | |
822 | } | |
823 | } | |
824 | else if(strcmp(d1,"fSlice2Sector[0][0]")==0){ | |
825 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fSlice2Sector[0][0]=(Int_t)dummy; | |
826 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fSlice2Sector[0][1]=(Int_t)dummy; | |
827 | for(Int_t i=1;i<fNSlice;i++){ | |
828 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fSlice2Sector[i][0]=(Int_t)dummy; | |
829 | fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fSlice2Sector[i][1]=(Int_t)dummy; | |
830 | } | |
831 | } | |
832 | else if(strcmp(d1,"fSector2Slice[0]")==0){ | |
833 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fSector2Slice[0]=(Int_t)dummy; | |
834 | for(Int_t i=1;i<fNSector;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fSector2Slice[i]=(Int_t)dummy;} | |
835 | } | |
836 | else if(strcmp(d1,"fSectorLow[0]")==0){ | |
837 | fscanf(fptr,"%s %d %s",d2,&dummy,d3);fSectorLow[0]=(Int_t)dummy; | |
838 | for(Int_t i=1;i<fNSector;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fSectorLow[i]=(Int_t)dummy;} | |
839 | } | |
840 | else if(strcmp(d1,"fCos[0]")==0){ | |
841 | fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fCos[0]=(Double_t)ddummy; | |
a63b4a8f | 842 | for(Int_t i=1;i<fNSlice;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fCos[i]=(Double_t)ddummy;} |
3e87ef69 | 843 | } |
844 | else if(strcmp(d1,"fSin[0]")==0){ | |
845 | fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fSin[0]=(Double_t)ddummy; | |
a63b4a8f | 846 | for(Int_t i=1;i<fNSlice;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fSin[i]=(Double_t)ddummy;} |
3e87ef69 | 847 | } |
a4e75a99 | 848 | } |
849 | ||
3e87ef69 | 850 | //The first multiplier gives the scale factor used to modify the field map |
851 | //defined by the second multiplier. | |
852 | fBField=fBFieldFactor*fSolenoidBField*0.1; | |
853 | ||
a4e75a99 | 854 | fclose(fptr); |
3e87ef69 | 855 | |
856 | //Test if new config file has been used. | |
857 | if(fVersion==fV_deprecated){ | |
858 | LOG(AliL3Log::kError,"AliL3Transform::Init","Version") | |
859 | <<"Version is deprecated, you have to create a new config file."<<ENDLOG; | |
860 | return kFALSE; | |
861 | } | |
2220326f | 862 | |
240d63be | 863 | LOG(AliL3Log::kInformational,"AliL3Transform::Init","Config") |
864 | <<"Successfully loaded values from config file \""<<pathname<<"\""<<ENDLOG; | |
865 | ||
2220326f | 866 | return kTRUE; |
5923e698 | 867 | } |
2220326f | 868 | |
869 | Bool_t AliL3Transform::ReadInit(Char_t *path) | |
5923e698 | 870 | { |
871 | //Read all the parameters from a aliroot file, and store it in a temporary | |
872 | //file which is read by Init. Use this if you want to read the parameters from | |
873 | //the rootfile "every" time. | |
874 | ||
875 | #ifndef use_aliroot | |
876 | LOG(AliL3Log::kError,"AliL3Transform::ReadInit","Version") | |
877 | <<"You have to compile with use_aliroot flag in order to read from AliROOT file"<<ENDLOG; | |
2220326f | 878 | return kFALSE; |
5923e698 | 879 | #else |
880 | Char_t filename[1024]; | |
2220326f | 881 | //first test whether provided path is the rootfile itself |
3e87ef69 | 882 | Int_t saveErrIgLevel=gErrorIgnoreLevel; |
883 | gErrorIgnoreLevel=kFatal; //dont report errors | |
2220326f | 884 | TFile *rootfile = TFile::Open(path); |
3e87ef69 | 885 | if(rootfile->IsZombie()) |
886 | { //ok assume its path to alirunfile file | |
2220326f | 887 | sprintf(filename,"%s/alirunfile.root",path); //create rootfile name |
3e87ef69 | 888 | } else { //path contains itself the rootfile name |
2220326f | 889 | rootfile->Close(); |
3e87ef69 | 890 | sprintf(filename,"%s",path); |
2220326f | 891 | } |
3e87ef69 | 892 | gErrorIgnoreLevel=saveErrIgLevel; |
2220326f | 893 | |
02f030e3 | 894 | //finally make dummy init file /tmp/$USER/l3transform.config-`date` |
895 | Char_t tmppath[1024]; | |
896 | sprintf(tmppath,"/tmp/%s",gSystem->Getenv("USER")); | |
897 | gSystem->mkdir(tmppath); | |
898 | TTimeStamp time; | |
899 | Char_t tmpfile[1024]; | |
900 | sprintf(tmpfile,"%s/l3transform.config-%d",tmppath,(Int_t)time.GetSec()); | |
901 | return MakeInitFile(filename,tmpfile); | |
5923e698 | 902 | #endif |
903 | } | |
904 | ||
02f030e3 | 905 | Bool_t AliL3Transform::MakeInitFile(Char_t *rootfilename,Char_t *filename) |
5923e698 | 906 | { |
907 | //Get the parameters from rootfile, and store it on the file "l3transform.config" | |
3e87ef69 | 908 | //which is being read by Init. fVersion will be fV_aliroot! |
5923e698 | 909 | |
910 | #ifndef use_aliroot | |
911 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","Version") | |
912 | <<"You have to compile with use_aliroot flag in order to use this function"<<ENDLOG; | |
2220326f | 913 | return kFALSE; |
5923e698 | 914 | #else |
02f030e3 | 915 | TFile *rootfile = TFile::Open(rootfilename); |
2220326f | 916 | if(!rootfile) |
917 | { | |
918 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File") | |
02f030e3 | 919 | <<"Could not open file: "<<rootfilename<<ENDLOG; |
2220326f | 920 | return kFALSE; |
921 | } | |
5923e698 | 922 | AliRun *gAlice = (AliRun*)rootfile->Get("gAlice"); |
923 | if(!gAlice) | |
924 | { | |
925 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File") | |
02f030e3 | 926 | <<"No gAlice in file: "<<rootfilename<<ENDLOG; |
2220326f | 927 | return kFALSE; |
5923e698 | 928 | } |
5e0f9911 | 929 | AliTPCParamSR *param=(AliTPCParamSR*)rootfile->Get(GetParamName()); |
5923e698 | 930 | if(!param) |
931 | { | |
02f030e3 | 932 | LOG(AliL3Log::kWarning,"AliL3Transform::MakeInitFile","File") |
933 | <<"No TPC parameters found in \""<<rootfilename | |
934 | <<"\", creating standard parameters " | |
935 | <<"which might not be what you want!"<<ENDLOG; | |
936 | param=new AliTPCParamSR; | |
5923e698 | 937 | } |
ef2318df | 938 | |
939 | AliTPCPRF2D * prfinner = new AliTPCPRF2D; | |
5923e698 | 940 | AliTPCPRF2D * prfouter1 = new AliTPCPRF2D; |
941 | AliTPCPRF2D * prfouter2 = new AliTPCPRF2D; | |
942 | AliTPCRF1D * rf = new AliTPCRF1D(kTRUE); | |
943 | rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.); | |
944 | rf->SetOffset(3*param->GetZSigma()); | |
945 | rf->Update(); | |
946 | ||
947 | TDirectory *savedir=gDirectory; | |
948 | TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root"); | |
949 | if (!prf_file->IsOpen()) | |
950 | { | |
951 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File") | |
952 | <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG; | |
2220326f | 953 | return kFALSE; |
5923e698 | 954 | } |
ef2318df | 955 | prfinner ->Read("prf_07504_Gati_056068_d02"); |
5923e698 | 956 | prfouter1->Read("prf_10006_Gati_047051_d03"); |
957 | prfouter2->Read("prf_15006_Gati_047051_d03"); | |
958 | prf_file->Close(); | |
959 | savedir->cd(); | |
960 | ||
961 | param->SetInnerPRF(prfinner); | |
962 | param->SetOuter1PRF(prfouter1); | |
963 | param->SetOuter2PRF(prfouter2); | |
964 | param->SetTimeRF(rf); | |
965 | ||
3e87ef69 | 966 | fNTimeBins = param->GetMaxTBin()+1; |
967 | fNRowLow = param->GetNRowLow(); | |
968 | fNRowUp = param->GetNRowUp(); | |
969 | fNRowUp1 = param->GetNRowUp1(); | |
970 | fNRowUp2 = param->GetNRowUp2(); | |
971 | fNRow= fNRowLow + fNRowUp; | |
972 | if(fNRow!=159){ | |
973 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","fNRow") | |
974 | <<"Number of rows have changed in ALIROOT"<<ENDLOG; | |
975 | return kFALSE; | |
976 | } | |
977 | ||
978 | fNSectorLow = param->GetNInnerSector(); | |
979 | fNSectorUp = param->GetNOuterSector(); | |
980 | fNSector = fNSectorLow + fNSectorUp; | |
981 | ||
982 | //test whether they were changes to the rotation shift | |
983 | fNRotShift=0; | |
984 | Float_t irotshift = param->GetInnerAngleShift(); //shift angle | |
985 | Float_t orotshift = param->GetOuterAngleShift(); //shift angle | |
986 | const Float_t kDegtoRad = 0.01745329251994; | |
987 | Int_t shift1=TMath::Nint(irotshift/kDegtoRad); | |
988 | Int_t shift2=TMath::Nint(orotshift/kDegtoRad+0.1); | |
989 | if((shift1!=shift2) || (shift1!=10)){ | |
990 | LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","Rotshiftangle") | |
991 | <<"Rotation shift angle has changed in ALIROOT"<<ENDLOG; | |
992 | return kFALSE; | |
993 | } else { | |
994 | fNRotShift=0.5; //our version of the shift angle | |
995 | } | |
996 | ||
997 | fVersion=fV_aliroot; | |
240d63be | 998 | SetBFieldFactor((Double_t)gAlice->Field()->Factor()); |
999 | SetSolenoidBField((Double_t)gAlice->Field()->SolenoidField()); | |
3e87ef69 | 1000 | fPadPitchWidthLow=param->GetInnerPadPitchWidth(); |
1001 | fPadPitchWidthUp=param->GetOuterPadPitchWidth(); | |
1002 | fZWidth=param->GetZWidth(); | |
1003 | fZSigma=param->GetZSigma(); | |
1004 | fZLength=param->GetZLength(); | |
1005 | fZOffset=param->GetZOffset(); | |
1006 | fDiffT=param->GetDiffT(); | |
1007 | fDiffL=param->GetDiffL(); | |
1008 | fOmegaTau=param->GetOmegaTau(); | |
1009 | fInnerPadLength=param->GetInnerPadLength(); | |
1010 | fOuter1PadLength=param->GetOuter1PadLength(); | |
1011 | fOuter2PadLength=param->GetOuter2PadLength(); | |
1012 | fInnerPRFSigma=param->GetInnerPRF()->GetSigmaX(); | |
1013 | fOuter1PRFSigma=param->GetOuter1PRF()->GetSigmaX(); | |
1014 | fOuter2PRFSigma=param->GetOuter2PRF()->GetSigmaX(); | |
1015 | fTimeSigma=param->GetTimeRF()->GetSigma(); | |
1016 | fADCSat=param->GetADCSat(); | |
1017 | fZeroSup=param->GetZeroSup(); | |
1018 | fNSlice=fNSectorLow; | |
240d63be | 1019 | |
3e87ef69 | 1020 | //now do the arrays |
1021 | for(Int_t i=0;i<fNRow;i++){ | |
1022 | Int_t sec,row; | |
1023 | if( i < fNRowLow){sec =0;row =i;} | |
1024 | else{sec = fNSectorLow;row =i-fNRowLow;} | |
1025 | fX[i]=param->GetPadRowRadii(sec,row); | |
1026 | } | |
1027 | for(Int_t i=0;i<fNRow;i++){ | |
1028 | Int_t sec,row; | |
1029 | if( i < fNRowLow){sec =0;row =i;} | |
1030 | else{sec = fNSectorLow;row =i-fNRowLow;} | |
1031 | fNPads[i]=param->GetNPads(sec,row); | |
1032 | } | |
1033 | for(Int_t i=0;i<fNSector;i++){ | |
1034 | if(i<fNSectorLow) fSectorLow[i]=1; | |
1035 | else fSectorLow[i]=0; | |
1036 | } | |
02f030e3 | 1037 | return SaveInitFile(filename); |
3e87ef69 | 1038 | #endif |
1039 | } | |
5923e698 | 1040 | |
3e87ef69 | 1041 | Bool_t AliL3Transform::SaveInitFile(Char_t *filenamepath) |
1042 | { | |
1043 | //store the parameters in the file "filenamepath" | |
5923e698 | 1044 | |
3e87ef69 | 1045 | FILE *f = fopen(filenamepath,"w"); |
1046 | if(!f){ | |
02f030e3 | 1047 | LOG(AliL3Log::kError,"AliL3Transform::SaveInitFile","File") |
1048 | <<"Could not open file: "<<filenamepath<<ENDLOG; | |
3e87ef69 | 1049 | return kFALSE; |
1050 | } | |
6f3df1c8 | 1051 | |
3e87ef69 | 1052 | fprintf(f,"void AliL3Transform::Init(){\n"); |
1053 | fprintf(f," fVersion = %d;\n", fVersion); | |
1054 | fprintf(f," fBFieldFactor = %.3f;\n",fBFieldFactor); | |
1055 | fprintf(f," fSolenoidBField = %.3f;\n",fSolenoidBField); | |
1056 | fprintf(f," fNTimeBins = %d;\n",fNTimeBins); | |
1057 | fprintf(f," fNRowLow = %d;\n",fNRowLow); | |
1058 | fprintf(f," fNRowUp = %d;\n",fNRowUp); | |
1059 | fprintf(f," fNRowUp1 = %d;\n",fNRowUp1); | |
1060 | fprintf(f," fNRowUp2 = %d;\n",fNRowUp2); | |
1061 | fprintf(f," fNSectorLow = %d;\n",fNSectorLow); | |
1062 | fprintf(f," fNSectorUp = %d;\n",fNSectorUp); | |
1063 | fprintf(f," fNSector = %d;\n",fNSector); | |
1064 | fprintf(f," fPadPitchWidthLow = %.3f;\n",fPadPitchWidthLow); | |
1065 | fprintf(f," fPadPitchWidthUp = %.3f;\n",fPadPitchWidthUp); | |
1066 | fprintf(f," fZWidth = %.4f;\n",fZWidth); | |
1067 | fprintf(f," fZSigma = %.4f;\n",fZSigma); | |
1068 | fprintf(f," fZLength = %.4f;\n",fZLength); | |
1069 | fprintf(f," fZOffset = %.4f;\n",fZOffset); | |
1070 | fprintf(f," fDiffT = %.4f;\n",fDiffT); | |
1071 | fprintf(f," fDiffL = %.4f;\n",fDiffL); | |
1072 | fprintf(f," fOmegaTau = %.4f;\n",fOmegaTau); | |
1073 | fprintf(f," fInnerPadLength = %.3f;\n",fInnerPadLength); | |
1074 | fprintf(f," fOuter1PadLength = %.3f;\n",fOuter1PadLength); | |
1075 | fprintf(f," fOuter2PadLength = %.3f;\n",fOuter2PadLength); | |
1076 | fprintf(f," fInnerPRFSigma = %.6f;\n",fInnerPRFSigma); | |
1077 | fprintf(f," fOuter1PRFSigma = %.6f;\n",fOuter1PRFSigma); | |
1078 | fprintf(f," fOuter2PRFSigma = %.6f;\n",fOuter2PRFSigma); | |
1079 | fprintf(f," fTimeSigma = %.6f;\n",fTimeSigma); | |
1080 | fprintf(f," fADCSat = %d;\n",fADCSat); | |
1081 | fprintf(f," fZeroSup = %d;\n",fZeroSup); | |
1082 | fprintf(f," fNSlice = %d;\n",fNSlice); | |
1083 | fprintf(f," fNRow = %d;\n",fNRow); | |
1084 | fprintf(f," fNRotShift = %.2f;\n",fNRotShift); | |
1085 | //now do the arrays | |
1086 | for(Int_t i=0;i<fNRow;i++){ | |
1087 | fprintf(f," fX[%d] = %3.2f;\n",i,fX[i]); | |
1088 | } | |
1089 | for(Int_t i=0;i<fNRow;i++){ | |
1090 | fprintf(f," fNPads[%d] = %d;\n",i,fNPads[i]); | |
1091 | } | |
5923e698 | 1092 | |
3e87ef69 | 1093 | //Slice/Sector dont belong to aliroot, but we want to be flexible |
1094 | for(Int_t i=0;i<fNSlice;i++){ | |
1095 | fprintf(f," fSlice2Sector[%d][0] = %d;\n",i,fSlice2Sector[i][0]); | |
1096 | fprintf(f," fSlice2Sector[%d][1] = %d;\n",i,fSlice2Sector[i][1]); | |
1097 | } | |
1098 | for(Int_t i=0;i<fNSector;i++){ | |
1099 | fprintf(f," fSector2Slice[%d] = %d;\n",i,fSector2Slice[i]); | |
1100 | } | |
1101 | for(Int_t i=0;i<fNSector;i++){ | |
1102 | fprintf(f," fSectorLow[%d] = %d;\n",i,fSectorLow[i]); | |
1103 | } | |
5923e698 | 1104 | |
3e87ef69 | 1105 | //Patches also dont really belong to the aliroot settings (but nevermind) |
1106 | for(Int_t i=0;i<fNPatches;i++){ | |
1107 | fprintf(f," fNRows[%d] = %d;\n",i,fNRows[i]); | |
1108 | } | |
1109 | for(Int_t i=0;i<fNPatches;i++){ | |
1110 | fprintf(f," fRows[%d][0] = %d;\n",i,fRows[i][0]); | |
1111 | fprintf(f," fRows[%d][1] = %d;\n",i,fRows[i][1]); | |
1112 | } | |
1113 | ||
1114 | //Rotation shift is an addon, too | |
1115 | for(Int_t i=0;i<fNSlice;i++){ | |
1116 | Float_t cs = cos( (2*fPi/18) * (i+fNRotShift) ); | |
1117 | fprintf(f," fCos[%d] = %.10f;\n",i,cs); | |
5923e698 | 1118 | } |
3e87ef69 | 1119 | for(Int_t i=0;i<fNSlice;i++){ |
1120 | Float_t sn = sin( (2*fPi/18) * (i+fNRotShift) ); | |
1121 | fprintf(f," fSin[%d] = %.10f;\n",i,sn); | |
5923e698 | 1122 | } |
3e87ef69 | 1123 | |
5923e698 | 1124 | fprintf(f,"}\n"); |
1125 | fclose(f); | |
2220326f | 1126 | |
3e87ef69 | 1127 | LOG(AliL3Log::kInformational,"AliL3Transform::SaveInitFile","File created") |
1128 | <<"Init file \""<<filenamepath<<"\" created"<<ENDLOG; | |
1129 | ||
2220326f | 1130 | return kTRUE; |
3e87ef69 | 1131 | } |
1132 | ||
1133 | Int_t AliL3Transform::GetNPads(Int_t row) | |
1134 | { | |
1135 | if(row < 0 || row >= fNRow) | |
1136 | { | |
1137 | LOG(AliL3Log::kError,"AliL3Transform::GetNPads","Row") | |
1138 | <<AliL3Log::kDec<<"Wrong row "<<row<<ENDLOG; | |
1139 | return 0; | |
1140 | } | |
1141 | ||
1142 | return fNPads[row]; | |
5923e698 | 1143 | } |
1144 | ||
e376e129 | 1145 | Int_t AliL3Transform::GetFirstRow(Int_t patch) |
1146 | { | |
1147 | if(patch==-1) | |
1148 | return 0; | |
1149 | else if(patch < -1 || patch >= 6) | |
1150 | { | |
3e87ef69 | 1151 | LOG(AliL3Log::kError,"AliL3Transform::GetFirstRow","Patch") |
1152 | <<AliL3Log::kDec<<"Wrong patch "<<patch<<ENDLOG; | |
e376e129 | 1153 | return 0; |
1154 | } | |
1155 | else | |
1156 | return fRows[patch][0]; | |
1157 | } | |
1158 | ||
1159 | Int_t AliL3Transform::GetLastRow(Int_t patch) | |
1160 | { | |
1161 | if(patch==-1) | |
1162 | return fRows[5][1]; | |
1163 | else if(patch < -1 || patch >= 6) | |
1164 | { | |
3e87ef69 | 1165 | LOG(AliL3Log::kError,"AliL3Transform::GetLastRow","Patch") |
1166 | <<AliL3Log::kDec<<"Wrong patch "<<patch<<ENDLOG; | |
e376e129 | 1167 | return 0; |
1168 | } | |
1169 | else | |
1170 | return fRows[patch][1]; | |
1171 | } | |
1172 | ||
1173 | Int_t AliL3Transform::GetNRows(Int_t patch) | |
1174 | { | |
1175 | if(patch==-1) | |
1176 | return fNRow; | |
1177 | else if(patch < -1 || patch >= 6) | |
1178 | { | |
3e87ef69 | 1179 | LOG(AliL3Log::kError,"AliL3Transform::GetNRows","Patch") |
1180 | <<AliL3Log::kDec<<"Wrong patch "<<patch<<ENDLOG; | |
e376e129 | 1181 | return 0; |
1182 | } | |
1183 | else | |
1184 | return fNRows[patch]; | |
1185 | } | |
1186 | ||
3e87ef69 | 1187 | Int_t AliL3Transform::GetPadRow(Float_t xvalue) |
5923e698 | 1188 | { |
3e87ef69 | 1189 | //Find the padrow number corresponding to cartesian _local_ x value |
1190 | ||
1191 | if(xvalue < 0 || xvalue > 250) | |
1192 | { | |
1193 | LOG(AliL3Log::kError,"AliL3Transform::GetPadRow","X-value") | |
1194 | <<AliL3Log::kDec<<"Suspicious x-value, make sure it is in local coordinate! " | |
1195 | <<xvalue<<ENDLOG; | |
1196 | return -1; | |
1197 | } | |
1198 | ||
1199 | Int_t x = (Int_t)rint(xvalue*10); | |
1200 | if(x < (Int_t)rint(fX[1]*10)) | |
5923e698 | 1201 | return 0; |
3e87ef69 | 1202 | else if(x > (Int_t)rint(fX[fNRow-2]*10)) |
1203 | return fNRow-1; | |
1204 | else | |
1205 | { | |
1206 | Int_t padrow=1; //Of course, a more clever algorithm could help here | |
1207 | while(padrow < fNRow-2) | |
1208 | { | |
1209 | if(x > (Int_t)rint(fX[padrow-1]*10) && x < (Int_t)rint(fX[padrow+1]*10)) | |
1210 | break; | |
1211 | padrow++; | |
1212 | } | |
1213 | return padrow; | |
1214 | } | |
1215 | } | |
1216 | ||
1217 | Int_t AliL3Transform::GetPatch(Int_t padrow) | |
1218 | { | |
1219 | if(padrow < 0 || padrow >= fNRow) | |
1220 | { | |
1221 | LOG(AliL3Log::kError,"AliL3Transform::GetPatch","Padrow") | |
1222 | <<AliL3Log::kDec<<"Wrong padrow "<<padrow<<ENDLOG; | |
1223 | return -2; | |
1224 | } | |
1225 | Int_t patch=0; | |
1226 | while(patch < fNPatches) | |
1227 | { | |
1228 | if(padrow >= fRows[patch][0] && padrow <= fRows[patch][1]) | |
1229 | break; | |
1230 | patch++; | |
1231 | } | |
1232 | return patch; | |
1233 | } | |
1234 | ||
1235 | Double_t AliL3Transform::GetPadLength(Int_t padrow) | |
1236 | { | |
1237 | if(padrow >= fNRow){ | |
1238 | LOG(AliL3Log::kError,"AliL3Transform::GetPadLength","Padrow") | |
1239 | <<AliL3Log::kDec<<"Wrong padrow "<<padrow<<ENDLOG; | |
1240 | return 0; | |
1241 | } | |
1242 | ||
5923e698 | 1243 | if(padrow < fNRowLow) |
1244 | return fInnerPadLength; | |
1245 | if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1) | |
1246 | return fOuter1PadLength; | |
1247 | if(padrow >= fNRowLow + fNRowUp1 - 1) | |
1248 | return fOuter2PadLength; | |
5e0f9911 | 1249 | |
3e87ef69 | 1250 | //should never happen |
1251 | LOG(AliL3Log::kError,"AliL3Transform::GetPadLength","Padrow") | |
1252 | <<AliL3Log::kDec<<"Wrong padrow "<<padrow<<ENDLOG; | |
1253 | return -1.0; | |
1254 | } | |
1255 | ||
1256 | Double_t AliL3Transform::GetPadPitchWidth(Int_t patch) | |
1257 | { | |
1258 | if(patch < 0 || patch > fNPatches) | |
1259 | { | |
1260 | LOG(AliL3Log::kError,"AliL3Transform::GetPadPitchWidth","patct") | |
1261 | <<AliL3Log::kDec<<"Wrong patch "<<patch<<ENDLOG; | |
1262 | return -1; | |
1263 | } | |
1264 | return patch < 2 ? fPadPitchWidthLow : fPadPitchWidthUp; | |
1265 | } | |
1266 | ||
1267 | Double_t AliL3Transform::GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle) | |
1268 | { | |
1269 | //Calculate the expected transverse cluster width as a function of | |
1270 | //drift distance and crossing angle. | |
1271 | //z = local z-coordinate of cluster | |
1272 | //angle = track crossing angle with normal to padrow plane | |
1273 | //return value = sigma^2 (cartesian coordinates) | |
1274 | ||
1275 | Double_t drift; | |
1276 | if(z > 0) | |
1277 | drift = fZLength - z; | |
1278 | else | |
1279 | drift = fZLength + z; | |
1280 | ||
1281 | Double_t t1 = GetPRFSigma(padrow)*GetPRFSigma(padrow); | |
1282 | Double_t t2 = fDiffT*fDiffT*drift; | |
1283 | Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tan(angle)*tan(angle)/12; | |
1284 | Double_t t4 = fAnodeWireSpacing*fAnodeWireSpacing*(tan(angle) - fOmegaTau)*(tan(angle) - fOmegaTau)/12; | |
1285 | ||
1286 | return (t1 + t2 + t3 + t4); | |
1287 | } | |
1288 | ||
1289 | Double_t AliL3Transform::GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl) | |
1290 | { | |
1291 | //Calculate the expected longitudinal cluster width as a function of | |
1292 | //drift distance and track crossing angle. | |
1293 | //z = local z-coordinate of cluster | |
1294 | //tgl = tan(dipangle) | |
1295 | //return value = sigma^2 (cartesian coordinates) | |
1296 | ||
1297 | Double_t drift; | |
1298 | if(z > 0) | |
1299 | drift = AliL3Transform::GetZLength() - z; | |
1300 | else | |
1301 | drift = AliL3Transform::GetZLength() + z; | |
1302 | ||
1303 | Double_t t1 = fZSigma*fZSigma; | |
1304 | Double_t t2 = fDiffL*fDiffL*drift; | |
1305 | Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tgl*tgl/12; | |
1306 | ||
1307 | return (t1 + t2 + t3); | |
5923e698 | 1308 | } |
1309 | ||
5e0f9911 | 1310 | Double_t AliL3Transform::GetPRFSigma(Int_t padrow) |
5923e698 | 1311 | { |
3e87ef69 | 1312 | if(padrow >= fNRow){ |
1313 | LOG(AliL3Log::kError,"AliL3Transform::GetPRFSigma","Padrow") | |
1314 | <<AliL3Log::kDec<<"Wrong padrow "<<padrow<<ENDLOG; | |
5923e698 | 1315 | return 0; |
3e87ef69 | 1316 | } |
5923e698 | 1317 | if(padrow < fNRowLow) |
1318 | return fInnerPRFSigma; | |
1319 | if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1) | |
1320 | return fOuter1PRFSigma; | |
1321 | if(padrow >= fNRowLow + fNRowUp1 - 1) | |
1322 | return fOuter2PRFSigma; | |
5e0f9911 | 1323 | |
3e87ef69 | 1324 | //should never happen |
1325 | LOG(AliL3Log::kError,"AliL3Transform::GetPRFSigma","Padrow") | |
1326 | <<AliL3Log::kDec<<"Wrong padrow "<<padrow<<ENDLOG; | |
1327 | return -1.; | |
a4e75a99 | 1328 | } |
1329 | ||
108615fc | 1330 | Double_t AliL3Transform::GetEta(Float_t *xyz) |
1331 | { | |
1332 | Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]); | |
1333 | Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2])); | |
1334 | return eta; | |
1335 | } | |
1336 | ||
740da2a6 | 1337 | void AliL3Transform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz) |
1338 | { | |
1339 | rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]); | |
1340 | rpe[1] = atan2(xyz[1],xyz[0]); | |
1341 | rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2])); | |
1342 | } | |
1343 | ||
3ac82106 | 1344 | Double_t AliL3Transform::GetEta(Int_t slice,Int_t padrow,Int_t pad,Int_t time) |
bd7e82e0 | 1345 | { |
1346 | Float_t xyz[3]; | |
3a1c3849 | 1347 | Int_t sector,row; |
3ac82106 | 1348 | Slice2Sector(slice,padrow,sector,row); |
3a1c3849 | 1349 | Raw2Local(xyz,sector,row,pad,time); |
bd7e82e0 | 1350 | |
1351 | return GetEta(xyz); | |
1352 | } | |
1353 | ||
108615fc | 1354 | Double_t AliL3Transform::GetPhi(Float_t *xyz) |
1355 | { | |
108615fc | 1356 | Double_t phi = atan2(xyz[1],xyz[0]); |
108615fc | 1357 | return phi; |
1358 | } | |
1359 | ||
494fad94 | 1360 | Bool_t AliL3Transform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row) |
1361 | { | |
3e87ef69 | 1362 | if(slicerow<0&&slicerow>=fNRow){ |
1363 | LOG(AliL3Log::kError,"AliL3Transform::Slice2Sector","Slicerow") | |
1364 | <<AliL3Log::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG; | |
1365 | return kFALSE; | |
1366 | } | |
1367 | if(slice<0||slice>=fNSlice){ | |
1368 | LOG(AliL3Log::kError,"AliL3Transform::Slice2Sector","Slice") | |
1369 | <<AliL3Log::kDec<<"Wrong slice "<<slice<<ENDLOG; | |
1370 | return kFALSE; | |
1371 | } | |
108615fc | 1372 | |
1373 | if(slicerow<fNRowLow){ | |
3e87ef69 | 1374 | sector = fSlice2Sector[slice][0]; |
108615fc | 1375 | row = slicerow; |
1376 | } | |
1377 | else { | |
3e87ef69 | 1378 | sector = fSlice2Sector[slice][1]; |
108615fc | 1379 | row = slicerow-fNRowLow; |
1380 | } | |
3e87ef69 | 1381 | |
108615fc | 1382 | return kTRUE; |
1383 | } | |
1384 | ||
494fad94 | 1385 | Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t sector) |
1386 | { | |
3e87ef69 | 1387 | if(sector<0||sector>=fNSector){ |
1388 | LOG(AliL3Log::kError,"AliL3Transform::Sector2Slice","Sector") | |
1389 | <<AliL3Log::kDec<<"Wrong sector "<<sector<<ENDLOG; | |
1390 | return kFALSE; | |
1391 | } | |
1392 | ||
1393 | slice=fSector2Slice[sector]; | |
1394 | ||
108615fc | 1395 | return kTRUE; |
1396 | } | |
1397 | ||
3e87ef69 | 1398 | Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t & slicerow, Int_t sector, Int_t row) |
494fad94 | 1399 | { |
3e87ef69 | 1400 | if(sector<0 || sector>=fNSector){ |
1401 | LOG(AliL3Log::kError,"AliL3Transform::Sector2Slice","Sector") | |
1402 | <<AliL3Log::kDec<<"Wrong sector "<<sector<<ENDLOG; | |
1403 | return kFALSE; | |
1404 | } | |
1405 | if(row<0){ | |
1406 | LOG(AliL3Log::kError,"AliL3Transform::Sector2Slice","Row") | |
1407 | <<AliL3Log::kDec<<"Wrong row "<<row<<ENDLOG; | |
1408 | return kFALSE; | |
1409 | } | |
1410 | ||
1411 | if(fSectorLow[sector]){ | |
1412 | if(row>=fNRowLow){ | |
1413 | LOG(AliL3Log::kError,"AliL3Transform::Sector2Slice","Row") | |
1414 | <<AliL3Log::kDec<<"Wrong row "<<row<<ENDLOG; | |
1415 | return kFALSE; | |
1416 | } | |
1417 | slice = fSector2Slice[sector]; | |
108615fc | 1418 | slicerow = row; |
1419 | } | |
1420 | else{ | |
3e87ef69 | 1421 | if(row>=fNRowUp){ |
1422 | LOG(AliL3Log::kError,"AliL3Transform::Sector2Slice","Row") | |
1423 | <<AliL3Log::kDec<<"Wrong row "<<row<<ENDLOG; | |
1424 | return kFALSE; | |
1425 | } | |
1426 | slice = fSector2Slice[sector]; | |
108615fc | 1427 | slicerow = row + fNRowLow; |
1428 | } | |
3e87ef69 | 1429 | |
108615fc | 1430 | return kTRUE; |
1431 | } | |
1432 | ||
1433 | Double_t AliL3Transform::Row2X(Int_t slicerow){ | |
3e87ef69 | 1434 | if(slicerow<0||slicerow>=fNRow){ |
1435 | LOG(AliL3Log::kError,"AliL3Transform::Row2X","Slicerow") | |
1436 | <<AliL3Log::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG; | |
1437 | return 0; | |
1438 | } | |
108615fc | 1439 | return fX[slicerow]; |
1440 | } | |
1441 | ||
1442 | void AliL3Transform::Local2Global(Float_t *xyz,Int_t slice) | |
1443 | { | |
1444 | //Transformation to global coordinate system | |
1445 | Float_t x0 = xyz[0]; | |
1446 | Float_t y0 = xyz[1]; | |
3e87ef69 | 1447 | |
1448 | xyz[0]=x0*fCos[slice]-y0*fSin[slice]; | |
1449 | xyz[1]=x0*fSin[slice]+y0*fCos[slice]; | |
108615fc | 1450 | xyz[2]=xyz[2];//global z=local z |
1451 | } | |
1452 | ||
1453 | void AliL3Transform::Local2GlobalAngle(Float_t *angle,Int_t slice){ | |
740da2a6 | 1454 | angle[0] = fmod(angle[0]+(slice+fNRotShift)*(2*fPi/18),2*fPi); |
108615fc | 1455 | } |
1456 | ||
1457 | void AliL3Transform::Global2LocalAngle(Float_t *angle,Int_t slice){ | |
740da2a6 | 1458 | angle[0] = angle[0]-(slice+fNRotShift)*(2*fPi/18); |
108615fc | 1459 | if(angle[0]<0) angle[0]+=2*fPi; |
1460 | } | |
1461 | ||
1462 | void AliL3Transform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time) | |
1463 | { | |
1464 | //Transformation from rawdata to local coordinate system | |
1465 | ||
1466 | Int_t slice,slicerow; | |
1467 | Sector2Slice(slice, slicerow, sector, row); | |
1468 | ||
740da2a6 | 1469 | //X-Value |
108615fc | 1470 | xyz[0]=Row2X(slicerow); |
740da2a6 | 1471 | |
1472 | //Y-Value | |
108615fc | 1473 | Int_t npads= fNPads[slicerow]; |
3e87ef69 | 1474 | |
1475 | if(fSectorLow[sector]) | |
108615fc | 1476 | xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthLow; |
1477 | else | |
1478 | xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthUp; | |
740da2a6 | 1479 | |
1480 | //Z-Value (remember PULSA Delay) | |
1481 | //xyz[2]=fZWidth*time-3.*fZSigma; | |
1482 | xyz[2]=fZWidth*time-fZOffset; | |
0e0b1e59 | 1483 | if(slice < 18) |
740da2a6 | 1484 | xyz[2]=fZLength-xyz[2]; |
0e0b1e59 | 1485 | else |
740da2a6 | 1486 | xyz[2]=xyz[2]-fZLength; |
108615fc | 1487 | } |
1488 | ||
1489 | void AliL3Transform::Local2Global(Float_t *xyz,Int_t sector,Int_t row) | |
1490 | { | |
1491 | //Transformation to global coordinate system | |
1492 | Int_t slice,slicerow; | |
1493 | Sector2Slice(slice, slicerow, sector, row); | |
3e87ef69 | 1494 | Float_t r=Row2X(slicerow); //have to get x value first |
1495 | ||
1496 | xyz[0]=r*fCos[slice]-xyz[1]*fSin[slice]; | |
1497 | xyz[1]=r*fSin[slice]+xyz[1]*fCos[slice]; | |
108615fc | 1498 | xyz[2]=xyz[2];//global z=local z |
1499 | } | |
1500 | ||
1501 | Double_t AliL3Transform::GetMaxY(Int_t slicerow) | |
1502 | { | |
494fad94 | 1503 | |
108615fc | 1504 | if(slicerow < fNRowLow) |
1505 | return fPadPitchWidthLow*fNPads[slicerow]/2; | |
1506 | ||
1507 | else | |
1508 | return fPadPitchWidthUp*fNPads[slicerow]/2; | |
494fad94 | 1509 | |
108615fc | 1510 | } |
1511 | ||
2342214c | 1512 | void AliL3Transform::Global2Local(Float_t *xyz,Int_t sector,Bool_t isSlice) |
108615fc | 1513 | { |
1514 | Int_t slice; | |
2342214c | 1515 | if(!isSlice) |
1516 | Sector2Slice(slice, sector); | |
1517 | else | |
1518 | slice = sector; | |
3e87ef69 | 1519 | |
1520 | Float_t x1 = xyz[0]*fCos[slice] + xyz[1]*fSin[slice]; | |
1521 | Float_t y1 = -xyz[0]*fSin[slice] + xyz[1]*fCos[slice]; | |
108615fc | 1522 | xyz[0] = x1; |
1523 | xyz[1] = y1; | |
1524 | } | |
1525 | ||
1526 | void AliL3Transform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time) | |
1527 | { | |
1528 | //Transformation from raw to global coordinates | |
1529 | ||
1530 | Raw2Local(xyz,sector,row,pad,time); | |
1531 | Local2Global(xyz,sector,row); | |
1532 | } | |
1533 | ||
1534 | void AliL3Transform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row) | |
1535 | { | |
1536 | //Transformation from local coordinates to raw | |
494fad94 | 1537 | |
108615fc | 1538 | Int_t slice,slicerow; |
1539 | Sector2Slice(slice, slicerow, sector, row); | |
1540 | ||
3e87ef69 | 1541 | xyz[0]=slicerow; |
1542 | //xyz[0]=GetPadRow(xyz[0]); | |
1543 | ||
1544 | if(fSectorLow[sector]) | |
108615fc | 1545 | xyz[1]=xyz[1]/fPadPitchWidthLow+0.5*(fNPads[slicerow]-1); |
1546 | else | |
1547 | xyz[1]=xyz[1]/fPadPitchWidthUp+0.5*(fNPads[slicerow]-1); | |
3e87ef69 | 1548 | |
108615fc | 1549 | Int_t sign=-1; |
0f377556 | 1550 | if(slice < 18) sign = 1; |
1727f1c9 | 1551 | xyz[2]=fZLength-sign*xyz[2]; |
1552 | xyz[2]=(xyz[2]+fZOffset)/fZWidth; | |
108615fc | 1553 | } |
1554 | ||
1555 | void AliL3Transform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row) | |
1556 | { | |
1557 | //Transformation from global coordinates to raw. | |
1558 | ||
1559 | Global2Local(xyz,sector); | |
1560 | Local2Raw(xyz,sector,row); | |
3e87ef69 | 1561 | } |
1562 | ||
1563 | void AliL3Transform::PrintCompileOptions() | |
1564 | { | |
1565 | cout << "Compiler (g++) version used: " << GCCVERSION << endl; | |
1566 | ||
1567 | #ifdef no_root | |
1568 | cout << "STANDALONE version: -Dno_root was given." << endl; | |
1569 | #else | |
1570 | const Char_t *roottest="$ROOTSYS/bin/root -n -b -q | grep Version | cut -b 17-25 | cut -d\" \" -f1"; | |
1571 | #ifdef use_aliroot | |
1572 | #ifdef use_cvs | |
1573 | const Char_t *aliroottest="if test -n \"`cd $ALICE_ROOT/STEER/ && cvs stat AliRun.cxx | grep \"Sticky Tag\" | grep none`\"; then echo HEAD; else cd $ALICE_ROOT/STEER/ && cvs stat AliRun.cxx | grep \"Sticky Tag\" | cut -b 18- | cut -d\" \" -f1; fi"; | |
1574 | #else | |
1575 | const Char_t *aliroottest="Unknown"; | |
1576 | #endif | |
1577 | cout << "ALIROOT version: -Duse_aliroot and -Duse_root was given." << endl; | |
1578 | cout << "Root Version: " << ROOTVERSION << " found " << flush; | |
1579 | gSystem->Exec(roottest); | |
1580 | ||
1581 | cout << "AliRoot Version: " << ALIROOTVERSION << " found " << flush; | |
1582 | gSystem->Exec(aliroottest); | |
1583 | #else | |
1584 | cout << "ROOT version: -Duse_root was given." << endl; | |
1585 | cout << "Root Version: " << ROOTVERSION << " found " << flush; | |
1586 | gSystem->Exec(roottest); | |
1587 | #endif | |
1588 | #endif | |
1589 | ||
1590 | #ifdef do_mc | |
1591 | cout << "Using Monte Carlo Info: -Ddo_mc was given." << endl; | |
1592 | #else | |
1593 | cout << "NOT using Monte Carlo Info: -Ddo_mc was not given." << endl; | |
1594 | #endif | |
108615fc | 1595 | |
3e87ef69 | 1596 | #ifdef use_logging |
1597 | cout << "Using logging classes (MLUC): -Duse_logging was given." << endl; | |
1598 | #else | |
1599 | cout << "NOT using logging classes (MLUC): -Duse_logging not was given." << endl; | |
1600 | #endif | |
108615fc | 1601 | } |