Line data Source code
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 "AliHLTTPCGeometry.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 : /** Initialisation */
53 : Int_t Init( const AliHLTTPCFastTransformObject &obj );
54 :
55 : /** Initialised flag */
56 : Bool_t IsInitialised() const;
57 :
58 : /** Deinitialisation */
59 : void DeInit();
60 :
61 : /** Setting the current time stamp */
62 : Int_t SetCurrentTimeStamp( Long_t TimeStamp );
63 :
64 : /** Returns the current time stamp */
65 0 : Long_t GetCurrentTimeStamp() const { return fFastTransform.GetCurrentTimeStamp(); }
66 :
67 : /** Transformation: calibration and alignment*/
68 : Int_t Transform( int Slice, int Row, float Pad, float Time, float XYZ[] );
69 :
70 : /** Applying reverse alignment */
71 : int ReverseAlignment( float XYZ[], int slice, int padrow);
72 :
73 : /** Last error message */
74 0 : const char* GetLastError() const { return fError.Data(); }
75 :
76 : /** Printout */
77 : void Print(const char* option=NULL) const;
78 :
79 : /** total size of the object*/
80 : Int_t GetSize() const ;
81 :
82 0 : const AliHLTTPCFastTransform& GetFastTransform(){ return fFastTransform; }
83 :
84 0 : AliHLTTPCFastTransform& GetFastTransformNonConst(){ return fFastTransform; }
85 :
86 0 : void SetInitSec(Int_t min, Int_t max) {fFastTransform.SetInitSec(min, max);}
87 :
88 : private:
89 :
90 : /** copy constructor prohibited */
91 : AliHLTTPCClusterTransformation(const AliHLTTPCClusterTransformation&);
92 : /** assignment operator prohibited */
93 : AliHLTTPCClusterTransformation& operator=(const AliHLTTPCClusterTransformation&);
94 :
95 : /** Set error string */
96 : Int_t Error(Int_t code, const char *msg);
97 :
98 : static AliRecoParam fOfflineRecoParam; //! static container for TPC Reco Param
99 :
100 : TString fError; // Last error message
101 :
102 : AliHLTTPCFastTransform fFastTransform;// fast transformation object
103 :
104 6 : ClassDef(AliHLTTPCClusterTransformation, 1)
105 : };
106 :
107 : inline Int_t AliHLTTPCClusterTransformation::Error(Int_t code, const char *msg)
108 : {
109 : // Set error
110 0 : fError = msg;
111 0 : return code;
112 : }
113 :
114 : inline Int_t AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] )
115 : {
116 : // Convert row, pad, time to X Y Z
117 0 : Int_t sector=-99, thisrow=-99;
118 0 : AliHLTTPCGeometry::Slice2Sector( Slice, Row, sector, thisrow);
119 0 : int err = fFastTransform.Transform(sector, thisrow, Pad, Time, XYZ);
120 0 : if( err!=0 ) return Error(-1,Form( "AliHLTTPCClusterTransformation::Transform: Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) );
121 0 : return 0;
122 0 : }
123 :
124 : inline Int_t AliHLTTPCClusterTransformation::ReverseAlignment( float XYZ[], int slice, int padrow)
125 : {
126 : // reverse the alignment correction
127 0 : Int_t sector=-99, thisrow=-99;
128 0 : AliHLTTPCGeometry::Slice2Sector( slice, padrow, sector, thisrow);
129 0 : int err = fFastTransform.ReverseAlignment(sector, XYZ);
130 0 : if( err!=0 ) return Error(-1,Form( "AliHLTTPCClusterTransformation::ReverseAlignment: Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) );
131 0 : return 0;
132 0 : }
133 : #endif
|