]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCClusterTransformation.h
bugfix AliHLTCompStatCollector: filling entry 'Level' of the component statistics...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterTransformation.h
1 // -*- Mode: C++ -*-
2 // $Id: AliHLTTPCClusterTransformation.h 40939 2010-05-04 15:35:58Z kkanaki $
3
4 #ifndef ALIHLTTPCCLUSTERTRANSFORMATION_H
5 #define ALIHLTTPCCLUSTERTRANSFORMATION_H
6
7 //* This file is property of and copyright by the ALICE HLT Project        * 
8 //* ALICE Experiment at CERN, All rights reserved.                         *
9 //* See cxx source for full Copyright notice                               *
10
11 /** @file   AliHLTTPCClusterTransformation.h
12     @author Kalliopi Kanaki, Sergey Gorbunov
13     @date   
14     @brief
15 */
16
17 // see below for class documentation
18 // or
19 // refer to README to build package
20 // or
21 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
22
23 #include "Rtypes.h"
24 #include "TString.h"
25 #include "AliHLTTPCTransform.h"
26 #include "AliHLTTPCFastTransform.h"
27
28 class AliTPCParam;
29 class AliRecoParam;
30
31 /**
32  * @class AliHLTTPCClusterTransformation
33  *
34  * The class transforms internal TPC coordinates (pad,time) to XYZ.
35  * Allnecessary calibration and alignment corrections are applied
36  * 
37  * @ingroup alihlt_tpc_components
38  */
39
40 class AliHLTTPCClusterTransformation{
41     
42  public:
43
44   /** standard constructor */    
45   AliHLTTPCClusterTransformation();           
46   /** destructor */
47   virtual ~AliHLTTPCClusterTransformation();
48
49   /** Initialisation  */
50   Int_t  Init( double FieldBz, Long_t TimeStamp );
51
52   /** Initialised flag */
53    Bool_t IsInitialised() const;
54
55   /** Deinitialisation  */
56    void DeInit();
57
58   /** Setting the current time stamp  */
59   Int_t SetCurrentTimeStamp( Long_t TimeStamp );
60  
61   /** Returns the current time stamp  */
62   Long_t GetCurrentTimeStamp() const { return fFastTransform.GetCurrentTimeStamp(); }
63
64   /** Transformation: calibration and alignment*/
65   Int_t  Transform( int Slice, int Row, float Pad, float Time, float XYZ[] );
66
67   /** Applying reverse alignment */
68   int  ReverseAlignment( float XYZ[], int slice, int padrow);
69
70   /** Last error message */
71   const char* GetLastError() const { return fError.Data(); }
72
73   /** Printout */
74   void Print(const char* option=NULL) const;
75
76   /** total size of the object*/
77   Int_t GetSize() const ;
78
79  private:
80
81   /** copy constructor prohibited */
82   AliHLTTPCClusterTransformation(const AliHLTTPCClusterTransformation&);
83   /** assignment operator prohibited */
84   AliHLTTPCClusterTransformation& operator=(const AliHLTTPCClusterTransformation&);
85
86  /** Set error string */
87   Int_t Error(Int_t code, const char *msg);
88
89   static AliRecoParam    fOfflineRecoParam;  //! static container for TPC Reco Param
90
91   TString fError; // Last error message
92
93   AliHLTTPCFastTransform fFastTransform;// fast transformation object
94
95   ClassDef(AliHLTTPCClusterTransformation, 1)
96 };
97
98 inline Int_t AliHLTTPCClusterTransformation::Error(Int_t code, const char *msg)
99 {
100   // Set error 
101   fError = msg;
102   return code;
103 }
104
105 inline Int_t  AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] )
106 {
107   // Convert row, pad, time to X Y Z       
108   Int_t sector=-99, thisrow=-99;  
109   AliHLTTPCTransform::Slice2Sector( Slice, Row, sector, thisrow);
110   int err = fFastTransform.Transform(sector, thisrow, Pad, Time, XYZ);
111   if( err!=0 ) return Error(-1,Form( "AliHLTTPCClusterTransformation::Transform: Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) );
112   return 0;
113 }
114
115 inline Int_t  AliHLTTPCClusterTransformation::ReverseAlignment( float XYZ[], int slice, int padrow)
116 {
117   // reverse the alignment correction
118   Int_t sector=-99, thisrow=-99;
119   AliHLTTPCTransform::Slice2Sector( slice, padrow, sector, thisrow);
120   int err = fFastTransform.ReverseAlignment(sector, XYZ);
121   if( err!=0 ) return Error(-1,Form( "AliHLTTPCClusterTransformation::ReverseAlignment: Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) );
122   return 0;
123 }
124 #endif