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