]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/hough/AliHLTHoughTransformerLUT.h
Moving all Gsatt calls in Init: needed by G4 (Andrei)
[u/mrichter/AliRoot.git] / HLT / hough / AliHLTHoughTransformerLUT.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
d5d754e5 3#ifndef ALIL3_HOUGHTRANSFORMERLUT
4#define ALIL3_HOUGHTRANSFORMERLUT
5
4aa41877 6#include "AliHLTRootTypes.h"
7#include "AliHLTHoughBaseTransformer.h"
8#include "AliHLTHistogram.h"
d5d754e5 9
1f1942b8 10/* use if you also want the eta index
11 to be looked up and linear searched */
12//#define FULLLUT
d5d754e5 13
4aa41877 14class AliHLTHoughTransformerLUT : public AliHLTHoughBaseTransformer {
d5d754e5 15
d5d754e5 16 public:
17
4aa41877 18 AliHLTHoughTransformerLUT();
19 AliHLTHoughTransformerLUT(Int_t slice,Int_t patch,Int_t nEtaSegments);
20 virtual ~AliHLTHoughTransformerLUT();
d5d754e5 21
1f1942b8 22 void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi);
b2a02bce 23 void CreateHistograms(Int_t nxbin,Float_t ptmin,Int_t nybin,Float_t phimin,Float_t phimax);
24 void CreateHistograms(Int_t nxbin,Float_t xmin,Float_t xmax,Int_t nybin,Float_t ymin,Float_t ymax);
d5d754e5 25 void Reset();
26
27 void TransformCircle();
298edb8a 28 void TransformCircle(Int_t *row_range,Int_t every) {
4aa41877 29 AliHLTHoughBaseTransformer::TransformCircle(row_range,every);
298edb8a 30 }
d5d754e5 31
bd2f8772 32 Int_t GetEtaIndex(Double_t eta) const;
4aa41877 33 AliHLTHistogram *GetHistogram(Int_t etaIndex);
f5271e68 34 Double_t GetEta(Int_t etaIndex,Int_t slice) const;
d5d754e5 35
36 void Print();
f5271e68 37 void Init(Int_t slice=0,Int_t patch=0,Int_t nEtaSegments=100,Int_t nSeqs=-1);
38
39 protected:
4aa41877 40 AliHLTHistogram **fParamSpace; //!
f5271e68 41
42 void DeleteHistograms();
43
44 Int_t fMinRow; // Min row (= first row)
45 Int_t fMaxRow; // Max row (= last row)
46 Int_t fNRows; // Number of rows
47 Int_t fNEtas; // Number of eta slices
48 Int_t fNPhi0; // Number of phi bins
49 Int_t fSlice; // Current slice
50 Int_t fSector; // Current sector
51 Int_t fSectorRow; // Sector row (?)
52 Int_t fZSign; // Z sign
53 Float_t fZLengthPlusOff; // Z lenght plus offset
54 Float_t fTimeWidth; // Time width
55 Float_t fPadPitch; // Pad pitch
56 Float_t fEtaSlice; // Eta slice
57
58 Float_t *fLUTX; //! LUT for X
59 Float_t *fLUTY; //! LUT for Y
60 Float_t *fLUTEta; //! LUT for eta
61 Float_t *fLUTEtaReal; //! LUT for real eta (?)
62 Float_t *fLUTphi0; //! LUT for phi0
63 Float_t *fLUT2sinphi0; //! LUT for sin(phi0)
64 Float_t *fLUT2cosphi0; //! LUT for cos(phi0)
65 //not used but need for VHDL version
66 Float_t *fLUTKappa; //! LUT for kappa
67
68 Int_t fLastPad; // Last pad
69 Int_t fLastIndex; // Last index
70 Int_t fAccCharge; // Accepted charge
71 Float_t fX,fY; //trafo values per pad
72
73 Float_t CalcRoverZ2(Float_t eta) const;
74 Float_t CalcEta(Float_t roverz2) const;
75 Float_t CalcX(Int_t row) const;
76 Float_t CalcY(Int_t pad, Int_t row) const;
77 Float_t CalcZ(Int_t time) const;
78 Int_t FindIndex(Float_t rz2, Int_t start=-100) const;
79 void AddCurveToHistogram(Int_t newEtaIndex=-1);
3e87ef69 80
4aa41877 81 ClassDef(AliHLTHoughTransformerLUT,1) //LUT Hough transformation class
d5d754e5 82
83};
1f1942b8 84
4aa41877 85typedef AliHLTHoughTransformerLUT AliL3HoughTransformerLUT; // for backward comaptibility
86
87inline Float_t AliHLTHoughTransformerLUT::CalcRoverZ2(Float_t eta) const
1f1942b8 88{
89 Float_t e=exp(2*eta);
90 Float_t ret=(e+1)/(e-1);
91 ret*=ret;
92 return ret;
93}
94
4aa41877 95inline Float_t AliHLTHoughTransformerLUT::CalcEta(Float_t roverz2) const
1f1942b8 96{
97 Float_t rz=sqrt(roverz2);
98 if(fZSign<0) rz=-rz;
99 Float_t ret=(1+rz)/(rz-1);
100 ret=0.5*log(ret);
101 return ret;
102}
103
4aa41877 104inline Float_t AliHLTHoughTransformerLUT::CalcX(Int_t row) const
1f1942b8 105{
106 return fLUTX[row];
107}
108
4aa41877 109inline Float_t AliHLTHoughTransformerLUT::CalcY(Int_t pad,Int_t row) const
1f1942b8 110{
111 return pad*fPadPitch-fLUTY[row];
112}
113
4aa41877 114inline Float_t AliHLTHoughTransformerLUT::CalcZ(Int_t time) const
1f1942b8 115{
116 Float_t ret=time*fTimeWidth;
117 if(fZSign>0) ret=fZLengthPlusOff-ret;
118 else ret=ret-fZLengthPlusOff;
119 return ret;
120}
121
4aa41877 122inline void AliHLTHoughTransformerLUT::AddCurveToHistogram(Int_t newEtaIndex)
1f1942b8 123{
124 //get correct histogrampointer
4aa41877 125 AliHLTHistogram *hist = fParamSpace[fLastIndex];
1f1942b8 126
127 //Fill the histogram along the phirange
128 Float_t r2=fX*fX+fY*fY;
129 for(Int_t b=0; b<fNPhi0; b++){
130 Float_t kappa=(fY*fLUT2cosphi0[b]-fX*fLUT2sinphi0[b])/r2;
910f8d43 131 hist->Fill(kappa,b+1,fAccCharge);
1f1942b8 132 //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
133 }
134
135 fAccCharge=0;
f5271e68 136 fLastIndex=newEtaIndex;
1f1942b8 137}
138
4aa41877 139inline Int_t AliHLTHoughTransformerLUT::FindIndex(Float_t rz2, Int_t start) const
1f1942b8 140{
141 //could improve search through devide and conquere strategy
142
143 Int_t index=start;
144 if(index==-100){
145 index=0;
146 while((index<fNEtas)&&(rz2<=fLUTEta[index])){
147 index++;
148 }
149 } else {
150 while((index>=0)&&(rz2>fLUTEta[index])){
151 index--;
152 }
153 index++;
154 }
155 //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;
156
157 return index;
158}
159
160
161
162
d5d754e5 163#endif