]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/hough/AliL3HoughTransformerLUT.h
Coding violations...
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughTransformerLUT.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
d5d754e5 3#ifndef ALIL3_HOUGHTRANSFORMERLUT
4#define ALIL3_HOUGHTRANSFORMERLUT
5
6#include "AliL3RootTypes.h"
7#include "AliL3HoughBaseTransformer.h"
1f1942b8 8#include "AliL3Histogram.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
14class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
15
16 protected:
17 AliL3Histogram **fParamSpace; //!
d5d754e5 18
19 void DeleteHistograms();
20
21 Int_t fMinRow;
22 Int_t fMaxRow;
23 Int_t fNRows;
24 Int_t fNEtas;
25 Int_t fNPhi0;
3bcf971b 26 Int_t fSlice;
d5d754e5 27 Int_t fSector;
28 Int_t fSectorRow;
29 Int_t fZSign;
30 Float_t fZLengthPlusOff;
31 Float_t fTimeWidth;
32 Float_t fPadPitch;
33 Float_t fEtaSlice;
34
35 Float_t *fLUTX; //!
36 Float_t *fLUTY; //!
37 Float_t *fLUTEta; //!
3e87ef69 38 Float_t *fLUTEtaReal; //!
d5d754e5 39 Float_t *fLUTphi0; //!
40 Float_t *fLUT2sinphi0; //!
41 Float_t *fLUT2cosphi0; //!
1f1942b8 42 //not used but need for VHDL version
18659a6b 43 Float_t *fLUTKappa; //!
d5d754e5 44
18659a6b 45 Int_t fLastPad;
46 Int_t fLastIndex;
3e87ef69 47 Int_t fAccCharge;
1f1942b8 48 Float_t fX,fY; //trafo values per pad
18659a6b 49
d5d754e5 50 Float_t CalcRoverZ2(Float_t eta);
51 Float_t CalcEta(Float_t roverz2);
52 Float_t CalcX(Int_t row);
53 Float_t CalcY(Int_t pad, Int_t row);
54 Float_t CalcZ(Int_t time);
18659a6b 55 Int_t FindIndex(Float_t rz2, Int_t start=-100);
3e87ef69 56 void AddCurveToHistogram(Int_t new_eta_index=-1);
d5d754e5 57
58 public:
59
60 AliL3HoughTransformerLUT();
61 AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t n_eta_segments);
62 virtual ~AliL3HoughTransformerLUT();
63
1f1942b8 64 void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi);
b2a02bce 65 void CreateHistograms(Int_t nxbin,Float_t ptmin,Int_t nybin,Float_t phimin,Float_t phimax);
66 void CreateHistograms(Int_t nxbin,Float_t xmin,Float_t xmax,Int_t nybin,Float_t ymin,Float_t ymax);
d5d754e5 67 void Reset();
68
69 void TransformCircle();
d5d754e5 70
71 Int_t GetEtaIndex(Double_t eta);
72 AliL3Histogram *GetHistogram(Int_t eta_index);
73 Double_t GetEta(Int_t eta_index,Int_t slice);
d5d754e5 74
75 void Print();
3e87ef69 76 void Init(Int_t slice=0,Int_t patch=0,Int_t n_eta_segments=100,Int_t n_seqs=-1);
77
1f1942b8 78 ClassDef(AliL3HoughTransformerLUT,1) //LUT Hough transformation class
d5d754e5 79
80};
1f1942b8 81
82inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta)
83{
84 Float_t e=exp(2*eta);
85 Float_t ret=(e+1)/(e-1);
86 ret*=ret;
87 return ret;
88}
89
90inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2)
91{
92 Float_t rz=sqrt(roverz2);
93 if(fZSign<0) rz=-rz;
94 Float_t ret=(1+rz)/(rz-1);
95 ret=0.5*log(ret);
96 return ret;
97}
98
99inline Float_t AliL3HoughTransformerLUT::CalcX(Int_t row)
100{
101 return fLUTX[row];
102}
103
104inline Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row)
105{
106 return pad*fPadPitch-fLUTY[row];
107}
108
109inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time)
110{
111 Float_t ret=time*fTimeWidth;
112 if(fZSign>0) ret=fZLengthPlusOff-ret;
113 else ret=ret-fZLengthPlusOff;
114 return ret;
115}
116
117inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t new_eta_index)
118{
119 //get correct histogrampointer
120 AliL3Histogram *hist = fParamSpace[fLastIndex];
121
122 //Fill the histogram along the phirange
123 Float_t r2=fX*fX+fY*fY;
124 for(Int_t b=0; b<fNPhi0; b++){
125 Float_t kappa=(fY*fLUT2cosphi0[b]-fX*fLUT2sinphi0[b])/r2;
910f8d43 126 hist->Fill(kappa,b+1,fAccCharge);
1f1942b8 127 //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
128 }
129
130 fAccCharge=0;
131 fLastIndex=new_eta_index;
132}
133
134inline Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start)
135{
136 //could improve search through devide and conquere strategy
137
138 Int_t index=start;
139 if(index==-100){
140 index=0;
141 while((index<fNEtas)&&(rz2<=fLUTEta[index])){
142 index++;
143 }
144 } else {
145 while((index>=0)&&(rz2>fLUTEta[index])){
146 index--;
147 }
148 index++;
149 }
150 //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;
151
152 return index;
153}
154
155
156
157
d5d754e5 158#endif