]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCTransform.cxx
Updates in D-meson PID class:
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTransform.cxx
1
2 // @(#) $Id$
3 // Original: AliHLTTransform.cxx,v 1.53 2005/06/14 10:55:21 cvetan 
4
5 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>, Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
6 //*-- Copyright &copy ALICE HLT Group
7
8
9 #include "dirent.h"
10
11 #ifdef use_aliroot
12 #include <AliRun.h>
13 #include <AliTPCParamSR.h>
14 #include <AliTPCPRF2D.h>
15 #include <AliTPCRF1D.h>
16 #endif
17 #ifdef use_root
18 #include <TError.h>
19 #include <TFile.h>
20 #include <TTimeStamp.h>
21 #include <TUnixSystem.h>
22 #endif
23
24 #include "AliHLTTPCLogging.h"
25 #include "AliHLTTPCTransform.h"
26
27 #if defined(__GNUC__) && __GNUC__ >= 3
28 using 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 * @ingroup alihlt_tpc
76 */
77
78 ClassImp(AliHLTTPCTransform)
79
80 AliHLTTPCTransform::AliHLTTPCTransform()
81 {
82 }
83
84 const Double_t AliHLTTPCTransform::fgkAnodeWireSpacing = 0.25; //Taken from the TDR
85 const Double_t AliHLTTPCTransform::fgkBFACT = 0.0029980;       //Conversion Factor
86 const Double_t AliHLTTPCTransform::fgkPi  =   3.141592653589793;
87 const Double_t AliHLTTPCTransform::fgk2Pi = 2*3.141592653589793;
88 const Double_t AliHLTTPCTransform::fgkPi2 = 0.5*3.141592653589793;
89 const Double_t AliHLTTPCTransform::fgkToDeg = 180/3.141592653589793;
90
91 //Defined by HLT and GSI
92 Int_t AliHLTTPCTransform::fgNPatches = 6;
93 #if 0
94 // Old format, corresponding to IntegrTest-5 code and data
95 Int_t AliHLTTPCTransform::fgRows[6][2] = {{0,29},{30,62},{63,90},{91,116},{117,139},{140,158}}; 
96 Int_t AliHLTTPCTransform::fgNRows[6] = {30,33,28,26,23,19};
97 #else
98 // New data corresponding to simulated raw data 2004-08-20, provided by Thomas Kuhr
99 Int_t AliHLTTPCTransform::fgRows[6][2] = {{0,30},{30,62},{63,90},{90,116},{117,139},{139,158}}; 
100 Int_t AliHLTTPCTransform::fgNRows[6] = {31,33,28,27,23,20};
101 #endif
102
103 // The following definition is generated by MakeInitFile function
104 Double_t AliHLTTPCTransform::fgBField = 0.5;
105 Double_t AliHLTTPCTransform::fgSolenoidBField = 5;
106 Double_t AliHLTTPCTransform::fgBFieldFactor = 1;
107 Int_t AliHLTTPCTransform::fgVersion = kVdefault;
108 Int_t AliHLTTPCTransform::fgNTimeBins = 1024; //  = 1024; //446
109 Int_t AliHLTTPCTransform::fgNRowLow = 63;
110 Int_t AliHLTTPCTransform::fgNRowUp = 96;
111 Int_t AliHLTTPCTransform::fgNRowUp1 = 64;
112 Int_t AliHLTTPCTransform::fgNRowUp2 = 32;
113 Int_t AliHLTTPCTransform::fgNSectorLow = 36;
114 Int_t AliHLTTPCTransform::fgNSectorUp = 36;
115 Int_t AliHLTTPCTransform::fgNSector = 72;
116 Double_t AliHLTTPCTransform::fgPadPitchWidthLow = 0.4;
117 Double_t AliHLTTPCTransform::fgPadPitchWidthUp = 0.6;
118 Double_t AliHLTTPCTransform::fgZSigma = 0.2288;
119 Double_t AliHLTTPCTransform::fgZLength = 250.0000;
120 Double_t AliHLTTPCTransform::fgZWidth = AliHLTTPCTransform::fgZLength / (Double_t)AliHLTTPCTransform::fgNTimeBins ;//0.5660; // 0.2435; // 0.5660 // Width of time bins
121 Double_t AliHLTTPCTransform::fgZOffset = 0.6864;
122 Double_t AliHLTTPCTransform::fgDiffT = 0.0220;
123 Double_t AliHLTTPCTransform::fgDiffL = 0.0220;
124 Double_t AliHLTTPCTransform::fgOmegaTau = 0.1450;
125 Double_t AliHLTTPCTransform::fgInnerPadLength = 0.75;
126 Double_t AliHLTTPCTransform::fgOuter1PadLength = 1.00;
127 Double_t AliHLTTPCTransform::fgOuter2PadLength = 1.50;
128 Double_t AliHLTTPCTransform::fgInnerPRFSigma = 0.203811;
129 Double_t AliHLTTPCTransform::fgOuter1PRFSigma = 0.299325;
130 Double_t AliHLTTPCTransform::fgOuter2PRFSigma = 0.299323;
131 Double_t AliHLTTPCTransform::fgTimeSigma = 0.228809;
132 Int_t AliHLTTPCTransform::fgADCSat = 1024;
133 Int_t AliHLTTPCTransform::fgZeroSup = 0;
134 Int_t AliHLTTPCTransform::fgNSlice = 36;
135 Int_t AliHLTTPCTransform::fgNRow = 159;
136 Double_t AliHLTTPCTransform::fgNRotShift = 0.5;
137 Int_t AliHLTTPCTransform::fgSlice2Sector[36][2] = { { 0, 36}, 
138                                                { 1, 37}, 
139                                                { 2, 38}, 
140                                                { 3, 39}, 
141                                                { 4, 40}, 
142                                                { 5, 41}, 
143                                                { 6, 42}, 
144                                                { 7, 43}, 
145                                                { 8, 44}, 
146                                                { 9, 45}, 
147                                                {10, 46}, 
148                                                {11, 47}, 
149                                                {12, 48}, 
150                                                {13, 49}, 
151                                                {14, 50}, 
152                                                {15, 51}, 
153                                                {16, 52}, 
154                                                {17, 53}, 
155                                                {18, 54}, 
156                                                {19, 55}, 
157                                                {20, 56}, 
158                                                {21, 57}, 
159                                                {22, 58}, 
160                                                {23, 59}, 
161                                                {24, 60}, 
162                                                {25, 61}, 
163                                                {26, 62}, 
164                                                {27, 63}, 
165                                                {28, 64}, 
166                                                {29, 65}, 
167                                                {30, 66}, 
168                                                {31, 67}, 
169                                                {32, 68}, 
170                                                {33, 69}, 
171                                                {34, 70}, 
172                                                {35, 71}
173 };
174
175 Int_t AliHLTTPCTransform::fgSector2Slice[72] = { 0, 
176                                             1, 
177                                             2, 
178                                             3, 
179                                             4, 
180                                             5, 
181                                             6, 
182                                             7, 
183                                             8, 
184                                             9, 
185                                             10, 
186                                             11, 
187                                             12, 
188                                             13, 
189                                             14, 
190                                             15, 
191                                             16, 
192                                             17, 
193                                             18, 
194                                             19, 
195                                             20, 
196                                             21, 
197                                             22, 
198                                             23, 
199                                             24, 
200                                             25, 
201                                             26, 
202                                             27, 
203                                             28, 
204                                             29, 
205                                             30, 
206                                             31, 
207                                             32,
208                                             33, 
209                                             34, 
210                                             35, 
211                                             0, 
212                                             1, 
213                                             2, 
214                                             3, 
215                                             4, 
216                                             5, 
217                                             6, 
218                                             7, 
219                                             8, 
220                                             9, 
221                                             10, 
222                                             11, 
223                                             12, 
224                                             13, 
225                                             14, 
226                                             15, 
227                                             16, 
228                                             17, 
229                                             18, 
230                                             19, 
231                                             20, 
232                                             21, 
233                                             22, 
234                                             23, 
235                                             24, 
236                                             25, 
237                                             26, 
238                                             27, 
239                                             28, 
240                                             29, 
241                                             30, 
242                                             31, 
243                                             32, 
244                                             33, 
245                                             34, 
246                                             35 
247 };
248
249 Int_t AliHLTTPCTransform::fgSectorLow[72] = { 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                                          1, 
281                                          1,
282                                          1, 
283                                          1, 
284                                          1, 
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                                          0, 
317                                          0, 
318                                          0, 
319                                          0, 
320                                          0 
321 };
322
323 Double_t AliHLTTPCTransform::fgX[159] = { 85.195,
324                                      85.945,
325                                      86.695,
326                                      87.445,
327                                      88.195,
328                                      88.945,
329                                      89.695,
330                                      90.445,
331                                      91.195,
332                                      91.945,
333                                      92.695,
334                                      93.445,
335                                      94.195,
336                                      94.945,
337                                      95.695,
338                                      96.445,
339                                      97.195,
340                                      97.945,
341                                      98.695,
342                                      99.445,
343                                      100.195,
344                                      100.945,
345                                      101.695,
346                                      102.445,
347                                      103.195,
348                                      103.945,
349                                      104.695,
350                                      105.445,
351                                      106.195,
352                                      106.945,
353                                      107.695,
354                                      108.445,
355                                      109.195,
356                                      109.945,
357                                      110.695,
358                                      111.445,
359                                      112.195,
360                                      112.945,
361                                      113.695,
362                                      114.445,
363                                      115.195,
364                                      115.945,
365                                      116.695,
366                                      117.445,
367                                      118.195,
368                                      118.945,
369                                      119.695,
370                                      120.445,
371                                      121.195,
372                                      121.945,
373                                      122.695,
374                                      123.445,
375                                      124.195,
376                                      124.945,
377                                      125.695,
378                                      126.445,
379                                      127.195,
380                                      127.945,
381                                      128.695,
382                                      129.445,
383                                      130.195,
384                                      130.945,
385                                      131.695,
386                                      135.180,
387                                      136.180,
388                                      137.180,
389                                      138.180,
390                                      139.180,
391                                      140.180,
392                                      141.180,
393                                      142.180,
394                                      143.180,
395                                      144.180,
396                                      145.180,
397                                      146.180,
398                                      147.180,
399                                      148.180,
400                                      149.180,
401                                      150.180,
402                                      151.180,
403                                      152.180,
404                                      153.180,
405                                      154.180,
406                                      155.180,
407                                      156.180,
408                                      157.180,
409                                      158.180,
410                                      159.180,
411                                      160.180,
412                                      161.180,
413                                      162.180,
414                                      163.180,
415                                      164.180,
416                                      165.180,
417                                      166.180,
418                                      167.180,
419                                      168.180,
420                                      169.180,
421                                      170.180,
422                                      171.180,
423                                      172.180,
424                                      173.180,
425                                      174.180,
426                                      175.180,
427                                      176.180,
428                                      177.180,
429                                      178.180,
430                                      179.180,
431                                      180.180,
432                                      181.180,
433                                      182.180,
434                                      183.180,
435                                      184.180,
436                                      185.180,
437                                      186.180,
438                                      187.180,
439                                      188.180,
440                                      189.180,
441                                      190.180,
442                                      191.180,
443                                      192.180,
444                                      193.180,
445                                      194.180,
446                                      195.180,
447                                      196.180,
448                                      197.180,
449                                      198.180,
450                                      199.430,
451                                      200.930,
452                                      202.430,
453                                      203.930,
454                                      205.430,
455                                      206.930,
456                                      208.430,
457                                      209.930,
458                                      211.430,
459                                      212.930,
460                                      214.430,
461                                      215.930,
462                                      217.430,
463                                      218.930,
464                                      220.430,
465                                      221.930,
466                                      223.430,
467                                      224.930,
468                                      226.430,
469                                      227.930,
470                                      229.430,
471                                      230.930,
472                                      232.430,
473                                      233.930,
474                                      235.430,
475                                      236.930,
476                                      238.430,
477                                      239.930,
478                                      241.430,
479                                      242.930,
480                                      244.430,
481                                      245.930
482 };
483
484 #if 1
485 // New  number of pads changed 2006-04-15 Jochen Thaeder
486 // changed according to formula in AliTPCROC.cxx
487 // according to real Pad Distribution on build TPC
488 Int_t AliHLTTPCTransform::fgNPads[159] = {68,
489                                      68,
490                                      68,
491                                      68,
492                                      70,
493                                      70,
494                                      70,
495                                      72,
496                                      72,
497                                      72,
498                                      74,
499                                      74,
500                                      74,
501                                      76,
502                                      76,
503                                      76,
504                                      78,
505                                      78,
506                                      78,
507                                      80,
508                                      80,
509                                      80,
510                                      82,
511                                      82,
512                                      82,
513                                      84,
514                                      84,
515                                      84,
516                                      86,
517                                      86,
518                                      86,
519                                      88,
520                                      88,
521                                      88,
522                                      90,
523                                      90,
524                                      90,
525                                      92,
526                                      92,
527                                      92,
528                                      94,
529                                      94,
530                                      94,
531                                      96,
532                                      96,
533                                      96,
534                                      98,
535                                      98,
536                                      98,
537                                      100,
538                                      100,
539                                      100,
540                                      102,
541                                      102,
542                                      102,
543                                      104,
544                                      104,
545                                      104,
546                                      106,
547                                      106,
548                                      106,
549                                      108,
550                                      108,
551                                      74,
552                                      76,
553                                      76,
554                                      76,
555                                      76,
556                                      78,
557                                      78,
558                                      78,
559                                      80,
560                                      80,
561                                      80,
562                                      80,
563                                      82,
564                                      82,
565                                      82,
566                                      84,
567                                      84,
568                                      84,
569                                      86,
570                                      86,
571                                      86,
572                                      86,
573                                      88,
574                                      88,
575                                      88,
576                                      90,
577                                      90,
578                                      90,
579                                      90,
580                                      92,
581                                      92,
582                                      92,
583                                      94,
584                                      94,
585                                      94,
586                                      96,
587                                      96,
588                                      96,
589                                      96,
590                                      98,
591                                      98,
592                                      98,
593                                      100,
594                                      100,
595                                      100,
596                                      100,
597                                      102,
598                                      102,
599                                      102,
600                                      104,
601                                      104,
602                                      104,
603                                      106,
604                                      106,
605                                      106,
606                                      106,
607                                      108,
608                                      108,
609                                      108,
610                                      110,
611                                      110,
612                                      110,
613                                      110,
614                                      112,
615                                      112,
616                                      114,
617                                      114,
618                                      114,
619                                      116,
620                                      116,
621                                      118,
622                                      118,
623                                      120,
624                                      120,
625                                      122,
626                                      122,
627                                      122,
628                                      124,
629                                      124,
630                                      126,
631                                      126,
632                                      128,
633                                      128,
634                                      130,
635                                      130,
636                                      130,
637                                      132,
638                                      132,
639                                      134,
640                                      134,
641                                      136,
642                                      136,
643                                      138,
644                                      138,
645                                      138,
646                                      140
647 };
648
649 #else
650 //   OLD  number of pads changed 2006-04-15 Jochen Thaeder
651 Int_t AliHLTTPCTransform::fgNPads[159] = {67,
652                                      67,
653                                      69,
654                                      69,
655                                      69,
656                                      71,
657                                      71,
658                                      71,
659                                      73,
660                                      73,
661                                      73,
662                                      75,
663                                      75,
664                                      75,
665                                      77,
666                                      77,
667                                      77,
668                                      79,
669                                      79,
670                                      79,
671                                      81,
672                                      81,
673                                      81,
674                                      83,
675                                      83,
676                                      83,
677                                      85,
678                                      85,
679                                      85,
680                                      87,
681                                      87,
682                                      87,
683                                      89,
684                                      89,
685                                      89,
686                                      91,
687                                      91,
688                                      91,
689                                      93,
690                                      93,
691                                      93,
692                                      95,
693                                      95,
694                                      95,
695                                      97,
696                                      97,
697                                      97,
698                                      99,
699                                      99,
700                                      99,
701                                      99,
702                                      101,
703                                      101,
704                                      101,
705                                      103,
706                                      103,
707                                      103,
708                                      105,
709                                      105,
710                                      105,
711                                      107,
712                                      107,
713                                      107,
714                                      73,
715                                      75,
716                                      75,
717                                      75,
718                                      75,
719                                      77,
720                                      77,
721                                      77,
722                                      79,
723                                      79,
724                                      79,
725                                      81,
726                                      81,
727                                      81,
728                                      81,
729                                      83,
730                                      83,
731                                      83,
732                                      85,
733                                      85,
734                                      85,
735                                      85,
736                                      87,
737                                      87,
738                                      87,
739                                      89,
740                                      89,
741                                      89,
742                                      91,
743                                      91,
744                                      91,
745                                      91,
746                                      93,
747                                      93,
748                                      93,
749                                      95,
750                                      95,
751                                      95,
752                                      95,
753                                      97,
754                                      97,
755                                      97,
756                                      99,
757                                      99,
758                                      99,
759                                      101,
760                                      101,
761                                      101,
762                                      101,
763                                      103,
764                                      103,
765                                      103,
766                                      105,
767                                      105,
768                                      105,
769                                      105,
770                                      107,
771                                      107,
772                                      107,
773                                      109,
774                                      109,
775                                      109,
776                                      111,
777                                      111,
778                                      111,
779                                      113,
780                                      113,
781                                      113,
782                                      115,
783                                      115,
784                                      117,
785                                      117,
786                                      119,
787                                      119,
788                                      121,
789                                      121,
790                                      121,
791                                      123,
792                                      123,
793                                      125,
794                                      125,
795                                      127,
796                                      127,
797                                      127,
798                                      129,
799                                      129,
800                                      131,
801                                      131,
802                                      133,
803                                      133,
804                                      135,
805                                      135,
806                                      135,
807                                      137,
808                                      137,
809                                      139
810 };
811 #endif
812
813 Double_t AliHLTTPCTransform::fgCos[36] = { 0.9848077297,
814                                       0.8660253882,
815                                       0.6427876353,
816                                       0.3420201540,
817                                       0.0000000000,
818                                       -0.3420201540,
819                                       -0.6427876353,
820                                       -0.8660253882,
821                                       -0.9848077297,
822                                       -0.9848077297,
823                                       -0.8660253882,
824                                       -0.6427876353,
825                                       -0.3420201540,
826                                       -0.0000000000,
827                                       0.3420201540,
828                                       0.6427876353,
829                                       0.8660253882,
830                                       0.9848077297,
831                                       0.9848077297,
832                                       0.8660253882,
833                                       0.6427876353,
834                                       0.3420201540,
835                                       0.0000000000,
836                                       -0.3420201540,
837                                       -0.6427876353,
838                                       -0.8660253882,
839                                       -0.9848077297,
840                                       -0.9848077297,
841                                       -0.8660253882,
842                                       -0.6427876353,
843                                       -0.3420201540,
844                                       -0.0000000000,
845                                       0.3420201540,
846                                       0.6427876353,
847                                       0.8660253882,
848                                       0.9848077297
849 };
850
851 Double_t AliHLTTPCTransform::fgSin[36] = { 0.1736481786,
852                                       0.5000000000,
853                                       0.7660444379,
854                                       0.9396926165,
855                                       1.0000000000,
856                                       0.9396926165,
857                                       0.7660444379,
858                                       0.5000000000,
859                                       0.1736481786,
860                                       -0.1736481786,
861                                       -0.5000000000,
862                                       -0.7660444379,
863                                       -0.9396926165,
864                                       -1.0000000000,
865                                       -0.9396926165,
866                                       -0.7660444379,
867                                       -0.5000000000,
868                                       -0.1736481786,
869                                       0.1736481786,
870                                       0.5000000000,
871                                       0.7660444379,
872                                       0.9396926165,
873                                       1.0000000000,
874                                       0.9396926165,
875                                       0.7660444379,
876                                       0.5000000000,
877                                       0.1736481786,
878                                       -0.1736481786,
879                                       -0.5000000000,
880                                       -0.7660444379,
881                                       -0.9396926165,
882                                       -1.0000000000,
883                                       -0.9396926165,
884                                       -0.7660444379,
885                                       -0.5000000000,
886                                       -0.1736481786
887 };
888
889 Int_t AliHLTTPCTransform::GetNPads(Int_t row)
890 {
891   //get number of pads per row
892   if(row < 0 || row >= fgNRow)
893     {
894       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetNPads","Row")
895         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
896       return 0;
897     }
898
899   return fgNPads[row];
900 }
901
902 Int_t AliHLTTPCTransform::GetNumberOfPatches() {
903   return fgNPatches;
904 }
905
906 Int_t AliHLTTPCTransform::GetFirstRow(Int_t patch)
907 {
908   //get first row per patch
909
910   if(patch==-1)
911     return 0;
912   else if(patch < -1 || patch >= 6)
913     {
914       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetFirstRow","Patch")
915         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
916       return 0;
917     }
918   else
919     return fgRows[patch][0];
920 }
921
922 Int_t AliHLTTPCTransform::GetLastRow(Int_t patch)
923 {
924   //get last row per patch
925   if(patch==-1)
926     return fgRows[5][1];
927   else if(patch < -1 || patch >= 6)
928     {
929       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetLastRow","Patch")
930         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
931       return 0;
932     }
933   else
934     return fgRows[patch][1];
935 }
936
937 Int_t AliHLTTPCTransform::GetFirstRowOnDDL(Int_t patch)
938 {
939   //get first row per patch
940
941   if(patch==-1)
942     return 0;
943   else if(patch < -1 || patch >= 6)
944     {
945       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetFirstRow","Patch")
946         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
947       return 0;
948     }
949   else
950     {
951       if(patch==1) return fgRows[patch][0]+1;
952       return fgRows[patch][0];
953     }
954 }
955
956 Int_t AliHLTTPCTransform::GetLastRowOnDDL(Int_t patch)
957 {
958   //get last row per patch
959   if(patch==-1)
960     return fgRows[5][1];
961   else if(patch < -1 || patch >= 6)
962     {
963       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetLastRow","Patch")
964         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
965       return 0;
966     }
967   else
968     {
969       if(patch==2 || patch==4) return fgRows[patch][1]-1;
970       return fgRows[patch][1];
971     }
972 }
973
974 Int_t AliHLTTPCTransform::GetNRows(Int_t patch)
975 {
976   //get number of rows per patch
977   if(patch==-1)
978     return fgNRow;
979   else if(patch < -1 || patch >= 6)
980     {
981       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetNRows","Patch")
982         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
983       return 0;
984     }
985   else
986     return fgNRows[patch];
987 }
988
989 Int_t AliHLTTPCTransform::GetPadRow(Float_t xvalue)
990 {
991   //Find the padrow number corresponding to cartesian _local_ x value
992   if(xvalue < 0 || xvalue > 250)
993     {
994       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadRow","X-value")
995         <<AliHLTTPCLog::kDec<<"Suspicious x-value, make sure it is in local coordinate! "
996         <<xvalue<<ENDLOG;
997       return -1;
998     }
999   
1000   Int_t x = (Int_t)rint(xvalue*10);
1001   if(x < (Int_t)rint(fgX[1]*10))
1002     return 0;
1003   else if(x > (Int_t)rint(fgX[fgNRow-2]*10))
1004     return fgNRow-1;
1005   else
1006     {
1007       Int_t padrow=1; //Of course, a more clever algorithm could help here
1008       while(padrow < fgNRow-2)
1009         {
1010           if(x > (Int_t)rint(fgX[padrow-1]*10) && x < (Int_t)rint(fgX[padrow+1]*10))
1011             break;
1012           padrow++;
1013         }
1014       return padrow;
1015     }
1016 }
1017
1018 Int_t AliHLTTPCTransform::GetPatch(Int_t padrow)
1019 {
1020   //get patch for padrow
1021   if(padrow < 0 || padrow >= fgNRow)
1022     {
1023       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPatch","Padrow")
1024         <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1025       return -2;
1026     }
1027   Int_t patch=0;
1028   while(patch < fgNPatches)
1029     {
1030       if(padrow >= fgRows[patch][0] && padrow <= fgRows[patch][1])
1031         break;
1032       patch++;
1033     }
1034   return patch;
1035 }
1036
1037 Double_t AliHLTTPCTransform::GetPadLength(Int_t padrow)
1038 {
1039   //get pad length for padrow
1040   if(padrow >= fgNRow){
1041       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadLength","Padrow")
1042         <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1043       return 0;
1044     }
1045
1046   if(padrow < fgNRowLow)
1047     return fgInnerPadLength;
1048   if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
1049     return fgOuter1PadLength;
1050   if(padrow >= fgNRowLow + fgNRowUp1 - 1)
1051     return fgOuter2PadLength;
1052
1053   //should never happen
1054   LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadLength","Padrow")
1055     <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1056   return -1.0; 
1057 }
1058
1059 Double_t AliHLTTPCTransform::GetPadPitchWidth(Int_t patch)
1060 {
1061   //get pad patch width for patch
1062   if(patch < 0 || patch > fgNPatches)
1063     {
1064       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPadPitchWidth","patct")
1065         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
1066       return -1;
1067     }
1068   return patch < 2 ? fgPadPitchWidthLow : fgPadPitchWidthUp;  
1069 }
1070
1071 Double_t AliHLTTPCTransform::GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle)
1072 {
1073   //Calculate the expected transverse cluster width as a function of 
1074   //drift distance and crossing angle.
1075   //z = local z-coordinate of cluster
1076   //angle = track crossing angle with normal to padrow plane
1077   //return value = sigma^2 (cartesian coordinates)
1078
1079   Double_t drift;
1080   if(z > 0)
1081     drift = fgZLength - z;
1082   else
1083     drift = fgZLength + z;
1084   
1085   Double_t t1 = GetPRFSigma(padrow)*GetPRFSigma(padrow);
1086   Double_t t2 = fgDiffT*fgDiffT*drift;
1087   Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tan(angle)*tan(angle)/12;
1088   Double_t t4 = fgkAnodeWireSpacing*fgkAnodeWireSpacing*(tan(angle) - fgOmegaTau)*(tan(angle) - fgOmegaTau)/12;
1089
1090   return (t1 + t2 + t3 + t4);
1091 }
1092
1093 Double_t AliHLTTPCTransform::GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl)
1094 {
1095   //Calculate the expected longitudinal cluster width as a function of 
1096   //drift distance and track crossing angle.
1097   //z = local z-coordinate of cluster
1098   //tgl = tan(dipangle) 
1099   //return value = sigma^2 (cartesian coordinates)
1100
1101   Double_t drift;
1102   if(z > 0)
1103     drift = AliHLTTPCTransform::GetZLength()-0.275 - z;
1104   else
1105     drift = AliHLTTPCTransform::GetZLength()-0.302 + z;
1106   
1107   Double_t t1 = fgZSigma*fgZSigma;
1108   Double_t t2 = fgDiffL*fgDiffL*drift;
1109   Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tgl*tgl/12;
1110   
1111   return (t1 + t2 + t3);
1112 }
1113
1114 Double_t AliHLTTPCTransform::GetPRFSigma(Int_t padrow)
1115 {
1116   //get sigma of pad response function for padrow
1117
1118   if(padrow >= fgNRow){
1119     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPRFSigma","Padrow")
1120       <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1121     return 0;
1122   }
1123   if(padrow < fgNRowLow)
1124     return fgInnerPRFSigma;
1125   if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
1126     return fgOuter1PRFSigma;
1127   if(padrow >= fgNRowLow + fgNRowUp1 - 1)
1128     return fgOuter2PRFSigma;
1129
1130   //should never happen
1131   LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetPRFSigma","Padrow")
1132     <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
1133   return -1.; 
1134 }
1135
1136 Double_t AliHLTTPCTransform::GetEta(Float_t *xyz)
1137 {
1138   //get eta
1139   Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
1140   Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2]));
1141   return eta;
1142 }
1143
1144 void AliHLTTPCTransform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz)
1145 {
1146   //transform xyz into rpe
1147   rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
1148   rpe[1] = atan2(xyz[1],xyz[0]);
1149   rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2]));
1150 }
1151
1152 Double_t AliHLTTPCTransform::GetEta(Int_t slice,Int_t padrow,Int_t pad,Int_t time)
1153 {
1154   //get eta
1155   Float_t xyz[3];
1156   Int_t sector,row;
1157   Slice2Sector(slice,padrow,sector,row);
1158   Raw2Local(xyz,sector,row,pad,time);
1159   
1160   return GetEta(xyz);
1161 }
1162
1163 Double_t AliHLTTPCTransform::GetPhi(Float_t *xyz)
1164 {
1165   //get phi
1166   Double_t phi = atan2(xyz[1],xyz[0]);
1167   return phi;
1168 }
1169
1170 Bool_t AliHLTTPCTransform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row)
1171 {
1172   //slice no to sector number
1173   //row no to local sector row no
1174   if(slicerow<0&&slicerow>=fgNRow){
1175     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Slice2Sector","Slicerow")
1176       <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
1177     return kFALSE;
1178   }
1179   if(slice<0||slice>=fgNSlice){
1180     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Slice2Sector","Slice")
1181       <<AliHLTTPCLog::kDec<<"Wrong slice "<<slice<<ENDLOG;
1182     return kFALSE;
1183   }
1184
1185   if(slicerow<fgNRowLow){
1186     sector = fgSlice2Sector[slice][0];
1187     row    = slicerow;
1188   }
1189   else {
1190     sector = fgSlice2Sector[slice][1];
1191     row    = slicerow-fgNRowLow;
1192   }
1193
1194   return kTRUE;
1195 }
1196
1197 Bool_t AliHLTTPCTransform::Sector2Slice(Int_t & slice, Int_t  sector)
1198 {
1199   //sector to slice
1200   if(sector<0||sector>=fgNSector){
1201     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Sector")
1202       <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
1203     return kFALSE;
1204   }
1205
1206   slice=fgSector2Slice[sector];
1207
1208   return kTRUE;
1209 }
1210
1211 Bool_t AliHLTTPCTransform::Sector2Slice(Int_t & slice, Int_t & slicerow, Int_t sector, Int_t row)
1212 {
1213   //sector to slice
1214   if(sector<0 || sector>=fgNSector){
1215     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Sector")
1216       <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
1217     return kFALSE;
1218   }
1219   if(row<0){
1220     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1221       <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1222     return kFALSE;
1223   }
1224
1225   if(fgSectorLow[sector]){
1226     if(row>=fgNRowLow){
1227       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1228         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1229       return kFALSE;
1230     }
1231     slice = fgSector2Slice[sector];
1232     slicerow = row;
1233   }
1234   else{
1235     if(row>=fgNRowUp){
1236       LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Sector2Slice","Row")
1237         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
1238       return kFALSE;
1239     }
1240     slice = fgSector2Slice[sector];
1241     slicerow = row + fgNRowLow;
1242   }
1243
1244   return kTRUE;
1245 }
1246
1247 Double_t AliHLTTPCTransform::GetMaxY(Int_t slicerow)
1248 {
1249   //get maximum y value (for slice 0)
1250   if (slicerow>=fgNRow) {
1251     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetMaxY","Slicerow")
1252       <<AliHLTTPCLog::kDec<<"slicerow out of range"<<slicerow<<ENDLOG;
1253   }
1254  if(slicerow < fgNRowLow)
1255      return fgPadPitchWidthLow*fgNPads[slicerow]/2; 
1256  
1257  else
1258      return fgPadPitchWidthUp*fgNPads[slicerow]/2;
1259
1260 }
1261
1262 Double_t AliHLTTPCTransform::Row2X(Int_t slicerow)
1263 {
1264   //slicerow to X value (slice 0)
1265   if(slicerow<0||slicerow>=fgNRow){
1266     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Row2X","Slicerow")
1267       <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
1268     return 0;
1269   }
1270   return fgX[slicerow];
1271 }
1272
1273 Double_t AliHLTTPCTransform::GetZFast(Int_t slice, Int_t time, Float_t vertex)
1274 {
1275   //get z value
1276   Double_t z=fgZWidth*time-fgZOffset;
1277   if(slice < 18)
1278     z=fgZLength-z-vertex;
1279   else
1280     z=z-fgZLength-vertex;
1281   return z;
1282 }
1283
1284 void AliHLTTPCTransform::Local2Global(Float_t *xyz,Int_t slice)
1285 {
1286   //Transformation to global coordinate system
1287   Float_t x0 = xyz[0];
1288   Float_t y0 = xyz[1];
1289
1290   xyz[0]=x0*fgCos[slice]-y0*fgSin[slice];
1291   xyz[1]=x0*fgSin[slice]+y0*fgCos[slice];
1292   //xyz[2]=xyz[2];//global z=local z
1293 }
1294
1295 void AliHLTTPCTransform::Local2GlobalAngle(Float_t *angle,Int_t slice)
1296 {
1297   //get angle global
1298   angle[0] = fmod(angle[0]+(slice+fgNRotShift)*(2*fgkPi/18),2*fgkPi);
1299 }
1300
1301 void AliHLTTPCTransform::Global2LocalAngle(Float_t *angle,Int_t slice)
1302 {
1303   //get angle local
1304   angle[0] = angle[0]-(slice+fgNRotShift)*(2*fgkPi/18);
1305   if(angle[0]<0) angle[0]+=2*fgkPi;
1306 }
1307
1308 void AliHLTTPCTransform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
1309 {
1310   //Transformation from rawdata to local coordinate system
1311   
1312   Int_t slice,slicerow;
1313   if (Sector2Slice(slice, slicerow, sector, row)==kFALSE) return;
1314
1315   //X-Value
1316   xyz[0]=Row2X(slicerow); 
1317
1318   //Y-Value
1319   if (slicerow>=fgNRow) {
1320     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::GetMaxY","Slicerow")
1321       <<AliHLTTPCLog::kDec<<"slicerow out of range"<<slicerow<<ENDLOG;
1322     return;
1323   }
1324   Int_t npads= fgNPads[slicerow];
1325
1326   if(fgSectorLow[sector])
1327     xyz[1]=(pad-0.5*(npads))*fgPadPitchWidthLow;
1328   else
1329     xyz[1]=(pad-0.5*(npads))*fgPadPitchWidthUp;
1330
1331   //Z-Value (remember PULSA Delay)
1332   if(slice < 18)
1333     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
1334   else
1335     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
1336 }
1337
1338 void AliHLTTPCTransform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Int_t pad,Int_t time)
1339 {
1340   //Transformation from rawdata to local coordinate system
1341   
1342   Int_t slice,slicerow;
1343   Sector2Slice(slice, slicerow, sector, row);  
1344
1345   //X-Value
1346   xyz[0]=Row2X(slicerow); 
1347
1348   //Y-Value
1349   Int_t npads= fgNPads[slicerow];
1350
1351   if(fgSectorLow[sector])
1352     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1353   else
1354     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1355
1356   //Z-Value (remember PULSA Delay)
1357   if(slice < 18)
1358     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
1359   else
1360     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
1361 }
1362
1363 void AliHLTTPCTransform::RawHLT2Local(Float_t *xyz,Int_t slice,
1364                                Int_t slicerow,Float_t pad,Float_t time)
1365 {
1366   //Transformation from HLT rawdata to local coordinate system
1367   
1368   //X-Value
1369   xyz[0]=Row2X(slicerow); 
1370
1371   //Y-Value
1372   Int_t npads= fgNPads[slicerow];
1373   if(slicerow<fgNRowLow)
1374     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1375   else
1376     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1377
1378   //Z-Value
1379   if(slice < 18)
1380     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
1381   else
1382     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
1383 }
1384
1385 void AliHLTTPCTransform::RawHLT2Local(Float_t *xyz,Int_t slice,
1386                                Int_t slicerow,Int_t pad,Int_t time)
1387 {
1388   //Transformation from HLT rawdata to local coordinate system
1389   
1390   //X-Value
1391   xyz[0]=Row2X(slicerow); 
1392
1393   //Y-Value
1394   Int_t npads= fgNPads[slicerow];
1395   if(slicerow<fgNRowLow)
1396     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
1397   else
1398     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
1399
1400   //Z-Value
1401   if(slice < 18)
1402     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
1403   else
1404     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
1405 }
1406
1407 void AliHLTTPCTransform::Local2Global(Float_t *xyz,Int_t sector,Int_t row)
1408 {
1409   //Transformation to global coordinate system
1410   Int_t slice,slicerow;
1411   Sector2Slice(slice, slicerow, sector, row);  
1412   Float_t r=Row2X(slicerow); //have to get x value first
1413                              
1414   xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
1415   xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
1416   //xyz[2]=xyz[2];//global z=local z
1417 }
1418
1419 void AliHLTTPCTransform::LocHLT2Global(Float_t *xyz,Int_t slice,Int_t slicerow)
1420 {
1421   //Transformation from HLT to global coordinate system
1422   Float_t r=Row2X(slicerow); //have to get x value first
1423                              
1424   xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
1425   xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
1426   //xyz[2]=xyz[2];//global z=local z
1427 }
1428
1429 void AliHLTTPCTransform::Global2Local(Float_t *xyz,Int_t sector)
1430 { //check code
1431   Int_t slice;
1432   Sector2Slice(slice, sector);  
1433
1434   Float_t x1 =  xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
1435   Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
1436   xyz[0] = x1;
1437   xyz[1] = y1;
1438 }
1439
1440 void AliHLTTPCTransform::Global2LocHLT(Float_t *xyz,Int_t slice)
1441 {
1442   Float_t x1 =  xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
1443   Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
1444   xyz[0] = x1;
1445   xyz[1] = y1;
1446 }
1447
1448 void AliHLTTPCTransform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
1449 {
1450   //Transformation from raw to global coordinates
1451  
1452   Raw2Local(xyz,sector,row,pad,time);
1453   Local2Global(xyz,sector,row);
1454 }
1455
1456 void AliHLTTPCTransform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Int_t pad,Int_t time)
1457 {
1458   //Transformation from raw to global coordinates
1459  
1460   Raw2Local(xyz,sector,row,pad,time);
1461   Local2Global(xyz,sector,row);
1462 }
1463
1464 void AliHLTTPCTransform::RawHLT2Global(Float_t *xyz,Int_t slice,
1465                                    Int_t slicerow,Float_t pad,Float_t time)
1466 {
1467   //Transformation from raw to global coordinates
1468  
1469   RawHLT2Local(xyz,slice,slicerow,pad,time);
1470   LocHLT2Global(xyz,slice,slicerow);
1471 }
1472
1473 void AliHLTTPCTransform::RawHLT2Global(Float_t *xyz,Int_t slice,
1474                                    Int_t slicerow,Int_t pad,Int_t time)
1475 {
1476   //Transformation from raw to global coordinates
1477  
1478   RawHLT2Local(xyz,slice,slicerow,pad,time);
1479   LocHLT2Global(xyz,slice,slicerow);
1480 }
1481
1482 void AliHLTTPCTransform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row)
1483 {
1484   //Transformation from local coordinates to raw
1485
1486   Int_t slice,slicerow;
1487   Sector2Slice(slice, slicerow, sector, row);  
1488    
1489   xyz[0]=slicerow;
1490
1491   if(fgSectorLow[sector])
1492     xyz[1]=xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]-1);
1493   else
1494     xyz[1]=xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]-1);
1495
1496   if(slice < 18)
1497     xyz[2]=(GetZLength()-xyz[2]+GetZOffset())/GetZWidth();
1498   else
1499     xyz[2]=(GetZLength()+xyz[2]+GetZOffset())/GetZWidth();
1500
1501   if( xyz[2]<0 ) xyz[2]=0; // protection for negative timebin values
1502 }
1503
1504 void AliHLTTPCTransform::LocHLT2Raw(Float_t *xyz,Int_t slice,Int_t slicerow)
1505 {
1506   //Transformation from local coordinates to raw
1507
1508   xyz[0]=slicerow;
1509
1510   int sign=slice<18?1:-1;
1511   if(slicerow<fgNRowLow)
1512     xyz[1]=sign*xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]);
1513   else
1514     xyz[1]=sign*xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]);
1515
1516   if(slice < 18)
1517     xyz[2]=(GetZLength()-xyz[2]+GetZOffset())/GetZWidth();
1518   else
1519     xyz[2]=(GetZLength()+xyz[2]+GetZOffset())/GetZWidth();
1520 }
1521
1522 void AliHLTTPCTransform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row)
1523 {
1524   //Transformation from global coordinates to raw. 
1525
1526   Global2Local(xyz,sector);
1527   Local2Raw(xyz,sector,row);
1528 }
1529
1530 void AliHLTTPCTransform::Global2HLT(Float_t *xyz,Int_t slice,Int_t slicerow)
1531 {
1532   //Transformation from global coordinates to raw. 
1533
1534   Global2LocHLT(xyz,slice);
1535   LocHLT2Raw(xyz,slice,slicerow);
1536 }
1537
1538 void AliHLTTPCTransform::PrintCompileOptions()
1539 {
1540   //print compile options
1541 #if defined(__GNUC__)
1542   cout << "Compiler (g++) version used: " << __GNUC__ << endl;
1543 #endif
1544
1545 #ifdef no_root
1546   cout << "STANDALONE version: -Dno_root was given." << endl;
1547 #else
1548   const Char_t *roottest="$ROOTSYS/bin/root -n -b -q  | grep Version | cut -b 17-25 | cut -d\" \" -f1";
1549 #ifdef use_aliroot
1550 #ifdef use_cvs
1551   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";
1552 #else
1553   const Char_t *aliroottest="Unknown";
1554 #endif
1555   cout << "ALIROOT version: -Duse_aliroot and -Duse_root was given." << endl;
1556   cout << "Root Version: " << ROOTVERSION << " found " << flush;
1557   gSystem->Exec(roottest);
1558
1559   cout << "AliRoot Version: " << ALIROOTVERSION << " found " << flush;
1560   gSystem->Exec(aliroottest);
1561 #else
1562   cout << "ROOT version: -Duse_root was given." << endl;
1563   cout << "Root Version: " << ROOTVERSION << " found " << flush;
1564   gSystem->Exec(roottest);
1565 #endif
1566 #endif
1567
1568 #ifdef do_mc
1569   cout << "Using Monte Carlo Info: -Ddo_mc was given." << endl;
1570 #else
1571   cout << "NOT using Monte Carlo Info: -Ddo_mc was not given." << endl;
1572 #endif
1573
1574 #ifdef INCLUDE_TPC_HOUGH
1575   cout << "Including support for TPC Hough transformations." << endl;
1576 #ifdef ROWHOUGHPARAMS
1577   cout << "Using extended AliHLTTPCTrackSegmentData: -DROWHOUGHPARAMS was given." << endl;
1578 #else
1579   cout << "NOT using extended AliHLTTPCTrackSegmentData: -DROWHOUGHPARAMS was not given." << endl;
1580 #endif
1581 #else
1582   cout << "NOT including any support for TPC Hough transformations." << endl;
1583 #endif // INCLUDE_TPC_HOUGH
1584
1585 }