Adding the AliRunTagCuts class in the repository.
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTransform.cxx
CommitLineData
a6c02c85 1// @(#) $Id$
c2f37813 2// Original: AliL3Transform.cxx,v 1.53 2005/06/14 10:55:21 cvetan
a6c02c85 3
4// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>, Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
5//*-- Copyright &copy ALICE HLT Group
6
7
a6c02c85 8#include "dirent.h"
9
10#ifdef use_aliroot
11#include <AliRun.h>
12#include <AliMagF.h>
13#include <AliTPCParamSR.h>
14#include <AliTPCPRF2D.h>
15#include <AliTPCRF1D.h>
16#endif
17#ifdef use_root
18#include <TFile.h>
19#include <TUnixSystem.h>
20#include <TTimeStamp.h>
21#include <TError.h>
22#endif
23
24#include "AliHLTTPCLogging.h"
25#include "AliHLTTPCTransform.h"
26
27#if defined(__GNUC__) && __GNUC__ >= 3
28using namespace std;
29#endif
30
31/** \class AliHLTTPCTransform
32<pre>
33//_____________________________________________________________
34// AliHLTTPCTransform
35//
36// Transformation class for ALICE TPC.
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
42// to be instantiated. Function calls should then be done like, e.g.:
43//
44// Double_t eta = AliHLTTPCTransform::GetEta(xyz);
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// AliHLTTPCTransform::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
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//
60// AliHLTTPCTransform::Init(path,kTRUE);
61//
62// where path is a char*
63// either providing the rootfile name containing the geometry or
64// the path to the rootfile which should then be called alirunfile.root.
65// Note that for both of these cases you have to
66// compile with USEPACKAGE=ALIROOT set (see level3code/Makefile.conf).
67//
68// Currently, there are 4 versions of the Transformer:
69// fVersion==kValiroot: ALIROOT-head compatible
70// fVersion==kVcosmics: Cosmics data run (2003) compatible
71// fVersion==kVdefault: means no config file has been loaded
72// fVersion==kVdeprecated: dont use old (before July 2003) style of transformer
73//
74</pre>
75*/
76
77ClassImp(AliHLTTPCTransform)
78
79const Double_t AliHLTTPCTransform::fgkAnodeWireSpacing = 0.25; //Taken from the TDR
80const Double_t AliHLTTPCTransform::fgkBFACT = 0.0029980; //Conversion Factor
81const Double_t AliHLTTPCTransform::fgkPi = 3.141592653589793;
82const Double_t AliHLTTPCTransform::fgk2Pi = 2*3.141592653589793;
83const Double_t AliHLTTPCTransform::fgkPi2 = 0.5*3.141592653589793;
84const Double_t AliHLTTPCTransform::fgkToDeg = 180/3.141592653589793;
85
86//Defined by HLT and GSI
87Int_t AliHLTTPCTransform::fgNPatches = 6;
88#if 0
89// Old format, corresponding to IntegrTest-5 code and data
90Int_t AliHLTTPCTransform::fgRows[6][2] = {{0,29},{30,62},{63,90},{91,116},{117,139},{140,158}};
91Int_t AliHLTTPCTransform::fgNRows[6] = {30,33,28,26,23,19};
92#else
93// New data corresponding to simulated raw data 2004-08-20, provided by Thomas Kuhr
94Int_t AliHLTTPCTransform::fgRows[6][2] = {{0,30},{30,62},{63,90},{90,116},{117,139},{139,158}};
95Int_t AliHLTTPCTransform::fgNRows[6] = {31,33,28,27,23,20};
96#endif
97
98// The following definition is generated by MakeInitFile function
99Double_t AliHLTTPCTransform::fgBField = 0.2;
100Double_t AliHLTTPCTransform::fgSolenoidBField = 2;
101Double_t AliHLTTPCTransform::fgBFieldFactor = 1;
102Int_t AliHLTTPCTransform::fgVersion = kVdefault;
103Int_t AliHLTTPCTransform::fgNTimeBins = 446;
104Int_t AliHLTTPCTransform::fgNRowLow = 63;
105Int_t AliHLTTPCTransform::fgNRowUp = 96;
106Int_t AliHLTTPCTransform::fgNRowUp1 = 64;
107Int_t AliHLTTPCTransform::fgNRowUp2 = 32;
108Int_t AliHLTTPCTransform::fgNSectorLow = 36;
109Int_t AliHLTTPCTransform::fgNSectorUp = 36;
110Int_t AliHLTTPCTransform::fgNSector = 72;
111Double_t AliHLTTPCTransform::fgPadPitchWidthLow = 0.4;
112Double_t AliHLTTPCTransform::fgPadPitchWidthUp = 0.6;
113Double_t AliHLTTPCTransform::fgZWidth = 0.5660;
114Double_t AliHLTTPCTransform::fgZSigma = 0.2288;
115Double_t AliHLTTPCTransform::fgZLength = 250.0000;
116Double_t AliHLTTPCTransform::fgZOffset = 0.6864;
117Double_t AliHLTTPCTransform::fgDiffT = 0.0220;
118Double_t AliHLTTPCTransform::fgDiffL = 0.0220;
119Double_t AliHLTTPCTransform::fgOmegaTau = 0.1450;
120Double_t AliHLTTPCTransform::fgInnerPadLength = 0.75;
121Double_t AliHLTTPCTransform::fgOuter1PadLength = 1.00;
122Double_t AliHLTTPCTransform::fgOuter2PadLength = 1.50;
123Double_t AliHLTTPCTransform::fgInnerPRFSigma = 0.203811;
124Double_t AliHLTTPCTransform::fgOuter1PRFSigma = 0.299325;
125Double_t AliHLTTPCTransform::fgOuter2PRFSigma = 0.299323;
126Double_t AliHLTTPCTransform::fgTimeSigma = 0.228809;
127Int_t AliHLTTPCTransform::fgADCSat = 1024;
128Int_t AliHLTTPCTransform::fgZeroSup = 0;
129Int_t AliHLTTPCTransform::fgNSlice = 36;
130Int_t AliHLTTPCTransform::fgNRow = 159;
131Double_t AliHLTTPCTransform::fgNRotShift = 0.5;
132Int_t AliHLTTPCTransform::fgSlice2Sector[36][2] = { { 0, 36},
133 { 1, 37},
134 { 2, 38},
135 { 3, 39},
136 { 4, 40},
137 { 5, 41},
138 { 6, 42},
139 { 7, 43},
140 { 8, 44},
141 { 9, 45},
142 {10, 46},
143 {11, 47},
144 {12, 48},
145 {13, 49},
146 {14, 50},
147 {15, 51},
148 {16, 52},
149 {17, 53},
150 {18, 54},
151 {19, 55},
152 {20, 56},
153 {21, 57},
154 {22, 58},
155 {23, 59},
156 {24, 60},
157 {25, 61},
158 {26, 62},
159 {27, 63},
160 {28, 64},
161 {29, 65},
162 {30, 66},
163 {31, 67},
164 {32, 68},
165 {33, 69},
166 {34, 70},
167 {35, 71}
168};
169
170Int_t AliHLTTPCTransform::fgSector2Slice[72] = { 0,
171 1,
172 2,
173 3,
174 4,
175 5,
176 6,
177 7,
178 8,
179 9,
180 10,
181 11,
182 12,
183 13,
184 14,
185 15,
186 16,
187 17,
188 18,
189 19,
190 20,
191 21,
192 22,
193 23,
194 24,
195 25,
196 26,
197 27,
198 28,
199 29,
200 30,
201 31,
202 32,
203 33,
204 34,
205 35,
206 0,
207 1,
208 2,
209 3,
210 4,
211 5,
212 6,
213 7,
214 8,
215 9,
216 10,
217 11,
218 12,
219 13,
220 14,
221 15,
222 16,
223 17,
224 18,
225 19,
226 20,
227 21,
228 22,
229 23,
230 24,
231 25,
232 26,
233 27,
234 28,
235 29,
236 30,
237 31,
238 32,
239 33,
240 34,
241 35
242};
243
244Int_t AliHLTTPCTransform::fgSectorLow[72] = { 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 1,
273 1,
274 1,
275 1,
276 1,
277 1,
278 1,
279 1,
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 0,
309 0,
310 0,
311 0,
312 0,
313 0,
314 0,
315 0
316};
317
318Double_t AliHLTTPCTransform::fgX[159] = { 85.195,
319 85.945,
320 86.695,
321 87.445,
322 88.195,
323 88.945,
324 89.695,
325 90.445,
326 91.195,
327 91.945,
328 92.695,
329 93.445,
330 94.195,
331 94.945,
332 95.695,
333 96.445,
334 97.195,
335 97.945,
336 98.695,
337 99.445,
338 100.195,
339 100.945,
340 101.695,
341 102.445,
342 103.195,
343 103.945,
344 104.695,
345 105.445,
346 106.195,
347 106.945,
348 107.695,
349 108.445,
350 109.195,
351 109.945,
352 110.695,
353 111.445,
354 112.195,
355 112.945,
356 113.695,
357 114.445,
358 115.195,
359 115.945,
360 116.695,
361 117.445,
362 118.195,
363 118.945,
364 119.695,
365 120.445,
366 121.195,
367 121.945,
368 122.695,
369 123.445,
370 124.195,
371 124.945,
372 125.695,
373 126.445,
374 127.195,
375 127.945,
376 128.695,
377 129.445,
378 130.195,
379 130.945,
380 131.695,
381 135.180,
382 136.180,
383 137.180,
384 138.180,
385 139.180,
386 140.180,
387 141.180,
388 142.180,
389 143.180,
390 144.180,
391 145.180,
392 146.180,
393 147.180,
394 148.180,
395 149.180,
396 150.180,
397 151.180,
398 152.180,
399 153.180,
400 154.180,
401 155.180,
402 156.180,
403 157.180,
404 158.180,
405 159.180,
406 160.180,
407 161.180,
408 162.180,
409 163.180,
410 164.180,
411 165.180,
412 166.180,
413 167.180,
414 168.180,
415 169.180,
416 170.180,
417 171.180,
418 172.180,
419 173.180,
420 174.180,
421 175.180,
422 176.180,
423 177.180,
424 178.180,
425 179.180,
426 180.180,
427 181.180,
428 182.180,
429 183.180,
430 184.180,
431 185.180,
432 186.180,
433 187.180,
434 188.180,
435 189.180,
436 190.180,
437 191.180,
438 192.180,
439 193.180,
440 194.180,
441 195.180,
442 196.180,
443 197.180,
444 198.180,
445 199.430,
446 200.930,
447 202.430,
448 203.930,
449 205.430,
450 206.930,
451 208.430,
452 209.930,
453 211.430,
454 212.930,
455 214.430,
456 215.930,
457 217.430,
458 218.930,
459 220.430,
460 221.930,
461 223.430,
462 224.930,
463 226.430,
464 227.930,
465 229.430,
466 230.930,
467 232.430,
468 233.930,
469 235.430,
470 236.930,
471 238.430,
472 239.930,
473 241.430,
474 242.930,
475 244.430,
476 245.930
477};
478
479Int_t AliHLTTPCTransform::fgNPads[159] = {67,
480 67,
481 69,
482 69,
483 69,
484 71,
485 71,
486 71,
487 73,
488 73,
489 73,
490 75,
491 75,
492 75,
493 77,
494 77,
495 77,
496 79,
497 79,
498 79,
499 81,
500 81,
501 81,
502 83,
503 83,
504 83,
505 85,
506 85,
507 85,
508 87,
509 87,
510 87,
511 89,
512 89,
513 89,
514 91,
515 91,
516 91,
517 93,
518 93,
519 93,
520 95,
521 95,
522 95,
523 97,
524 97,
525 97,
526 99,
527 99,
528 99,
529 99,
530 101,
531 101,
532 101,
533 103,
534 103,
535 103,
536 105,
537 105,
538 105,
539 107,
540 107,
541 107,
542 73,
543 75,
544 75,
545 75,
546 75,
547 77,
548 77,
549 77,
550 79,
551 79,
552 79,
553 81,
554 81,
555 81,
556 81,
557 83,
558 83,
559 83,
560 85,
561 85,
562 85,
563 85,
564 87,
565 87,
566 87,
567 89,
568 89,
569 89,
570 91,
571 91,
572 91,
573 91,
574 93,
575 93,
576 93,
577 95,
578 95,
579 95,
580 95,
581 97,
582 97,
583 97,
584 99,
585 99,
586 99,
587 101,
588 101,
589 101,
590 101,
591 103,
592 103,
593 103,
594 105,
595 105,
596 105,
597 105,
598 107,
599 107,
600 107,
601 109,
602 109,
603 109,
604 111,
605 111,
606 111,
607 113,
608 113,
609 113,
610 115,
611 115,
612 117,
613 117,
614 119,
615 119,
616 121,
617 121,
618 121,
619 123,
620 123,
621 125,
622 125,
623 127,
624 127,
625 127,
626 129,
627 129,
628 131,
629 131,
630 133,
631 133,
632 135,
633 135,
634 135,
635 137,
636 137,
637 139
638};
639
640Double_t AliHLTTPCTransform::fgCos[36] = { 0.9848077297,
641 0.8660253882,
642 0.6427876353,
643 0.3420201540,
644 0.0000000000,
645 -0.3420201540,
646 -0.6427876353,
647 -0.8660253882,
648 -0.9848077297,
649 -0.9848077297,
650 -0.8660253882,
651 -0.6427876353,
652 -0.3420201540,
653 -0.0000000000,
654 0.3420201540,
655 0.6427876353,
656 0.8660253882,
657 0.9848077297,
658 0.9848077297,
659 0.8660253882,
660 0.6427876353,
661 0.3420201540,
662 0.0000000000,
663 -0.3420201540,
664 -0.6427876353,
665 -0.8660253882,
666 -0.9848077297,
667 -0.9848077297,
668 -0.8660253882,
669 -0.6427876353,
670 -0.3420201540,
671 -0.0000000000,
672 0.3420201540,
673 0.6427876353,
674 0.8660253882,
675 0.9848077297
676};
677
678Double_t AliHLTTPCTransform::fgSin[36] = { 0.1736481786,
679 0.5000000000,
680 0.7660444379,
681 0.9396926165,
682 1.0000000000,
683 0.9396926165,
684 0.7660444379,
685 0.5000000000,
686 0.1736481786,
687 -0.1736481786,
688 -0.5000000000,
689 -0.7660444379,
690 -0.9396926165,
691 -1.0000000000,
692 -0.9396926165,
693 -0.7660444379,
694 -0.5000000000,
695 -0.1736481786,
696 0.1736481786,
697 0.5000000000,
698 0.7660444379,
699 0.9396926165,
700 1.0000000000,
701 0.9396926165,
702 0.7660444379,
703 0.5000000000,
704 0.1736481786,
705 -0.1736481786,
706 -0.5000000000,
707 -0.7660444379,
708 -0.9396926165,
709 -1.0000000000,
710 -0.9396926165,
711 -0.7660444379,
712 -0.5000000000,
713 -0.1736481786
714};
715
716#ifdef use_aliroot
717Bool_t AliHLTTPCTransform::Init(AliRunLoader *runLoader)
718{
719 //init with runloader
720 if(!runLoader) {
721 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCTransform::Init","RunLoader")
722 <<" Missing RunLoader! 0x0"<<ENDLOG;
723 return kFALSE;
724 }
725
726 if(fgVersion != kVdefault)
727 LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTransform::Init","Init values")
728 <<AliHLTTPCLog::kDec<<"You are initializing the parameters more than once; check your code please! "<<fgVersion<<ENDLOG;
729
730 TDirectory* savedir1 = gDirectory;
731 runLoader->CdGAFile();
732 AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get(GetParamName());
733 savedir1->cd();
734 if(!param)
735 {
736 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCTransform::Init","File")
737 <<"No TPC parameters found!"<<ENDLOG;
738 return kFALSE;
739 }
740
741 AliTPCPRF2D * prfinner = new AliTPCPRF2D;
742 AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
743 AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
744 AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
745 rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
746 rf->SetOffset(3*param->GetZSigma());
747 rf->Update();
748
749 TDirectory *savedir2=gDirectory;
750 TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
751 if (!prf_file->IsOpen())
752 {
753 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Init","File")
754 <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG;
755 return kFALSE;
756 }
757 prfinner ->Read("prf_07504_Gati_056068_d02");
758 prfouter1->Read("prf_10006_Gati_047051_d03");
759 prfouter2->Read("prf_15006_Gati_047051_d03");
760 prf_file->Close();
761 savedir2->cd();
762
763 param->SetInnerPRF(prfinner);
764 param->SetOuter1PRF(prfouter1);
765 param->SetOuter2PRF(prfouter2);
766 param->SetTimeRF(rf);
767
768 fgNTimeBins = param->GetMaxTBin()+1;
769 fgNRowLow = param->GetNRowLow();
770 fgNRowUp = param->GetNRowUp();
771 fgNRowUp1 = param->GetNRowUp1();
772 fgNRowUp2 = param->GetNRowUp2();
773 fgNRow= fgNRowLow + fgNRowUp;
774 if(fgNRow!=159){
775 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Init","fNRow")
776 <<"Number of rows have changed in ALIROOT"<<ENDLOG;
777 return kFALSE;
778 }
779
780 fgNSectorLow = param->GetNInnerSector();
781 fgNSectorUp = param->GetNOuterSector();
782 fgNSector = fgNSectorLow + fgNSectorUp;
783
784 //test whether they were changes to the rotation shift
785 fgNRotShift=0;
786 Float_t irotshift = param->GetInnerAngleShift(); //shift angle
787 Float_t orotshift = param->GetOuterAngleShift(); //shift angle
788 const Float_t kDegtoRad = 0.01745329251994;
789 Int_t shift1=TMath::Nint(irotshift/kDegtoRad);
790 Int_t shift2=TMath::Nint(orotshift/kDegtoRad+0.1);
791 if((shift1!=shift2) || (shift1!=10)){
792 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Init","Rotshiftangle")
793 <<"Rotation shift angle has changed in ALIROOT"<<ENDLOG;
794 return kFALSE;
795 } else {
796 fgNRotShift=0.5; //our version of the shift angle
797 }
798
799 fgVersion=kValiroot;
800 SetBFieldFactor((Double_t)runLoader->GetAliRun()->Field()->Factor());
cce3eda4 801 SetSolenoidBField(-
802 (Double_t)runLoader->GetAliRun()->Field()->SolenoidField()/
803 (Double_t)runLoader->GetAliRun()->Field()->Factor()
804 );
a6c02c85 805 fgPadPitchWidthLow=param->GetInnerPadPitchWidth();
806 fgPadPitchWidthUp=param->GetOuterPadPitchWidth();
807 fgZWidth=param->GetZWidth();
808 fgZSigma=param->GetZSigma();
809 fgZLength=param->GetZLength();
810 fgZOffset=param->GetZOffset();
811 fgDiffT=param->GetDiffT();
812 fgDiffL=param->GetDiffL();
813 fgOmegaTau=param->GetOmegaTau();
814 fgInnerPadLength=param->GetInnerPadLength();
815 fgOuter1PadLength=param->GetOuter1PadLength();
816 fgOuter2PadLength=param->GetOuter2PadLength();
817 fgInnerPRFSigma=param->GetInnerPRF()->GetSigmaX();
818 fgOuter1PRFSigma=param->GetOuter1PRF()->GetSigmaX();
819 fgOuter2PRFSigma=param->GetOuter2PRF()->GetSigmaX();
820 fgTimeSigma=param->GetTimeRF()->GetSigma();
821 fgADCSat=param->GetADCSat();
822 fgZeroSup=param->GetZeroSup();
823 fgNSlice=fgNSectorLow;
824
825 //now do the arrays
826 for(Int_t i=0;i<fgNRow;i++){
827 Int_t sec,row;
828 if( i < fgNRowLow){sec =0;row =i;}
829 else{sec = fgNSectorLow;row =i-fgNRowLow;}
830 fgX[i]=param->GetPadRowRadii(sec,row);
831 }
832 for(Int_t i=0;i<fgNRow;i++){
833 Int_t sec,row;
834 if( i < fgNRowLow){sec =0;row =i;}
835 else{sec = fgNSectorLow;row =i-fgNRowLow;}
836 fgNPads[i]=param->GetNPads(sec,row);
837 }
838 for(Int_t i=0;i<fgNSector;i++){
839 if(i<fgNSectorLow) fgSectorLow[i]=1;
840 else fgSectorLow[i]=0;
841 }
842
843 return kTRUE;
844
845 /* not needed
846 TTimeStamp time;
847 Char_t tmpfile[1024];
848 sprintf(tmpfile,"./l3transform.config-%d",(Int_t)time.GetSec());
849
850 return SaveInitFile(tmpfile);
851 */
852}
853#endif
854
855Bool_t AliHLTTPCTransform::Init(Char_t* path,Bool_t UseAliTPCParam)
856{
857 //Overwrite the parameters with values stored in file "l3transform.config" in path.
858 //If file does not exist, old default values will be used.
859 //If flag UseAliTPCParam is set, the parameters will be read from the the rootfile
860 //which then has to be called path/digitfile.root
861
862 if(fgVersion != kVdefault)
863 LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTransform::Init","Init values")
864 <<AliHLTTPCLog::kDec<<"You are initializing the parameters more than once; check your code please! "<<fgVersion<<ENDLOG;
865
866 if(UseAliTPCParam) //use rootfile to generate temporary init file
867 return ReadInit(path);
868
869 //create filename
870 Char_t pathname[1024];
871 strcpy(pathname,path);
872
873 //test whether provided path is the file itself
874 Int_t isdir = 0;
875 DIR *testdir=opendir(pathname);
876 if(testdir){
877 isdir=1;
878 closedir(testdir);
879 }
880
881 if(isdir) strcat(pathname,"/l3transform.config");
882
883 return ReadInitFile(pathname);
884}
885
886Bool_t AliHLTTPCTransform::ReadInitFile(Char_t* pathname)
887{
888 //read transformer settings from pathname
889 FILE *fptr=fopen(pathname,"r");
890 if(!fptr){
891 LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTransform::ReadInitFile","File Open")
892 <<"Pointer to Config File \""<<pathname<<"\" 0x0!"<<ENDLOG;
893 return kFALSE;
894 }
895
896 Char_t d1[250], d2[100], d3[100];
897 Int_t dummy=0;
898 Double_t ddummy=0.0;
899
900 while(!feof(fptr)) {
901 fscanf(fptr,"%s",d1);
902 if(strcmp(d1,"fVersion")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgVersion=dummy;}
903 else if(strcmp(d1,"fBFieldFactor")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgBFieldFactor=(Double_t)ddummy;}
904 else if(strcmp(d1,"fSolenoidBField")==0)
905 {
906 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);
907 fgSolenoidBField=(Double_t)ddummy;
908 }
909 else if(strcmp(d1,"fNTimeBins")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNTimeBins=(Int_t)dummy;}
910 else if(strcmp(d1,"fNRowLow")==0)
911 {
912 fscanf(fptr,"%s %d %s",d2,&dummy,d3);
913 fgNRowLow=(Int_t)dummy;
914 if(fgNRowLow != 63)
915 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::ReadInitFile","Overflow")
916 <<"Number of inner PadRows should be 63! Check and fgrep the code for 63 to see the consequences of this major change!"<<ENDLOG;
917 }
918 else if(strcmp(d1,"fNRowUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNRowUp=(Int_t)dummy;}
919 else if(strcmp(d1,"fNRowUp1")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNRowUp1=(Int_t)dummy;}
920 else if(strcmp(d1,"fNRowUp2")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNRowUp2=(Int_t)dummy;}
921 else if(strcmp(d1,"fNSectorLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNSectorLow=(Int_t)dummy;}
922 else if(strcmp(d1,"fNSectorUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNSectorUp=(Int_t)dummy;}
923 else if(strcmp(d1,"fNSector")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNSector=(Int_t)dummy;}
924 else if(strcmp(d1,"fPadPitchWidthLow")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgPadPitchWidthLow=(Double_t)ddummy;}
925 else if(strcmp(d1,"fPadPitchWidthUp")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgPadPitchWidthUp=(Double_t)ddummy;}
926 else if(strcmp(d1,"fZWidth")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgZWidth=(Double_t)ddummy;}
927 else if(strcmp(d1,"fZSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgZSigma=(Double_t)ddummy;}
928 else if(strcmp(d1,"fZLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgZLength=(Double_t)ddummy;}
929 else if(strcmp(d1,"fZOffset")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgZOffset=(Double_t)ddummy;}
930 else if(strcmp(d1,"fNSlice")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNSlice=(Int_t)dummy;}
931 else if(strcmp(d1,"fDiffT")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgDiffT=(Double_t)ddummy;}
932 else if(strcmp(d1,"fDiffL")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgDiffL=(Double_t)ddummy;}
933 else if(strcmp(d1,"fOmegaTau")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgOmegaTau=(Double_t)ddummy;}
934 else if(strcmp(d1,"fInnerPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgInnerPadLength=(Double_t)ddummy;}
935 else if(strcmp(d1,"fOuter1PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgOuter1PadLength=(Double_t)ddummy;}
936 else if(strcmp(d1,"fOuter2PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgOuter2PadLength=(Double_t)ddummy;}
937 else if(strcmp(d1,"fInnerPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgInnerPRFSigma=(Double_t)ddummy;}
938 else if(strcmp(d1,"fOuter1PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgOuter1PRFSigma=(Double_t)ddummy;}
939 else if(strcmp(d1,"fOuter2PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgOuter2PRFSigma=(Double_t)ddummy;}
940 else if(strcmp(d1,"fTimeSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgTimeSigma=(Double_t)ddummy;}
941 else if(strcmp(d1,"fADCSat")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgADCSat=(Int_t)dummy;}
942 else if(strcmp(d1,"fZeroSup")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgZeroSup=(Int_t)dummy;}
943 else if(strcmp(d1,"fNRow")==0){
944 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNRow=(Int_t)dummy;
945 if(fgNRow!=159){
946 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::ReadInitFile","Overflow")<<"Number of PadRows should be 159! Check and fgrep the code for 159 to see the consequences of this major change!"<<ENDLOG;
947 }
948 }
949 else if(strcmp(d1,"fNRotShift")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgNRotShift=(Double_t)ddummy;}
950 else if(strcmp(d1,"fX[0]")==0){
951 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgX[0]=(Double_t)ddummy;
952 for(Int_t i=1;i<fgNRow;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fgX[i]=(Double_t)ddummy;}
953 }
954 else if(strcmp(d1,"fNPads[0]")==0){
955 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNPads[0]=(Int_t)dummy;
956 for(Int_t i=1;i<fgNRow;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgNPads[i]=(Int_t)dummy;}
957 }
958 else if(strcmp(d1,"fNRows[0]")==0){
959 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgNRows[0]=(Int_t)dummy;
960 for(Int_t i=1;i<fgNPatches;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgNRows[i]=(Int_t)dummy;}
961 }
962 else if(strcmp(d1,"fRows[0][0]")==0){
963 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgRows[0][0]=(Int_t)dummy;
964 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgRows[0][1]=(Int_t)dummy;
965 for(Int_t i=1;i<fgNPatches;i++){
966 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgRows[i][0]=(Int_t)dummy;
967 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgRows[i][1]=(Int_t)dummy;
968 }
969 }
970 else if(strcmp(d1,"fSlice2Sector[0][0]")==0){
971 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgSlice2Sector[0][0]=(Int_t)dummy;
972 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgSlice2Sector[0][1]=(Int_t)dummy;
973 for(Int_t i=1;i<fgNSlice;i++){
974 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgSlice2Sector[i][0]=(Int_t)dummy;
975 fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgSlice2Sector[i][1]=(Int_t)dummy;
976 }
977 }
978 else if(strcmp(d1,"fSector2Slice[0]")==0){
979 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgSector2Slice[0]=(Int_t)dummy;
980 for(Int_t i=1;i<fgNSector;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgSector2Slice[i]=(Int_t)dummy;}
981 }
982 else if(strcmp(d1,"fSectorLow[0]")==0){
983 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fgSectorLow[0]=(Int_t)dummy;
984 for(Int_t i=1;i<fgNSector;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fgSectorLow[i]=(Int_t)dummy;}
985 }
986 else if(strcmp(d1,"fCos[0]")==0){
987 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgCos[0]=(Double_t)ddummy;
988 for(Int_t i=1;i<fgNSlice;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fgCos[i]=(Double_t)ddummy;}
989 }
990 else if(strcmp(d1,"fSin[0]")==0){
991 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fgSin[0]=(Double_t)ddummy;
992 for(Int_t i=1;i<fgNSlice;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fgSin[i]=(Double_t)ddummy;}
993 }
994 }
995 fclose(fptr);
996
997 //The first multiplier gives the scale factor used to modify the field map
998 //defined by the second multiplier.
999 fgBField=fgBFieldFactor*fgSolenoidBField*0.1;
1000
1001 //Test if new config file has been used.
1002 if(fgVersion==kVdeprecated){
1003 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::ReadInitFile","Version")
1004 <<"Version is deprecated, you have to create a new config file."<<ENDLOG;
1005 return kFALSE;
1006 }
1007
1008 LOG(AliHLTTPCLog::kInformational,"AliHLTTPCTransform::ReadInitFile","Config")
1009 <<"Successfully loaded values from config file \""<<pathname<<"\""<<ENDLOG;
1010
1011 return kTRUE;
1012}
1013
1014Bool_t AliHLTTPCTransform::ReadInit(Char_t *path)
1015{
1016 //Read all the parameters from a aliroot file, and store it in a temporary
1017 //file which is read by Init. Use this if you want to read the parameters from
1018 //the rootfile "every" time.
1019
1020#ifndef use_aliroot
1021 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::ReadInit","Version")
1022 <<"You have to compile with use_aliroot flag in order to read from AliROOT file"<<ENDLOG;
1023 return kFALSE;
1024#else
1025 Char_t filename[1024];
1026 //first test whether provided path is the rootfile itself
1027 Int_t saveErrIgLevel=gErrorIgnoreLevel;
1028 gErrorIgnoreLevel=kFatal; //dont report errors
1029 TFile *rootfile = TFile::Open(path);
1030 if(!rootfile || rootfile->IsZombie())
1031 { //ok assume its path to alirunfile file
1032 sprintf(filename,"%s/alirunfile.root",path); //create rootfile name
1033 } else { //path contains itself the rootfile name
1034 rootfile->Close();
1035 sprintf(filename,"%s",path);
1036 }
1037 gErrorIgnoreLevel=saveErrIgLevel;
1038
1039 //finally make dummy init file /tmp/$USER/l3transform.config-`date`
1040 Char_t tmppath[1024];
1041 sprintf(tmppath,"/tmp/%s",gSystem->Getenv("USER"));
1042 gSystem->mkdir(tmppath);
1043 TTimeStamp time;
1044 Char_t tmpfile[1024];
1045 sprintf(tmpfile,"%s/l3transform.config-%d",tmppath,(Int_t)time.GetSec());
1046 return MakeInitFile(filename,tmpfile);
1047#endif
1048}
1049
1050Bool_t AliHLTTPCTransform::MakeInitFile(Char_t *rootfilename,Char_t *filename)
1051{
1052 //Get the parameters from rootfile, and store it on the file "l3transform.config"
1053 //which is being read by Init. fVersion will be kV_aliroot!
1054
1055#ifndef use_aliroot
1056 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","Version")
1057 <<"You have to compile with use_aliroot flag in order to use this function"<<ENDLOG;
1058 return kFALSE;
1059#else
1060 TFile *rootfile = TFile::Open(rootfilename);
1061 if(!rootfile)
1062 {
1063 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","File")
1064 <<"Could not open file: "<<rootfilename<<ENDLOG;
1065 return kFALSE;
1066 }
1067 AliRun *gAlice = (AliRun*)rootfile->Get("gAlice");
1068 if(!gAlice)
1069 {
1070 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","File")
1071 <<"No gAlice in file: "<<rootfilename<<ENDLOG;
1072 return kFALSE;
1073 }
1074 AliTPCParamSR *param=(AliTPCParamSR*)rootfile->Get(GetParamName());
1075 if(!param)
1076 {
1077 LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTransform::MakeInitFile","File")
1078 <<"No TPC parameters found in \""<<rootfilename
1079 <<"\", creating standard parameters "
1080 <<"which might not be what you want!"<<ENDLOG;
1081 param=new AliTPCParamSR;
1082 }
1083
1084 AliTPCPRF2D * prfinner = new AliTPCPRF2D;
1085 AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
1086 AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
1087 AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
1088 rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
1089 rf->SetOffset(3*param->GetZSigma());
1090 rf->Update();
1091
1092 TDirectory *savedir=gDirectory;
1093 TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
1094 if (!prf_file->IsOpen())
1095 {
1096 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","File")
1097 <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG;
1098 return kFALSE;
1099 }
1100 prfinner ->Read("prf_07504_Gati_056068_d02");
1101 prfouter1->Read("prf_10006_Gati_047051_d03");
1102 prfouter2->Read("prf_15006_Gati_047051_d03");
1103 prf_file->Close();
1104 savedir->cd();
1105
1106 param->SetInnerPRF(prfinner);
1107 param->SetOuter1PRF(prfouter1);
1108 param->SetOuter2PRF(prfouter2);
1109 param->SetTimeRF(rf);
1110
1111 fgNTimeBins = param->GetMaxTBin()+1;
1112 fgNRowLow = param->GetNRowLow();
1113 fgNRowUp = param->GetNRowUp();
1114 fgNRowUp1 = param->GetNRowUp1();
1115 fgNRowUp2 = param->GetNRowUp2();
1116 fgNRow= fgNRowLow + fgNRowUp;
1117 if(fgNRow!=159){
1118 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","fNRow")
1119 <<"Number of rows have changed in ALIROOT"<<ENDLOG;
1120 return kFALSE;
1121 }
1122
1123 fgNSectorLow = param->GetNInnerSector();
1124 fgNSectorUp = param->GetNOuterSector();
1125 fgNSector = fgNSectorLow + fgNSectorUp;
1126
1127 //test whether they were changes to the rotation shift
1128 fgNRotShift=0;
1129 Float_t irotshift = param->GetInnerAngleShift(); //shift angle
1130 Float_t orotshift = param->GetOuterAngleShift(); //shift angle
1131 const Float_t kDegtoRad = 0.01745329251994;
1132 Int_t shift1=TMath::Nint(irotshift/kDegtoRad);
1133 Int_t shift2=TMath::Nint(orotshift/kDegtoRad+0.1);
1134 if((shift1!=shift2) || (shift1!=10)){
1135 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::MakeInitFile","Rotshiftangle")
1136 <<"Rotation shift angle has changed in ALIROOT"<<ENDLOG;
1137 return kFALSE;
1138 } else {
1139 fgNRotShift=0.5; //our version of the shift angle
1140 }
1141
1142 fgVersion=kValiroot;
1143 SetBFieldFactor((Double_t)gAlice->Field()->Factor());
cce3eda4 1144 SetSolenoidBField(-
1145 (Double_t)gAlice->Field()->SolenoidField()/
1146 (Double_t)gAlice->Field()->Factor()
1147 );
a6c02c85 1148 fgPadPitchWidthLow=param->GetInnerPadPitchWidth();
1149 fgPadPitchWidthUp=param->GetOuterPadPitchWidth();
1150 fgZWidth=param->GetZWidth();
1151 fgZSigma=param->GetZSigma();
1152 fgZLength=param->GetZLength();
1153 fgZOffset=param->GetZOffset();
1154 fgDiffT=param->GetDiffT();
1155 fgDiffL=param->GetDiffL();
1156 fgOmegaTau=param->GetOmegaTau();
1157 fgInnerPadLength=param->GetInnerPadLength();
1158 fgOuter1PadLength=param->GetOuter1PadLength();
1159 fgOuter2PadLength=param->GetOuter2PadLength();
1160 fgInnerPRFSigma=param->GetInnerPRF()->GetSigmaX();
1161 fgOuter1PRFSigma=param->GetOuter1PRF()->GetSigmaX();
1162 fgOuter2PRFSigma=param->GetOuter2PRF()->GetSigmaX();
1163 fgTimeSigma=param->GetTimeRF()->GetSigma();
1164 fgADCSat=param->GetADCSat();
1165 fgZeroSup=param->GetZeroSup();
1166 fgNSlice=fgNSectorLow;
1167
1168 //now do the arrays
1169 for(Int_t i=0;i<fgNRow;i++){
1170 Int_t sec,row;
1171 if( i < fgNRowLow){sec =0;row =i;}
1172 else{sec = fgNSectorLow;row =i-fgNRowLow;}
1173 fgX[i]=param->GetPadRowRadii(sec,row);
1174 }
1175 for(Int_t i=0;i<fgNRow;i++){
1176 Int_t sec,row;
1177 if( i < fgNRowLow){sec =0;row =i;}
1178 else{sec = fgNSectorLow;row =i-fgNRowLow;}
1179 fgNPads[i]=param->GetNPads(sec,row);
1180 }
1181 for(Int_t i=0;i<fgNSector;i++){
1182 if(i<fgNSectorLow) fgSectorLow[i]=1;
1183 else fgSectorLow[i]=0;
1184 }
1185
1186 delete gAlice;
1187 rootfile->Close();
1188 delete rootfile;
1189
1190 return SaveInitFile(filename);
1191#endif
1192}
1193
1194Bool_t AliHLTTPCTransform::SaveInitFile(Char_t *filenamepath)
1195{
1196 //store the parameters in the file "filenamepath"
1197
1198 FILE *f = fopen(filenamepath,"w");
1199 if(!f){
1200 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::SaveInitFile","File")
1201 <<"Could not open file: "<<filenamepath<<ENDLOG;
1202 return kFALSE;
1203 }
1204
1205 fprintf(f,"void AliHLTTPCTransform::Init(){\n");
1206 fprintf(f," fVersion = %d;\n", fgVersion);
1207 fprintf(f," fBFieldFactor = %.3f;\n",fgBFieldFactor);
1208 fprintf(f," fSolenoidBField = %.3f;\n",fgSolenoidBField);
1209 fprintf(f," fNTimeBins = %d;\n",fgNTimeBins);
1210 fprintf(f," fNRowLow = %d;\n",fgNRowLow);
1211 fprintf(f," fNRowUp = %d;\n",fgNRowUp);
1212 fprintf(f," fNRowUp1 = %d;\n",fgNRowUp1);
1213 fprintf(f," fNRowUp2 = %d;\n",fgNRowUp2);
1214 fprintf(f," fNSectorLow = %d;\n",fgNSectorLow);
1215 fprintf(f," fNSectorUp = %d;\n",fgNSectorUp);
1216 fprintf(f," fNSector = %d;\n",fgNSector);
1217 fprintf(f," fPadPitchWidthLow = %.3f;\n",fgPadPitchWidthLow);
1218 fprintf(f," fPadPitchWidthUp = %.3f;\n",fgPadPitchWidthUp);
1219 fprintf(f," fZWidth = %.4f;\n",fgZWidth);
1220 fprintf(f," fZSigma = %.4f;\n",fgZSigma);
1221 fprintf(f," fZLength = %.4f;\n",fgZLength);
1222 fprintf(f," fZOffset = %.4f;\n",fgZOffset);
1223 fprintf(f," fDiffT = %.4f;\n",fgDiffT);
1224 fprintf(f," fDiffL = %.4f;\n",fgDiffL);
1225 fprintf(f," fOmegaTau = %.4f;\n",fgOmegaTau);
1226 fprintf(f," fInnerPadLength = %.3f;\n",fgInnerPadLength);
1227 fprintf(f," fOuter1PadLength = %.3f;\n",fgOuter1PadLength);
1228 fprintf(f," fOuter2PadLength = %.3f;\n",fgOuter2PadLength);
1229 fprintf(f," fInnerPRFSigma = %.6f;\n",fgInnerPRFSigma);
1230 fprintf(f," fOuter1PRFSigma = %.6f;\n",fgOuter1PRFSigma);
1231 fprintf(f," fOuter2PRFSigma = %.6f;\n",fgOuter2PRFSigma);
1232 fprintf(f," fTimeSigma = %.6f;\n",fgTimeSigma);
1233 fprintf(f," fADCSat = %d;\n",fgADCSat);
1234 fprintf(f," fZeroSup = %d;\n",fgZeroSup);
1235 fprintf(f," fNSlice = %d;\n",fgNSlice);
1236 fprintf(f," fNRow = %d;\n",fgNRow);
1237 fprintf(f," fNRotShift = %.2f;\n",fgNRotShift);
1238 //now do the arrays
1239 for(Int_t i=0;i<fgNRow;i++){
1240 fprintf(f," fX[%d] = %3.2f;\n",i,fgX[i]);
1241 }
1242 for(Int_t i=0;i<fgNRow;i++){
1243 fprintf(f," fNPads[%d] = %d;\n",i,fgNPads[i]);
1244 }
1245
1246 //Slice/Sector dont belong to aliroot, but we want to be flexible
1247 for(Int_t i=0;i<fgNSlice;i++){
1248 fprintf(f," fSlice2Sector[%d][0] = %d;\n",i,fgSlice2Sector[i][0]);
1249 fprintf(f," fSlice2Sector[%d][1] = %d;\n",i,fgSlice2Sector[i][1]);
1250 }
1251 for(Int_t i=0;i<fgNSector;i++){
1252 fprintf(f," fSector2Slice[%d] = %d;\n",i,fgSector2Slice[i]);
1253 }
1254 for(Int_t i=0;i<fgNSector;i++){
1255 fprintf(f," fSectorLow[%d] = %d;\n",i,fgSectorLow[i]);
1256 }
1257
1258 //Patches also dont really belong to the aliroot settings (but nevermind)
1259 for(Int_t i=0;i<fgNPatches;i++){
1260 fprintf(f," fNRows[%d] = %d;\n",i,fgNRows[i]);
1261 }
1262 for(Int_t i=0;i<fgNPatches;i++){
1263 fprintf(f," fRows[%d][0] = %d;\n",i,fgRows[i][0]);
1264 fprintf(f," fRows[%d][1] = %d;\n",i,fgRows[i][1]);
1265 }
1266
1267 //Rotation shift is an addon, too
1268 for(Int_t i=0;i<fgNSlice;i++){
1269 Float_t cs = cos( (2*fgkPi/18) * (i+fgNRotShift) );
1270 fprintf(f," fCos[%d] = %.10f;\n",i,cs);
1271 }
1272 for(Int_t i=0;i<fgNSlice;i++){
1273 Float_t sn = sin( (2*fgkPi/18) * (i+fgNRotShift) );
1274 fprintf(f," fSin[%d] = %.10f;\n",i,sn);
1275 }
1276
1277 fprintf(f,"}\n");
1278 fclose(f);
1279
1280 LOG(AliHLTTPCLog::kInformational,"AliHLTTPCTransform::SaveInitFile","File created")
1281 <<"Init file \""<<filenamepath<<"\" created"<<ENDLOG;
1282
1283 return kTRUE;
1284}
1285
1286Int_t AliHLTTPCTransform::GetNPads(Int_t row)
1287{
1288 //get number of pads per row
1289 if(row < 0 || row >= fgNRow)
1290 {
1291 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetNPads","Row")
1292 <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1293 return 0;
1294 }
1295
1296 return fgNPads[row];
1297}
1298
1299Int_t AliHLTTPCTransform::GetFirstRow(Int_t patch)
1300{
1301 //get first row per patch
1302
1303 if(patch==-1)
1304 return 0;
1305 else if(patch < -1 || patch >= 6)
1306 {
1307 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetFirstRow","Patch")
1308 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1309 return 0;
1310 }
1311 else
1312 return fgRows[patch][0];
1313}
1314
1315Int_t AliHLTTPCTransform::GetLastRow(Int_t patch)
1316{
1317 //get last row per patch
1318 if(patch==-1)
1319 return fgRows[5][1];
1320 else if(patch < -1 || patch >= 6)
1321 {
1322 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetLastRow","Patch")
1323 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1324 return 0;
1325 }
1326 else
1327 return fgRows[patch][1];
1328}
1329
1330Int_t AliHLTTPCTransform::GetFirstRowOnDDL(Int_t patch)
1331{
1332 //get first row per patch
1333
1334 if(patch==-1)
1335 return 0;
1336 else if(patch < -1 || patch >= 6)
1337 {
1338 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetFirstRow","Patch")
1339 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1340 return 0;
1341 }
1342 else
1343 {
1344 if(patch==1) return fgRows[patch][0]+1;
1345 return fgRows[patch][0];
1346 }
1347}
1348
1349Int_t AliHLTTPCTransform::GetLastRowOnDDL(Int_t patch)
1350{
1351 //get last row per patch
1352 if(patch==-1)
1353 return fgRows[5][1];
1354 else if(patch < -1 || patch >= 6)
1355 {
1356 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetLastRow","Patch")
1357 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1358 return 0;
1359 }
1360 else
1361 {
1362 if(patch==2 || patch==4) return fgRows[patch][1]-1;
1363 return fgRows[patch][1];
1364 }
1365}
1366
1367Int_t AliHLTTPCTransform::GetNRows(Int_t patch)
1368{
1369 //get number of rows per patch
1370 if(patch==-1)
1371 return fgNRow;
1372 else if(patch < -1 || patch >= 6)
1373 {
1374 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetNRows","Patch")
1375 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1376 return 0;
1377 }
1378 else
1379 return fgNRows[patch];
1380}
1381
1382Int_t AliHLTTPCTransform::GetPadRow(Float_t xvalue)
1383{
1384 //Find the padrow number corresponding to cartesian _local_ x value
1385 if(xvalue < 0 || xvalue > 250)
1386 {
1387 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadRow","X-value")
1388 <<AliHLTTPCLog::kDec<<"Suspicious x-value, make sure it is in local coordinate! "
1389 <<xvalue<<ENDLOG;
1390 return -1;
1391 }
1392
1393 Int_t x = (Int_t)rint(xvalue*10);
1394 if(x < (Int_t)rint(fgX[1]*10))
1395 return 0;
1396 else if(x > (Int_t)rint(fgX[fgNRow-2]*10))
1397 return fgNRow-1;
1398 else
1399 {
1400 Int_t padrow=1; //Of course, a more clever algorithm could help here
1401 while(padrow < fgNRow-2)
1402 {
1403 if(x > (Int_t)rint(fgX[padrow-1]*10) && x < (Int_t)rint(fgX[padrow+1]*10))
1404 break;
1405 padrow++;
1406 }
1407 return padrow;
1408 }
1409}
1410
1411Int_t AliHLTTPCTransform::GetPatch(Int_t padrow)
1412{
1413 //get patch for padrow
1414 if(padrow < 0 || padrow >= fgNRow)
1415 {
1416 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPatch","Padrow")
1417 <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1418 return -2;
1419 }
1420 Int_t patch=0;
1421 while(patch < fgNPatches)
1422 {
1423 if(padrow >= fgRows[patch][0] && padrow <= fgRows[patch][1])
1424 break;
1425 patch++;
1426 }
1427 return patch;
1428}
1429
1430Double_t AliHLTTPCTransform::GetPadLength(Int_t padrow)
1431{
1432 //get pad length for padrow
1433 if(padrow >= fgNRow){
1434 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadLength","Padrow")
1435 <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1436 return 0;
1437 }
1438
1439 if(padrow < fgNRowLow)
1440 return fgInnerPadLength;
1441 if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
1442 return fgOuter1PadLength;
1443 if(padrow >= fgNRowLow + fgNRowUp1 - 1)
1444 return fgOuter2PadLength;
1445
1446 //should never happen
1447 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadLength","Padrow")
1448 <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1449 return -1.0;
1450}
1451
1452Double_t AliHLTTPCTransform::GetPadPitchWidth(Int_t patch)
1453{
1454 //get pad patch width for patch
1455 if(patch < 0 || patch > fgNPatches)
1456 {
1457 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadPitchWidth","patct")
1458 <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1459 return -1;
1460 }
1461 return patch < 2 ? fgPadPitchWidthLow : fgPadPitchWidthUp;
1462}
1463
1464Double_t AliHLTTPCTransform::GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle)
1465{
1466 //Calculate the expected transverse cluster width as a function of
1467 //drift distance and crossing angle.
1468 //z = local z-coordinate of cluster
1469 //angle = track crossing angle with normal to padrow plane
1470 //return value = sigma^2 (cartesian coordinates)
1471
1472 Double_t drift;
1473 if(z > 0)
1474 drift = fgZLength - z;
1475 else
1476 drift = fgZLength + z;
1477
1478 Double_t t1 = GetPRFSigma(padrow)*GetPRFSigma(padrow);
1479 Double_t t2 = fgDiffT*fgDiffT*drift;
1480 Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tan(angle)*tan(angle)/12;
1481 Double_t t4 = fgkAnodeWireSpacing*fgkAnodeWireSpacing*(tan(angle) - fgOmegaTau)*(tan(angle) - fgOmegaTau)/12;
1482
1483 return (t1 + t2 + t3 + t4);
1484}
1485
1486Double_t AliHLTTPCTransform::GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl)
1487{
1488 //Calculate the expected longitudinal cluster width as a function of
1489 //drift distance and track crossing angle.
1490 //z = local z-coordinate of cluster
1491 //tgl = tan(dipangle)
1492 //return value = sigma^2 (cartesian coordinates)
1493
1494 Double_t drift;
1495 if(z > 0)
1496 drift = AliHLTTPCTransform::GetZLength() - z;
1497 else
1498 drift = AliHLTTPCTransform::GetZLength() + z;
1499
1500 Double_t t1 = fgZSigma*fgZSigma;
1501 Double_t t2 = fgDiffL*fgDiffL*drift;
1502 Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tgl*tgl/12;
1503
1504 return (t1 + t2 + t3);
1505}
1506
1507Double_t AliHLTTPCTransform::GetPRFSigma(Int_t padrow)
1508{
1509 //get sigma of pad response function for padrow
1510
1511 if(padrow >= fgNRow){
1512 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPRFSigma","Padrow")
1513 <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1514 return 0;
1515 }
1516 if(padrow < fgNRowLow)
1517 return fgInnerPRFSigma;
1518 if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
1519 return fgOuter1PRFSigma;
1520 if(padrow >= fgNRowLow + fgNRowUp1 - 1)
1521 return fgOuter2PRFSigma;
1522
1523 //should never happen
1524 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPRFSigma","Padrow")
1525 <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1526 return -1.;
1527}
1528
1529Double_t AliHLTTPCTransform::GetEta(Float_t *xyz)
1530{
1531 //get eta
1532 Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
1533 Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2]));
1534 return eta;
1535}
1536
1537void AliHLTTPCTransform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz)
1538{
1539 //transform xyz into rpe
1540 rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
1541 rpe[1] = atan2(xyz[1],xyz[0]);
1542 rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2]));
1543}
1544
1545Double_t AliHLTTPCTransform::GetEta(Int_t slice,Int_t padrow,Int_t pad,Int_t time)
1546{
1547 //get eta
1548 Float_t xyz[3];
1549 Int_t sector,row;
1550 Slice2Sector(slice,padrow,sector,row);
1551 Raw2Local(xyz,sector,row,pad,time);
1552
1553 return GetEta(xyz);
1554}
1555
1556Double_t AliHLTTPCTransform::GetPhi(Float_t *xyz)
1557{
1558 //get phi
1559 Double_t phi = atan2(xyz[1],xyz[0]);
1560 return phi;
1561}
1562
1563Bool_t AliHLTTPCTransform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row)
1564{
1565 //slice to sector number
1566 if(slicerow<0&&slicerow>=fgNRow){
1567 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Slice2Sector","Slicerow")
1568 <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
1569 return kFALSE;
1570 }
1571 if(slice<0||slice>=fgNSlice){
1572 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Slice2Sector","Slice")
1573 <<AliHLTTPCLog::kDec<<"Wrong slice "<<slice<<ENDLOG;
1574 return kFALSE;
1575 }
1576
1577 if(slicerow<fgNRowLow){
1578 sector = fgSlice2Sector[slice][0];
1579 row = slicerow;
1580 }
1581 else {
1582 sector = fgSlice2Sector[slice][1];
1583 row = slicerow-fgNRowLow;
1584 }
1585
1586 return kTRUE;
1587}
1588
1589Bool_t AliHLTTPCTransform::Sector2Slice(Int_t & slice, Int_t sector)
1590{
1591 //sector to slice
1592 if(sector<0||sector>=fgNSector){
1593 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Sector")
1594 <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
1595 return kFALSE;
1596 }
1597
1598 slice=fgSector2Slice[sector];
1599
1600 return kTRUE;
1601}
1602
1603Bool_t AliHLTTPCTransform::Sector2Slice(Int_t & slice, Int_t & slicerow, Int_t sector, Int_t row)
1604{
1605 //sector to slice
1606 if(sector<0 || sector>=fgNSector){
1607 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Sector")
1608 <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
1609 return kFALSE;
1610 }
1611 if(row<0){
1612 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1613 <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1614 return kFALSE;
1615 }
1616
1617 if(fgSectorLow[sector]){
1618 if(row>=fgNRowLow){
1619 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1620 <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1621 return kFALSE;
1622 }
1623 slice = fgSector2Slice[sector];
1624 slicerow = row;
1625 }
1626 else{
1627 if(row>=fgNRowUp){
1628 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1629 <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1630 return kFALSE;
1631 }
1632 slice = fgSector2Slice[sector];
1633 slicerow = row + fgNRowLow;
1634 }
1635
1636 return kTRUE;
1637}
1638
1639Double_t AliHLTTPCTransform::GetMaxY(Int_t slicerow)
1640{
1641 //get maximum y value (for slice 0)
1642 if(slicerow < fgNRowLow)
1643 return fgPadPitchWidthLow*fgNPads[slicerow]/2;
1644
1645 else
1646 return fgPadPitchWidthUp*fgNPads[slicerow]/2;
1647
1648}
1649
1650Double_t AliHLTTPCTransform::Row2X(Int_t slicerow)
1651{
1652 //slicerow to X value (slice 0)
1653 if(slicerow<0||slicerow>=fgNRow){
1654 LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Row2X","Slicerow")
1655 <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
1656 return 0;
1657 }
1658 return fgX[slicerow];
1659}
1660
1661Double_t AliHLTTPCTransform::GetZFast(Int_t slice, Int_t time, Float_t vertex)
1662{
1663 //get z value
1664 Double_t z=fgZWidth*time-fgZOffset;
1665 if(slice < 18)
1666 z=fgZLength-z-vertex;
1667 else
1668 z=z-fgZLength-vertex;
1669 return z;
1670}
1671
1672void AliHLTTPCTransform::Local2Global(Float_t *xyz,Int_t slice)
1673{
1674 //Transformation to global coordinate system
1675 Float_t x0 = xyz[0];
1676 Float_t y0 = xyz[1];
1677
1678 xyz[0]=x0*fgCos[slice]-y0*fgSin[slice];
1679 xyz[1]=x0*fgSin[slice]+y0*fgCos[slice];
1680 xyz[2]=xyz[2];//global z=local z
1681}
1682
1683void AliHLTTPCTransform::Local2GlobalAngle(Float_t *angle,Int_t slice)
1684{
1685 //get angle global
1686 angle[0] = fmod(angle[0]+(slice+fgNRotShift)*(2*fgkPi/18),2*fgkPi);
1687}
1688
1689void AliHLTTPCTransform::Global2LocalAngle(Float_t *angle,Int_t slice)
1690{
1691 //get angle local
1692 angle[0] = angle[0]-(slice+fgNRotShift)*(2*fgkPi/18);
1693 if(angle[0]<0) angle[0]+=2*fgkPi;
1694}
1695
1696void AliHLTTPCTransform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
1697{
1698 //Transformation from rawdata to local coordinate system
1699
1700 Int_t slice,slicerow;
1701 Sector2Slice(slice, slicerow, sector, row);
1702
1703 //X-Value
1704 xyz[0]=Row2X(slicerow);
1705
1706 //Y-Value
1707 Int_t npads= fgNPads[slicerow];
1708
1709 if(fgSectorLow[sector])
1710 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1711 else
1712 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1713
1714 //Z-Value (remember PULSA Delay)
1715 if(slice < 18)
1716 xyz[2]=fgZLength-fgZWidth*time+fgZOffset;
1717 else
1718 xyz[2]=fgZWidth*time-fgZOffset-fgZLength;
1719}
1720
1721void AliHLTTPCTransform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Int_t pad,Int_t time)
1722{
1723 //Transformation from rawdata to local coordinate system
1724
1725 Int_t slice,slicerow;
1726 Sector2Slice(slice, slicerow, sector, row);
1727
1728 //X-Value
1729 xyz[0]=Row2X(slicerow);
1730
1731 //Y-Value
1732 Int_t npads= fgNPads[slicerow];
1733
1734 if(fgSectorLow[sector])
1735 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1736 else
1737 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1738
1739 //Z-Value (remember PULSA Delay)
1740 if(slice < 18)
1741 xyz[2]=fgZLength-fgZWidth*time+fgZOffset;
1742 else
1743 xyz[2]=fgZWidth*time-fgZOffset-fgZLength;
1744}
1745
1746void AliHLTTPCTransform::RawHLT2Local(Float_t *xyz,Int_t slice,
1747 Int_t slicerow,Float_t pad,Float_t time)
1748{
1749 //Transformation from HLT rawdata to local coordinate system
1750
1751 //X-Value
1752 xyz[0]=Row2X(slicerow);
1753
1754 //Y-Value
1755 Int_t npads= fgNPads[slicerow];
1756 if(slicerow<fgNRowLow)
1757 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1758 else
1759 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1760
1761 //Z-Value
1762 if(slice < 18)
1763 xyz[2]=fgZLength-fgZWidth*time+fgZOffset;
1764 else
1765 xyz[2]=fgZWidth*time-fgZOffset-fgZLength;
1766}
1767
1768void AliHLTTPCTransform::RawHLT2Local(Float_t *xyz,Int_t slice,
1769 Int_t slicerow,Int_t pad,Int_t time)
1770{
1771 //Transformation from HLT rawdata to local coordinate system
1772
1773 //X-Value
1774 xyz[0]=Row2X(slicerow);
1775
1776 //Y-Value
1777 Int_t npads= fgNPads[slicerow];
1778 if(slicerow<fgNRowLow)
1779 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1780 else
1781 xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1782
1783 //Z-Value
1784 if(slice < 18)
1785 xyz[2]=fgZLength-fgZWidth*time+fgZOffset;
1786 else
1787 xyz[2]=fgZWidth*time-fgZOffset-fgZLength;
1788}
1789
1790void AliHLTTPCTransform::Local2Global(Float_t *xyz,Int_t sector,Int_t row)
1791{
1792 //Transformation to global coordinate system
1793 Int_t slice,slicerow;
1794 Sector2Slice(slice, slicerow, sector, row);
1795 Float_t r=Row2X(slicerow); //have to get x value first
1796
1797 xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
1798 xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
1799 xyz[2]=xyz[2];//global z=local z
1800}
1801
1802void AliHLTTPCTransform::LocHLT2Global(Float_t *xyz,Int_t slice,Int_t slicerow)
1803{
1804 //Transformation from HLT to global coordinate system
1805 Float_t r=Row2X(slicerow); //have to get x value first
1806
1807 xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
1808 xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
1809 xyz[2]=xyz[2];//global z=local z
1810}
1811
1812void AliHLTTPCTransform::Global2Local(Float_t *xyz,Int_t sector)
1813{ //check code
1814 Int_t slice;
1815 Sector2Slice(slice, sector);
1816
1817 Float_t x1 = xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
1818 Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
1819 xyz[0] = x1;
1820 xyz[1] = y1;
1821}
1822
1823void AliHLTTPCTransform::Global2LocHLT(Float_t *xyz,Int_t slice)
1824{
1825 Float_t x1 = xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
1826 Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
1827 xyz[0] = x1;
1828 xyz[1] = y1;
1829}
1830
1831void AliHLTTPCTransform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
1832{
1833 //Transformation from raw to global coordinates
1834
1835 Raw2Local(xyz,sector,row,pad,time);
1836 Local2Global(xyz,sector,row);
1837}
1838
1839void AliHLTTPCTransform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Int_t pad,Int_t time)
1840{
1841 //Transformation from raw to global coordinates
1842
1843 Raw2Local(xyz,sector,row,pad,time);
1844 Local2Global(xyz,sector,row);
1845}
1846
1847void AliHLTTPCTransform::RawHLT2Global(Float_t *xyz,Int_t slice,
1848 Int_t slicerow,Float_t pad,Float_t time)
1849{
1850 //Transformation from raw to global coordinates
1851
1852 RawHLT2Local(xyz,slice,slicerow,pad,time);
1853 LocHLT2Global(xyz,slice,slicerow);
1854}
1855
1856void AliHLTTPCTransform::RawHLT2Global(Float_t *xyz,Int_t slice,
1857 Int_t slicerow,Int_t pad,Int_t time)
1858{
1859 //Transformation from raw to global coordinates
1860
1861 RawHLT2Local(xyz,slice,slicerow,pad,time);
1862 LocHLT2Global(xyz,slice,slicerow);
1863}
1864
1865void AliHLTTPCTransform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row)
1866{
1867 //Transformation from local coordinates to raw
1868
1869 Int_t slice,slicerow;
1870 Sector2Slice(slice, slicerow, sector, row);
1871
1872 xyz[0]=slicerow;
1873
1874 if(fgSectorLow[sector])
1875 xyz[1]=xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]-1);
1876 else
1877 xyz[1]=xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]-1);
1878
1879 if(slice < 18)
1880 xyz[2]=(fgZLength-xyz[2]+fgZOffset)/fgZWidth;
1881 else
1882 xyz[2]=(fgZLength+xyz[2]+fgZOffset)/fgZWidth;
1883}
1884
1885void AliHLTTPCTransform::LocHLT2Raw(Float_t *xyz,Int_t slice,Int_t slicerow)
1886{
1887 //Transformation from local coordinates to raw
1888
1889 xyz[0]=slicerow;
1890
1891 if(slicerow<fgNRowLow)
1892 xyz[1]=xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]-1);
1893 else
1894 xyz[1]=xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]-1);
1895
1896 if(slice < 18)
1897 xyz[2]=(fgZLength-xyz[2]+fgZOffset)/fgZWidth;
1898 else
1899 xyz[2]=(fgZLength+xyz[2]+fgZOffset)/fgZWidth;
1900}
1901
1902void AliHLTTPCTransform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row)
1903{
1904 //Transformation from global coordinates to raw.
1905
1906 Global2Local(xyz,sector);
1907 Local2Raw(xyz,sector,row);
1908}
1909
1910void AliHLTTPCTransform::Global2HLT(Float_t *xyz,Int_t slice,Int_t slicerow)
1911{
1912 //Transformation from global coordinates to raw.
1913
1914 Global2LocHLT(xyz,slice);
1915 LocHLT2Raw(xyz,slice,slicerow);
1916}
1917
1918void AliHLTTPCTransform::PrintCompileOptions()
1919{
1920 //print compile options
1921#if defined(__GNUC__)
1922 cout << "Compiler (g++) version used: " << __GNUC__ << endl;
1923#endif
1924
1925#ifdef no_root
1926 cout << "STANDALONE version: -Dno_root was given." << endl;
1927#else
1928 const Char_t *roottest="$ROOTSYS/bin/root -n -b -q | grep Version | cut -b 17-25 | cut -d\" \" -f1";
1929#ifdef use_aliroot
1930#ifdef use_cvs
1931 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";
1932#else
1933 const Char_t *aliroottest="Unknown";
1934#endif
1935 cout << "ALIROOT version: -Duse_aliroot and -Duse_root was given." << endl;
1936 cout << "Root Version: " << ROOTVERSION << " found " << flush;
1937 gSystem->Exec(roottest);
1938
1939 cout << "AliRoot Version: " << ALIROOTVERSION << " found " << flush;
1940 gSystem->Exec(aliroottest);
1941#else
1942 cout << "ROOT version: -Duse_root was given." << endl;
1943 cout << "Root Version: " << ROOTVERSION << " found " << flush;
1944 gSystem->Exec(roottest);
1945#endif
1946#endif
1947
1948#ifdef do_mc
1949 cout << "Using Monte Carlo Info: -Ddo_mc was given." << endl;
1950#else
1951 cout << "NOT using Monte Carlo Info: -Ddo_mc was not given." << endl;
1952#endif
1953
1954#ifdef INCLUDE_TPC_HOUGH
1955 cout << "Including support for TPC Hough transformations." << endl;
1956#ifdef ROWHOUGHPARAMS
1957 cout << "Using extended AliHLTTPCTrackSegmentData: -DROWHOUGHPARAMS was given." << endl;
1958#else
1959 cout << "NOT using extended AliHLTTPCTrackSegmentData: -DROWHOUGHPARAMS was not given." << endl;
1960#endif
1961#else
1962 cout << "NOT including any support for TPC Hough transformations." << endl;
1963#endif // INCLUDE_TPC_HOUGH
1964
1965#ifdef use_newio
1966 cout << "Using NEWIO version: -Duse_newio was given." << endl;
1967#else
1968 cout << "NOT using NEWIO version: -Duse_newio was not given." << endl;
1969#endif
1970
1971#ifdef use_logging
1972 cout << "Using logging classes (MLUC): -Duse_logging was given." << endl;
1973#else
1974 cout << "NOT using logging classes (MLUC): -Duse_logging not was given." << endl;
1975#endif
1976
1977}