3 #ifndef ALIL3_HOUGHTRANSFORMERLUT
4 #define ALIL3_HOUGHTRANSFORMERLUT
6 #include "AliL3RootTypes.h"
7 #include "AliL3HoughBaseTransformer.h"
8 #include "AliL3Histogram.h"
10 /* use if you also want the eta index
11 to be looked up and linear searched */
14 class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
18 AliL3HoughTransformerLUT();
19 AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t nEtaSegments);
20 virtual ~AliL3HoughTransformerLUT();
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();
29 Int_t GetEtaIndex(Double_t eta) const;
30 AliL3Histogram *GetHistogram(Int_t etaIndex);
31 Double_t GetEta(Int_t etaIndex,Int_t slice) const;
34 void Init(Int_t slice=0,Int_t patch=0,Int_t nEtaSegments=100,Int_t nSeqs=-1);
37 AliL3Histogram **fParamSpace; //!
39 void DeleteHistograms();
41 Int_t fMinRow; // Min row (= first row)
42 Int_t fMaxRow; // Max row (= last row)
43 Int_t fNRows; // Number of rows
44 Int_t fNEtas; // Number of eta slices
45 Int_t fNPhi0; // Number of phi bins
46 Int_t fSlice; // Current slice
47 Int_t fSector; // Current sector
48 Int_t fSectorRow; // Sector row (?)
49 Int_t fZSign; // Z sign
50 Float_t fZLengthPlusOff; // Z lenght plus offset
51 Float_t fTimeWidth; // Time width
52 Float_t fPadPitch; // Pad pitch
53 Float_t fEtaSlice; // Eta slice
55 Float_t *fLUTX; //! LUT for X
56 Float_t *fLUTY; //! LUT for Y
57 Float_t *fLUTEta; //! LUT for eta
58 Float_t *fLUTEtaReal; //! LUT for real eta (?)
59 Float_t *fLUTphi0; //! LUT for phi0
60 Float_t *fLUT2sinphi0; //! LUT for sin(phi0)
61 Float_t *fLUT2cosphi0; //! LUT for cos(phi0)
62 //not used but need for VHDL version
63 Float_t *fLUTKappa; //! LUT for kappa
65 Int_t fLastPad; // Last pad
66 Int_t fLastIndex; // Last index
67 Int_t fAccCharge; // Accepted charge
68 Float_t fX,fY; //trafo values per pad
70 Float_t CalcRoverZ2(Float_t eta) const;
71 Float_t CalcEta(Float_t roverz2) const;
72 Float_t CalcX(Int_t row) const;
73 Float_t CalcY(Int_t pad, Int_t row) const;
74 Float_t CalcZ(Int_t time) const;
75 Int_t FindIndex(Float_t rz2, Int_t start=-100) const;
76 void AddCurveToHistogram(Int_t newEtaIndex=-1);
78 ClassDef(AliL3HoughTransformerLUT,1) //LUT Hough transformation class
82 inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta) const
85 Float_t ret=(e+1)/(e-1);
90 inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2) const
92 Float_t rz=sqrt(roverz2);
94 Float_t ret=(1+rz)/(rz-1);
99 inline Float_t AliL3HoughTransformerLUT::CalcX(Int_t row) const
104 inline Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row) const
106 return pad*fPadPitch-fLUTY[row];
109 inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time) const
111 Float_t ret=time*fTimeWidth;
112 if(fZSign>0) ret=fZLengthPlusOff-ret;
113 else ret=ret-fZLengthPlusOff;
117 inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t newEtaIndex)
119 //get correct histogrampointer
120 AliL3Histogram *hist = fParamSpace[fLastIndex];
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;
126 hist->Fill(kappa,b+1,fAccCharge);
127 //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
131 fLastIndex=newEtaIndex;
134 inline Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start) const
136 //could improve search through devide and conquere strategy
141 while((index<fNEtas)&&(rz2<=fLUTEta[index])){
145 while((index>=0)&&(rz2>fLUTEta[index])){
150 //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;