3 #ifndef ALIL3_HOUGHTRANSFORMERLUT
4 #define ALIL3_HOUGHTRANSFORMERLUT
6 #include "AliHLTRootTypes.h"
7 #include "AliHLTHoughBaseTransformer.h"
8 #include "AliHLTHistogram.h"
10 /* use if you also want the eta index
11 to be looked up and linear searched */
14 class AliHLTHoughTransformerLUT : public AliHLTHoughBaseTransformer {
18 AliHLTHoughTransformerLUT();
19 AliHLTHoughTransformerLUT(Int_t slice,Int_t patch,Int_t nEtaSegments);
20 virtual ~AliHLTHoughTransformerLUT();
22 void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi);
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);
27 void TransformCircle();
28 void TransformCircle(Int_t *row_range,Int_t every) {
29 AliHLTHoughBaseTransformer::TransformCircle(row_range,every);
32 Int_t GetEtaIndex(Double_t eta) const;
33 AliHLTHistogram *GetHistogram(Int_t etaIndex);
34 Double_t GetEta(Int_t etaIndex,Int_t slice) const;
37 void Init(Int_t slice=0,Int_t patch=0,Int_t nEtaSegments=100,Int_t nSeqs=-1);
40 AliHLTHistogram **fParamSpace; //!
42 void DeleteHistograms();
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
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
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
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);
81 ClassDef(AliHLTHoughTransformerLUT,1) //LUT Hough transformation class
85 typedef AliHLTHoughTransformerLUT AliL3HoughTransformerLUT; // for backward comaptibility
87 inline Float_t AliHLTHoughTransformerLUT::CalcRoverZ2(Float_t eta) const
90 Float_t ret=(e+1)/(e-1);
95 inline Float_t AliHLTHoughTransformerLUT::CalcEta(Float_t roverz2) const
97 Float_t rz=sqrt(roverz2);
99 Float_t ret=(1+rz)/(rz-1);
104 inline Float_t AliHLTHoughTransformerLUT::CalcX(Int_t row) const
109 inline Float_t AliHLTHoughTransformerLUT::CalcY(Int_t pad,Int_t row) const
111 return pad*fPadPitch-fLUTY[row];
114 inline Float_t AliHLTHoughTransformerLUT::CalcZ(Int_t time) const
116 Float_t ret=time*fTimeWidth;
117 if(fZSign>0) ret=fZLengthPlusOff-ret;
118 else ret=ret-fZLengthPlusOff;
122 inline void AliHLTHoughTransformerLUT::AddCurveToHistogram(Int_t newEtaIndex)
124 //get correct histogrampointer
125 AliHLTHistogram *hist = fParamSpace[fLastIndex];
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;
131 hist->Fill(kappa,b+1,fAccCharge);
132 //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
136 fLastIndex=newEtaIndex;
139 inline Int_t AliHLTHoughTransformerLUT::FindIndex(Float_t rz2, Int_t start) const
141 //could improve search through devide and conquere strategy
146 while((index<fNEtas)&&(rz2<=fLUTEta[index])){
150 while((index>=0)&&(rz2>fLUTEta[index])){
155 //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;