LCOV - code coverage report
Current view: top level - HLT/TPCLib - AliHLTTPCGeometry.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 319 0.6 %
Date: 2016-06-14 17:26:59 Functions: 2 48 4.2 %

          Line data    Source code
       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 "AliHLTTPCGeometry.h"
      26             : 
      27             : #if defined(__GNUC__) && __GNUC__ >= 3
      28             : using namespace std;
      29             : #endif
      30             : 
      31             : /** \class AliHLTTPCGeometry 
      32             : <pre>
      33             : //_____________________________________________________________
      34             : // AliHLTTPCGeometry
      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 = AliHLTTPCGeometry::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             : //            AliHLTTPCGeometry::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             : //            AliHLTTPCGeometry::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           6 : ClassImp(AliHLTTPCGeometry)
      79             : 
      80             : AliHLTTPCGeometry::AliHLTTPCGeometry()
      81           0 : {
      82           0 : }
      83             : 
      84             : const Double_t AliHLTTPCGeometry::fgkAnodeWireSpacing = 0.25; //Taken from the TDR
      85             : const Double_t AliHLTTPCGeometry::fgkBFACT = 0.0029980;       //Conversion Factor
      86             : const Double_t AliHLTTPCGeometry::fgkPi  =   3.141592653589793;
      87             : const Double_t AliHLTTPCGeometry::fgk2Pi = 2*3.141592653589793;
      88             : const Double_t AliHLTTPCGeometry::fgkPi2 = 0.5*3.141592653589793;
      89             : const Double_t AliHLTTPCGeometry::fgkToDeg = 180/3.141592653589793;
      90             : 
      91             : //Defined by HLT and GSI
      92             : Int_t AliHLTTPCGeometry::fgNPatches = 6;
      93             : #if 0
      94             : // Old format, corresponding to IntegrTest-5 code and data
      95             : Int_t AliHLTTPCGeometry::fgRows[6][2] = {{0,29},{30,62},{63,90},{91,116},{117,139},{140,158}}; 
      96             : Int_t AliHLTTPCGeometry::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 AliHLTTPCGeometry::fgRows[6][2] = {{0,30},{30,62},{63,90},{90,116},{117,139},{139,158}}; 
     100             : Int_t AliHLTTPCGeometry::fgNRows[6] = {31,33,28,27,23,20};
     101             : #endif
     102             : 
     103             : // The following definition is generated by MakeInitFile function
     104             : Double_t AliHLTTPCGeometry::fgBField = 0.5;
     105             : Double_t AliHLTTPCGeometry::fgSolenoidBField = 5;
     106             : Double_t AliHLTTPCGeometry::fgBFieldFactor = 1;
     107             : Int_t AliHLTTPCGeometry::fgVersion = kVdefault;
     108             : Int_t AliHLTTPCGeometry::fgNTimeBins = 1024; //  = 1024; //446
     109             : Int_t AliHLTTPCGeometry::fgNRowLow = 63;
     110             : Int_t AliHLTTPCGeometry::fgNRowUp = 96;
     111             : Int_t AliHLTTPCGeometry::fgNRowUp1 = 64;
     112             : Int_t AliHLTTPCGeometry::fgNRowUp2 = 32;
     113             : Int_t AliHLTTPCGeometry::fgNSectorLow = 36;
     114             : Int_t AliHLTTPCGeometry::fgNSectorUp = 36;
     115             : Int_t AliHLTTPCGeometry::fgNSector = 72;
     116             : Double_t AliHLTTPCGeometry::fgPadPitchWidthLow = 0.4;
     117             : Double_t AliHLTTPCGeometry::fgPadPitchWidthUp = 0.6;
     118             : Double_t AliHLTTPCGeometry::fgZSigma = 0.2288;
     119             : Double_t AliHLTTPCGeometry::fgZLength = 250.0000;
     120           6 : Double_t AliHLTTPCGeometry::fgZWidth = AliHLTTPCGeometry::fgZLength / (Double_t)AliHLTTPCGeometry::fgNTimeBins ;//0.5660; // 0.2435; // 0.5660 // Width of time bins
     121             : Double_t AliHLTTPCGeometry::fgZOffset = 0.6864;
     122             : Double_t AliHLTTPCGeometry::fgDiffT = 0.0220;
     123             : Double_t AliHLTTPCGeometry::fgDiffL = 0.0220;
     124             : Double_t AliHLTTPCGeometry::fgOmegaTau = 0.1450;
     125             : Double_t AliHLTTPCGeometry::fgInnerPadLength = 0.75;
     126             : Double_t AliHLTTPCGeometry::fgOuter1PadLength = 1.00;
     127             : Double_t AliHLTTPCGeometry::fgOuter2PadLength = 1.50;
     128             : Double_t AliHLTTPCGeometry::fgInnerPRFSigma = 0.203811;
     129             : Double_t AliHLTTPCGeometry::fgOuter1PRFSigma = 0.299325;
     130             : Double_t AliHLTTPCGeometry::fgOuter2PRFSigma = 0.299323;
     131             : Double_t AliHLTTPCGeometry::fgTimeSigma = 0.228809;
     132             : Int_t AliHLTTPCGeometry::fgADCSat = 1024;
     133             : Int_t AliHLTTPCGeometry::fgZeroSup = 0;
     134             : Int_t AliHLTTPCGeometry::fgNSlice = 36;
     135             : Int_t AliHLTTPCGeometry::fgNRow = 159;
     136             : Double_t AliHLTTPCGeometry::fgNRotShift = 0.5;
     137             : Int_t AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::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 AliHLTTPCGeometry::GetNPads(Int_t row)
     890             : {
     891             :   //get number of pads per row
     892           0 :   if(row < 0 || row >= fgNRow)
     893             :     {
     894           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetNPads","Row")
     895           0 :         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
     896           0 :       return 0;
     897             :     }
     898             : 
     899           0 :   return fgNPads[row];
     900           0 : }
     901             : 
     902             : Int_t AliHLTTPCGeometry::GetNumberOfPatches() {
     903           0 :   return fgNPatches;
     904             : }
     905             : 
     906             : Int_t AliHLTTPCGeometry::GetFirstRow(Int_t patch)
     907             : {
     908             :   //get first row per patch
     909             : 
     910           0 :   if(patch==-1)
     911           0 :     return 0;
     912           0 :   else if(patch < -1 || patch >= 6)
     913             :     {
     914           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetFirstRow","Patch")
     915           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
     916           0 :       return 0;
     917             :     }
     918             :   else
     919           0 :     return fgRows[patch][0];
     920           0 : }
     921             : 
     922             : Int_t AliHLTTPCGeometry::GetLastRow(Int_t patch)
     923             : {
     924             :   //get last row per patch
     925           0 :   if(patch==-1)
     926           0 :     return fgRows[5][1];
     927           0 :   else if(patch < -1 || patch >= 6)
     928             :     {
     929           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetLastRow","Patch")
     930           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
     931           0 :       return 0;
     932             :     }
     933             :   else
     934           0 :     return fgRows[patch][1];
     935           0 : }
     936             : 
     937             : Int_t AliHLTTPCGeometry::GetFirstRowOnDDL(Int_t patch)
     938             : {
     939             :   //get first row per patch
     940             : 
     941           0 :   if(patch==-1)
     942           0 :     return 0;
     943           0 :   else if(patch < -1 || patch >= 6)
     944             :     {
     945           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetFirstRow","Patch")
     946           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
     947           0 :       return 0;
     948             :     }
     949             :   else
     950             :     {
     951           0 :       if(patch==1) return fgRows[patch][0]+1;
     952           0 :       return fgRows[patch][0];
     953             :     }
     954           0 : }
     955             : 
     956             : Int_t AliHLTTPCGeometry::GetLastRowOnDDL(Int_t patch)
     957             : {
     958             :   //get last row per patch
     959           0 :   if(patch==-1)
     960           0 :     return fgRows[5][1];
     961           0 :   else if(patch < -1 || patch >= 6)
     962             :     {
     963           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetLastRow","Patch")
     964           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
     965           0 :       return 0;
     966             :     }
     967             :   else
     968             :     {
     969           0 :       if(patch==2 || patch==4) return fgRows[patch][1]-1;
     970           0 :       return fgRows[patch][1];
     971             :     }
     972           0 : }
     973             : 
     974             : Int_t AliHLTTPCGeometry::GetNRows(Int_t patch)
     975             : {
     976             :   //get number of rows per patch
     977           0 :   if(patch==-1)
     978           0 :     return fgNRow;
     979           0 :   else if(patch < -1 || patch >= 6)
     980             :     {
     981           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetNRows","Patch")
     982           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
     983           0 :       return 0;
     984             :     }
     985             :   else
     986           0 :     return fgNRows[patch];
     987           0 : }
     988             : 
     989             : Int_t AliHLTTPCGeometry::GetPadRow(Float_t xvalue)
     990             : {
     991             :   //Find the padrow number corresponding to cartesian _local_ x value
     992           0 :   if(xvalue < 0 || xvalue > 250)
     993             :     {
     994           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPadRow","X-value")
     995           0 :         <<AliHLTTPCLog::kDec<<"Suspicious x-value, make sure it is in local coordinate! "
     996           0 :         <<xvalue<<ENDLOG;
     997           0 :       return -1;
     998             :     }
     999             :   
    1000           0 :   Int_t x = (Int_t)rint(xvalue*10);
    1001           0 :   if(x < (Int_t)rint(fgX[1]*10))
    1002           0 :     return 0;
    1003           0 :   else if(x > (Int_t)rint(fgX[fgNRow-2]*10))
    1004           0 :     return fgNRow-1;
    1005             :   else
    1006             :     {
    1007             :       Int_t padrow=1; //Of course, a more clever algorithm could help here
    1008           0 :       while(padrow < fgNRow-2)
    1009             :         {
    1010           0 :           if(x > (Int_t)rint(fgX[padrow-1]*10) && x < (Int_t)rint(fgX[padrow+1]*10))
    1011             :             break;
    1012           0 :           padrow++;
    1013             :         }
    1014             :       return padrow;
    1015             :     }
    1016           0 : }
    1017             : 
    1018             : Int_t AliHLTTPCGeometry::GetPatch(Int_t padrow)
    1019             : {
    1020             :   //get patch for padrow
    1021           0 :   if(padrow < 0 || padrow >= fgNRow)
    1022             :     {
    1023           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPatch","Padrow")
    1024           0 :         <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
    1025           0 :       return -2;
    1026             :     }
    1027             :   Int_t patch=0;
    1028           0 :   while(patch < fgNPatches)
    1029             :     {
    1030           0 :       if(padrow >= fgRows[patch][0] && padrow <= fgRows[patch][1])
    1031             :         break;
    1032           0 :       patch++;
    1033             :     }
    1034             :   return patch;
    1035           0 : }
    1036             : 
    1037             : Double_t AliHLTTPCGeometry::GetPadLength(Int_t padrow)
    1038             : {
    1039             :   //get pad length for padrow
    1040           0 :   if(padrow >= fgNRow){
    1041           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPadLength","Padrow")
    1042           0 :         <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
    1043           0 :       return 0;
    1044             :     }
    1045             : 
    1046           0 :   if(padrow < fgNRowLow)
    1047           0 :     return fgInnerPadLength;
    1048           0 :   if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
    1049           0 :     return fgOuter1PadLength;
    1050           0 :   if(padrow >= fgNRowLow + fgNRowUp1 - 1)
    1051           0 :     return fgOuter2PadLength;
    1052             : 
    1053             :   //should never happen
    1054           0 :   LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPadLength","Padrow")
    1055           0 :     <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
    1056           0 :   return -1.0; 
    1057           0 : }
    1058             : 
    1059             : Double_t AliHLTTPCGeometry::GetPadPitchWidth(Int_t patch)
    1060             : {
    1061             :   //get pad patch width for patch
    1062           0 :   if(patch < 0 || patch > fgNPatches)
    1063             :     {
    1064           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPadPitchWidth","patct")
    1065           0 :         <<AliHLTTPCLog::kDec<<"Wrong patch "<<patch<<ENDLOG;
    1066           0 :       return -1;
    1067             :     }
    1068           0 :   return patch < 2 ? fgPadPitchWidthLow : fgPadPitchWidthUp;  
    1069           0 : }
    1070             : 
    1071             : Double_t AliHLTTPCGeometry::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           0 :   if(z > 0)
    1081           0 :     drift = fgZLength - z;
    1082             :   else
    1083           0 :     drift = fgZLength + z;
    1084             :   
    1085           0 :   Double_t t1 = GetPRFSigma(padrow)*GetPRFSigma(padrow);
    1086           0 :   Double_t t2 = fgDiffT*fgDiffT*drift;
    1087           0 :   Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tan(angle)*tan(angle)/12;
    1088           0 :   Double_t t4 = fgkAnodeWireSpacing*fgkAnodeWireSpacing*(tan(angle) - fgOmegaTau)*(tan(angle) - fgOmegaTau)/12;
    1089             : 
    1090           0 :   return (t1 + t2 + t3 + t4);
    1091             : }
    1092             : 
    1093             : Double_t AliHLTTPCGeometry::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           0 :   if(z > 0)
    1103           0 :     drift = AliHLTTPCGeometry::GetZLength()-0.275 - z;
    1104             :   else
    1105           0 :     drift = AliHLTTPCGeometry::GetZLength()-0.302 + z;
    1106             :   
    1107           0 :   Double_t t1 = fgZSigma*fgZSigma;
    1108           0 :   Double_t t2 = fgDiffL*fgDiffL*drift;
    1109           0 :   Double_t t3 = GetPadLength(padrow)*GetPadLength(padrow)*tgl*tgl/12;
    1110             :   
    1111           0 :   return (t1 + t2 + t3);
    1112             : }
    1113             : 
    1114             : Double_t AliHLTTPCGeometry::GetPRFSigma(Int_t padrow)
    1115             : {
    1116             :   //get sigma of pad response function for padrow
    1117             : 
    1118           0 :   if(padrow >= fgNRow){
    1119           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPRFSigma","Padrow")
    1120           0 :       <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
    1121           0 :     return 0;
    1122             :   }
    1123           0 :   if(padrow < fgNRowLow)
    1124           0 :     return fgInnerPRFSigma;
    1125           0 :   if(padrow >= fgNRowLow && padrow < fgNRowLow + fgNRowUp1 - 1)
    1126           0 :     return fgOuter1PRFSigma;
    1127           0 :   if(padrow >= fgNRowLow + fgNRowUp1 - 1)
    1128           0 :     return fgOuter2PRFSigma;
    1129             : 
    1130             :   //should never happen
    1131           0 :   LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetPRFSigma","Padrow")
    1132           0 :     <<AliHLTTPCLog::kDec<<"Wrong padrow "<<padrow<<ENDLOG;
    1133           0 :   return -1.; 
    1134           0 : }
    1135             : 
    1136             : Double_t AliHLTTPCGeometry::GetEta(Float_t *xyz)
    1137             : {
    1138             :   //get eta
    1139           0 :   Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
    1140           0 :   Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2]));
    1141           0 :   return eta;
    1142             : }
    1143             : 
    1144             : void AliHLTTPCGeometry::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz)
    1145             : {
    1146             :   //transform xyz into rpe
    1147           0 :   rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
    1148           0 :   rpe[1] = atan2(xyz[1],xyz[0]);
    1149           0 :   rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2]));
    1150           0 : }
    1151             : 
    1152             : Double_t AliHLTTPCGeometry::GetEta(Int_t slice,Int_t padrow,Int_t pad,Int_t time)
    1153             : {
    1154             :   //get eta
    1155           0 :   Float_t xyz[3];
    1156           0 :   Int_t sector,row;
    1157           0 :   Slice2Sector(slice,padrow,sector,row);
    1158           0 :   Raw2Local(xyz,sector,row,pad,time);
    1159             :   
    1160           0 :   return GetEta(xyz);
    1161           0 : }
    1162             : 
    1163             : Double_t AliHLTTPCGeometry::GetPhi(Float_t *xyz)
    1164             : {
    1165             :   //get phi
    1166           0 :   Double_t phi = atan2(xyz[1],xyz[0]);
    1167           0 :   return phi;
    1168             : }
    1169             : 
    1170             : Bool_t AliHLTTPCGeometry::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           0 :   if(slicerow<0&&slicerow>=fgNRow){
    1175           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Slice2Sector","Slicerow")
    1176           0 :       <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
    1177           0 :     return kFALSE;
    1178             :   }
    1179           0 :   if(slice<0||slice>=fgNSlice){
    1180           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Slice2Sector","Slice")
    1181           0 :       <<AliHLTTPCLog::kDec<<"Wrong slice "<<slice<<ENDLOG;
    1182           0 :     return kFALSE;
    1183             :   }
    1184             : 
    1185           0 :   if(slicerow<fgNRowLow){
    1186           0 :     sector = fgSlice2Sector[slice][0];
    1187           0 :     row    = slicerow;
    1188           0 :   }
    1189             :   else {
    1190           0 :     sector = fgSlice2Sector[slice][1];
    1191           0 :     row    = slicerow-fgNRowLow;
    1192             :   }
    1193             : 
    1194           0 :   return kTRUE;
    1195           0 : }
    1196             : 
    1197             : Bool_t AliHLTTPCGeometry::Sector2Slice(Int_t & slice, Int_t  sector)
    1198             : {
    1199             :   //sector to slice
    1200           0 :   if(sector<0||sector>=fgNSector){
    1201           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Sector2Slice","Sector")
    1202           0 :       <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
    1203           0 :     return kFALSE;
    1204             :   }
    1205             : 
    1206           0 :   slice=fgSector2Slice[sector];
    1207             : 
    1208           0 :   return kTRUE;
    1209           0 : }
    1210             : 
    1211             : Bool_t AliHLTTPCGeometry::Sector2Slice(Int_t & slice, Int_t & slicerow, Int_t sector, Int_t row)
    1212             : {
    1213             :   //sector to slice
    1214           0 :   if(sector<0 || sector>=fgNSector){
    1215           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Sector2Slice","Sector")
    1216           0 :       <<AliHLTTPCLog::kDec<<"Wrong sector "<<sector<<ENDLOG;
    1217           0 :     return kFALSE;
    1218             :   }
    1219           0 :   if(row<0){
    1220           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Sector2Slice","Row")
    1221           0 :       <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
    1222           0 :     return kFALSE;
    1223             :   }
    1224             : 
    1225           0 :   if(fgSectorLow[sector]){
    1226           0 :     if(row>=fgNRowLow){
    1227           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Sector2Slice","Row")
    1228           0 :         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
    1229           0 :       return kFALSE;
    1230             :     }
    1231           0 :     slice = fgSector2Slice[sector];
    1232           0 :     slicerow = row;
    1233           0 :   }
    1234             :   else{
    1235           0 :     if(row>=fgNRowUp){
    1236           0 :       LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Sector2Slice","Row")
    1237           0 :         <<AliHLTTPCLog::kDec<<"Wrong row "<<row<<ENDLOG;
    1238           0 :       return kFALSE;
    1239             :     }
    1240           0 :     slice = fgSector2Slice[sector];
    1241           0 :     slicerow = row + fgNRowLow;
    1242             :   }
    1243             : 
    1244           0 :   return kTRUE;
    1245           0 : }
    1246             : 
    1247             : Double_t AliHLTTPCGeometry::GetMaxY(Int_t slicerow)
    1248             : {
    1249             :   //get maximum y value (for slice 0)
    1250           0 :   if (slicerow>=fgNRow) {
    1251           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetMaxY","Slicerow")
    1252           0 :       <<AliHLTTPCLog::kDec<<"slicerow out of range"<<slicerow<<ENDLOG;
    1253             :   }
    1254           0 :  if(slicerow < fgNRowLow)
    1255           0 :      return fgPadPitchWidthLow*fgNPads[slicerow]/2; 
    1256             :  
    1257             :  else
    1258           0 :      return fgPadPitchWidthUp*fgNPads[slicerow]/2;
    1259             : 
    1260           0 : }
    1261             : 
    1262             : Double_t AliHLTTPCGeometry::Row2X(Int_t slicerow)
    1263             : {
    1264             :   //slicerow to X value (slice 0)
    1265           0 :   if(slicerow<0||slicerow>=fgNRow){
    1266           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::Row2X","Slicerow")
    1267           0 :       <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
    1268           0 :     return 0;
    1269             :   }
    1270           0 :   return fgX[slicerow];
    1271           0 : }
    1272             : 
    1273             : Double_t AliHLTTPCGeometry::GetZFast(Int_t slice, Int_t time, Float_t vertex)
    1274             : {
    1275             :   //get z value
    1276           0 :   Double_t z=fgZWidth*time-fgZOffset;
    1277           0 :   if(slice < 18)
    1278           0 :     z=fgZLength-z-vertex;
    1279             :   else
    1280           0 :     z=z-fgZLength-vertex;
    1281           0 :   return z;
    1282             : }
    1283             : 
    1284             : void AliHLTTPCGeometry::Local2Global(Float_t *xyz,Int_t slice)
    1285             : {
    1286             :   //Transformation to global coordinate system
    1287           0 :   Float_t x0 = xyz[0];
    1288           0 :   Float_t y0 = xyz[1];
    1289             : 
    1290           0 :   xyz[0]=x0*fgCos[slice]-y0*fgSin[slice];
    1291           0 :   xyz[1]=x0*fgSin[slice]+y0*fgCos[slice];
    1292             :   //xyz[2]=xyz[2];//global z=local z
    1293           0 : }
    1294             : 
    1295             : void AliHLTTPCGeometry::Local2GlobalAngle(Float_t *angle,Int_t slice)
    1296             : {
    1297             :   //get angle global
    1298           0 :   angle[0] = fmod(angle[0]+(slice+fgNRotShift)*(2*fgkPi/18),2*fgkPi);
    1299           0 : }
    1300             : 
    1301             : void AliHLTTPCGeometry::Global2LocalAngle(Float_t *angle,Int_t slice)
    1302             : {
    1303             :   //get angle local
    1304           0 :   angle[0] = angle[0]-(slice+fgNRotShift)*(2*fgkPi/18);
    1305           0 :   if(angle[0]<0) angle[0]+=2*fgkPi;
    1306           0 : }
    1307             : 
    1308             : void AliHLTTPCGeometry::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           0 :   Int_t slice,slicerow;
    1313           0 :   if (Sector2Slice(slice, slicerow, sector, row)==kFALSE) return;
    1314             : 
    1315             :   //X-Value
    1316           0 :   xyz[0]=Row2X(slicerow); 
    1317             : 
    1318             :   //Y-Value
    1319           0 :   if (slicerow>=fgNRow) {
    1320           0 :     LOG(AliHLTTPCLog::kError,"AliHLTTPCGeometry::GetMaxY","Slicerow")
    1321           0 :       <<AliHLTTPCLog::kDec<<"slicerow out of range"<<slicerow<<ENDLOG;
    1322           0 :     return;
    1323             :   }
    1324           0 :   Int_t npads= fgNPads[slicerow];
    1325             : 
    1326           0 :   if(fgSectorLow[sector])
    1327           0 :     xyz[1]=(pad-0.5*(npads))*fgPadPitchWidthLow;
    1328             :   else
    1329           0 :     xyz[1]=(pad-0.5*(npads))*fgPadPitchWidthUp;
    1330             : 
    1331             :   //Z-Value (remember PULSA Delay)
    1332           0 :   if(slice < 18)
    1333           0 :     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
    1334             :   else
    1335           0 :     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
    1336           0 : }
    1337             : 
    1338             : void AliHLTTPCGeometry::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           0 :   Int_t slice,slicerow;
    1343           0 :   Sector2Slice(slice, slicerow, sector, row);  
    1344             : 
    1345             :   //X-Value
    1346           0 :   xyz[0]=Row2X(slicerow); 
    1347             : 
    1348             :   //Y-Value
    1349           0 :   Int_t npads= fgNPads[slicerow];
    1350             : 
    1351           0 :   if(fgSectorLow[sector])
    1352           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
    1353             :   else
    1354           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
    1355             : 
    1356             :   //Z-Value (remember PULSA Delay)
    1357           0 :   if(slice < 18)
    1358           0 :     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
    1359             :   else
    1360           0 :     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
    1361           0 : }
    1362             : 
    1363             : void AliHLTTPCGeometry::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           0 :   xyz[0]=Row2X(slicerow); 
    1370             : 
    1371             :   //Y-Value
    1372           0 :   Int_t npads= fgNPads[slicerow];
    1373           0 :   if(slicerow<fgNRowLow)
    1374           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
    1375             :   else
    1376           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
    1377             : 
    1378             :   //Z-Value
    1379           0 :   if(slice < 18)
    1380           0 :     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
    1381             :   else
    1382           0 :     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
    1383           0 : }
    1384             : 
    1385             : void AliHLTTPCGeometry::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           0 :   xyz[0]=Row2X(slicerow); 
    1392             : 
    1393             :   //Y-Value
    1394           0 :   Int_t npads= fgNPads[slicerow];
    1395           0 :   if(slicerow<fgNRowLow)
    1396           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthLow;
    1397             :   else
    1398           0 :     xyz[1]=(pad-0.5*(npads-1))*fgPadPitchWidthUp;
    1399             : 
    1400             :   //Z-Value
    1401           0 :   if(slice < 18)
    1402           0 :     xyz[2]=GetZLength()-GetZWidth()*time+GetZOffset();
    1403             :   else
    1404           0 :     xyz[2]=GetZWidth()*time-GetZOffset()-GetZLength();
    1405           0 : }
    1406             : 
    1407             : void AliHLTTPCGeometry::Local2Global(Float_t *xyz,Int_t sector,Int_t row)
    1408             : {
    1409             :   //Transformation to global coordinate system
    1410           0 :   Int_t slice,slicerow;
    1411           0 :   Sector2Slice(slice, slicerow, sector, row);  
    1412           0 :   Float_t r=Row2X(slicerow); //have to get x value first
    1413             :                              
    1414           0 :   xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
    1415           0 :   xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
    1416             :   //xyz[2]=xyz[2];//global z=local z
    1417           0 : }
    1418             : 
    1419             : void AliHLTTPCGeometry::LocHLT2Global(Float_t *xyz,Int_t slice,Int_t slicerow)
    1420             : {
    1421             :   //Transformation from HLT to global coordinate system
    1422           0 :   Float_t r=Row2X(slicerow); //have to get x value first
    1423             :                              
    1424           0 :   xyz[0]=r*fgCos[slice]-xyz[1]*fgSin[slice];
    1425           0 :   xyz[1]=r*fgSin[slice]+xyz[1]*fgCos[slice];
    1426             :   //xyz[2]=xyz[2];//global z=local z
    1427           0 : }
    1428             : 
    1429             : void AliHLTTPCGeometry::Global2Local(Float_t *xyz,Int_t sector)
    1430             : { //check code
    1431           0 :   Int_t slice;
    1432           0 :   Sector2Slice(slice, sector);  
    1433             : 
    1434           0 :   Float_t x1 =  xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
    1435           0 :   Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
    1436           0 :   xyz[0] = x1;
    1437           0 :   xyz[1] = y1;
    1438           0 : }
    1439             : 
    1440             : void AliHLTTPCGeometry::Global2LocHLT(Float_t *xyz,Int_t slice)
    1441             : {
    1442           0 :   Float_t x1 =  xyz[0]*fgCos[slice] + xyz[1]*fgSin[slice];
    1443           0 :   Float_t y1 = -xyz[0]*fgSin[slice] + xyz[1]*fgCos[slice];
    1444           0 :   xyz[0] = x1;
    1445           0 :   xyz[1] = y1;
    1446           0 : }
    1447             : 
    1448             : void AliHLTTPCGeometry::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           0 :   Raw2Local(xyz,sector,row,pad,time);
    1453           0 :   Local2Global(xyz,sector,row);
    1454           0 : }
    1455             : 
    1456             : void AliHLTTPCGeometry::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           0 :   Raw2Local(xyz,sector,row,pad,time);
    1461           0 :   Local2Global(xyz,sector,row);
    1462           0 : }
    1463             : 
    1464             : void AliHLTTPCGeometry::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           0 :   RawHLT2Local(xyz,slice,slicerow,pad,time);
    1470           0 :   LocHLT2Global(xyz,slice,slicerow);
    1471           0 : }
    1472             : 
    1473             : void AliHLTTPCGeometry::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           0 :   RawHLT2Local(xyz,slice,slicerow,pad,time);
    1479           0 :   LocHLT2Global(xyz,slice,slicerow);
    1480           0 : }
    1481             : 
    1482             : void AliHLTTPCGeometry::Local2Raw(Float_t *xyz,Int_t sector,Int_t row)
    1483             : {
    1484             :   //Transformation from local coordinates to raw
    1485             : 
    1486           0 :   Int_t slice,slicerow;
    1487           0 :   Sector2Slice(slice, slicerow, sector, row);  
    1488             :    
    1489           0 :   xyz[0]=slicerow;
    1490             : 
    1491           0 :   if(fgSectorLow[sector])
    1492           0 :     xyz[1]=xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]-1);
    1493             :   else
    1494           0 :     xyz[1]=xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]-1);
    1495             : 
    1496           0 :   if(slice < 18)
    1497           0 :     xyz[2]=(GetZLength()-xyz[2]+GetZOffset())/GetZWidth();
    1498             :   else
    1499           0 :     xyz[2]=(GetZLength()+xyz[2]+GetZOffset())/GetZWidth();
    1500             : 
    1501           0 :   if( xyz[2]<0 ) xyz[2]=0; // protection for negative timebin values
    1502           0 : }
    1503             : 
    1504             : void AliHLTTPCGeometry::LocHLT2Raw(Float_t *xyz,Int_t slice,Int_t slicerow)
    1505             : {
    1506             :   //Transformation from local coordinates to raw
    1507             : 
    1508           0 :   xyz[0]=slicerow;
    1509             : 
    1510           0 :   int sign=slice<18?1:-1;
    1511           0 :   if(slicerow<fgNRowLow)
    1512           0 :     xyz[1]=sign*xyz[1]/fgPadPitchWidthLow+0.5*(fgNPads[slicerow]);
    1513             :   else
    1514           0 :     xyz[1]=sign*xyz[1]/fgPadPitchWidthUp+0.5*(fgNPads[slicerow]);
    1515             : 
    1516           0 :   if(slice < 18)
    1517           0 :     xyz[2]=(GetZLength()-xyz[2]+GetZOffset())/GetZWidth();
    1518             :   else
    1519           0 :     xyz[2]=(GetZLength()+xyz[2]+GetZOffset())/GetZWidth();
    1520           0 : }
    1521             : 
    1522             : void AliHLTTPCGeometry::Global2Raw(Float_t *xyz,Int_t sector,Int_t row)
    1523             : {
    1524             :   //Transformation from global coordinates to raw. 
    1525             : 
    1526           0 :   Global2Local(xyz,sector);
    1527           0 :   Local2Raw(xyz,sector,row);
    1528           0 : }
    1529             : 
    1530             : void AliHLTTPCGeometry::Global2HLT(Float_t *xyz,Int_t slice,Int_t slicerow)
    1531             : {
    1532             :   //Transformation from global coordinates to raw. 
    1533             : 
    1534           0 :   Global2LocHLT(xyz,slice);
    1535           0 :   LocHLT2Raw(xyz,slice,slicerow);
    1536           0 : }
    1537             : 
    1538             : void AliHLTTPCGeometry::PrintCompileOptions()
    1539             : {
    1540             : //deprecated; to be removed
    1541           0 : }

Generated by: LCOV version 1.11