Line data Source code
1 : #ifndef ALIHLTTPCSPLINE2D3DOBJECT_H
2 : #define ALIHLTTPCSPLINE2D3DOBJECT_H
3 :
4 : //* This file is property of and copyright by the ALICE HLT Project *
5 : //* ALICE Experiment at CERN, All rights reserved. *
6 : //* See cxx source for full Copyright notice *
7 :
8 : /** @file AliHLTTPCSpline2D3DObject.h
9 : @author Sergey Gorbunov
10 : @date
11 : @brief
12 : */
13 :
14 : // see below for class documentation
15 : // or
16 : // refer to README to build package
17 : // or
18 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
19 :
20 : #include "TObject.h"
21 : #include "TArrayF.h"
22 :
23 : /**
24 : * @class AliHLTTPCSpline2D3DObject
25 : *
26 : * The class presents spline interpolation for 2D->3D function (a,b)->(x,y,z) to be stored in ROOT file
27 : *
28 : * @ingroup alihlt_tpc_components
29 : */
30 :
31 : class AliHLTTPCSpline2D3DObject: public TObject{
32 : public:
33 : /** standard constructor */
34 : AliHLTTPCSpline2D3DObject();
35 :
36 : /** constructor */
37 : AliHLTTPCSpline2D3DObject( const AliHLTTPCSpline2D3DObject &);
38 :
39 : /** assignment operator */
40 : AliHLTTPCSpline2D3DObject& operator=( const AliHLTTPCSpline2D3DObject &);
41 :
42 : /** destructor */
43 0 : ~AliHLTTPCSpline2D3DObject(){}
44 :
45 : /** deinitialization */
46 : void Reset();
47 :
48 : /** initialisation */
49 : void InitGrid( Int_t nPointsA, Int_t nPointsB );
50 :
51 : /** setters */
52 0 : void SetMinA( Float_t v ){ fMinA = v; }
53 0 : void SetStepA( Float_t v ){ fStepA = v; }
54 0 : void SetMinB( Float_t v ){ fMinB = v; }
55 0 : void SetStepB( Float_t v ){ fStepB = v; }
56 :
57 : /** fill the XYZ values to the grid*/
58 :
59 : void SetGridValue( Int_t iBin, Float_t x, Float_t y, Float_t z );
60 : void SetGridValue( Int_t iBin, const Float_t XYZ[] );
61 :
62 : /** getters **/
63 :
64 0 : Int_t GetNPointsA() const { return fNA; }
65 0 : Int_t GetNPointsB() const { return fNB; }
66 0 : Int_t GetNPoints() const { return fNA*fNB; }
67 :
68 0 : Float_t GetMinA() const { return fMinA; }
69 0 : Float_t GetStepA() const { return fStepA; }
70 :
71 0 : Float_t GetMinB() const { return fMinB; }
72 0 : Float_t GetStepB() const { return fStepB; }
73 :
74 : void GetGridValue( Int_t iBin, Float_t &x, Float_t &y, Float_t &z ) const;
75 : void GetGridValue( Int_t iBin, Float_t XYZ[] ) const;
76 :
77 : private:
78 :
79 : Int_t fNA; // N points A axis
80 : Int_t fNB; // N points B axis
81 : Int_t fN; // N points (== fNA*fNB )
82 : Float_t fMinA; // min A axis
83 : Float_t fMinB; // min B axis
84 : Float_t fStepA; // step between points A axis
85 : Float_t fStepB; // step between points B axis
86 : TArrayF fXYZ; // array of points, {X,Y,Z,0} values
87 :
88 : public:
89 :
90 6 : ClassDef(AliHLTTPCSpline2D3DObject, 1)
91 : };
92 :
93 :
94 : inline AliHLTTPCSpline2D3DObject::AliHLTTPCSpline2D3DObject()
95 0 : : TObject(), fNA(0), fNB(0), fN(0), fMinA(0), fMinB(0), fStepA(0), fStepB(0), fXYZ()
96 0 : {
97 0 : }
98 :
99 : inline AliHLTTPCSpline2D3DObject::AliHLTTPCSpline2D3DObject( const AliHLTTPCSpline2D3DObject &v)
100 0 : : TObject(v), fNA(v.fNA), fNB(v.fNB), fN(v.fN), fMinA(v.fMinA), fMinB(v.fMinB), fStepA(v.fStepA), fStepB(v.fStepB), fXYZ(v.fXYZ)
101 0 : {
102 : // constructor
103 0 : }
104 :
105 : inline AliHLTTPCSpline2D3DObject& AliHLTTPCSpline2D3DObject::operator=( const AliHLTTPCSpline2D3DObject &v)
106 : {
107 : // assignment operator
108 0 : new (this) AliHLTTPCSpline2D3DObject( v );
109 0 : return *this;
110 0 : }
111 :
112 : inline void AliHLTTPCSpline2D3DObject::Reset()
113 : {
114 : // reset
115 0 : InitGrid(0,0);
116 0 : fMinA = fMinB = fStepA = fStepB = 0.f;
117 0 : }
118 :
119 : inline void AliHLTTPCSpline2D3DObject::InitGrid( Int_t nBinsA, Int_t nBinsB )
120 : {
121 : // initialisation
122 0 : fNA = nBinsA;
123 0 : fNB = nBinsB;
124 0 : fN = fNA*fNB;
125 0 : fXYZ.Set(fN*3);
126 0 : }
127 :
128 : inline void AliHLTTPCSpline2D3DObject::SetGridValue(Int_t iBin, Float_t x, Float_t y, Float_t z)
129 : {
130 0 : if( iBin<0 || iBin>=fN ) return;
131 0 : Int_t ind3 = iBin*3;
132 0 : fXYZ[ind3] = x;
133 0 : fXYZ[ind3+1] = y;
134 0 : fXYZ[ind3+2] = z;
135 0 : }
136 :
137 : inline void AliHLTTPCSpline2D3DObject::SetGridValue( Int_t iBin, const Float_t XYZ[] )
138 : {
139 0 : SetGridValue( iBin, XYZ[0], XYZ[1], XYZ[2] );
140 0 : }
141 :
142 : inline void AliHLTTPCSpline2D3DObject::GetGridValue( Int_t iBin, Float_t &x, Float_t &y, Float_t &z ) const
143 : {
144 0 : if( iBin<0 || iBin>=fN ) return;
145 0 : Int_t ind3 = iBin*3;
146 0 : x = fXYZ[ind3];
147 0 : y = fXYZ[ind3+1];
148 0 : z = fXYZ[ind3+2];
149 0 : }
150 :
151 : inline void AliHLTTPCSpline2D3DObject::GetGridValue( Int_t iBin, Float_t XYZ[] ) const
152 : {
153 0 : GetGridValue( iBin, XYZ[0], XYZ[1], XYZ[2] );
154 0 : }
155 :
156 :
157 : #endif
|