0c520b5ef3610a5cbc7b88dd8f8965916f992a43
[u/mrichter/AliRoot.git] / RICH / AliRICHRecon.h
1 #ifndef AliRICHRecon_h
2 #define AliRICHRecon_h
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 //////////////////////////////////////////////////////////////////////////
8 //                                                                      //
9 // AliRICHRecon                                                         //
10 //                                                                      //
11 // RICH class to perfom pattern recognition based on Hough transfrom    //
12 //                                                                      //
13 //////////////////////////////////////////////////////////////////////////
14
15
16 #include <TTask.h>
17
18 class AliRICHHelix;
19
20 class AliRICHRecon : public TTask 
21 {
22 public : 
23     AliRICHRecon(AliRICHHelix *pHelix,TClonesArray *pClusters,Int_t iMipId);
24     virtual ~AliRICHRecon(){;}
25
26   Double_t ThetaCerenkov();                   // it returns reconstructed Theta Cerenkov
27   void FindThetaPhotonCerenkov();             //
28   void FindAreaAndPortionOfRing();            //
29   void FindEmissionPoint();                   //
30   void FindPhotonAnglesInDRS();               //
31   void FindPhiPoint();                        //
32   void FindThetaAtQuartz(Float_t ThetaCer);   //
33   void HoughResponse();                       //
34   void HoughFiltering(float HCS[]);           //
35   void FlagPhotons();                         //
36   void FindThetaCerenkov();                   //
37   void FindIntersectionWithDetector();        //
38   Float_t Cerenkovangle(Float_t n, Float_t b);//
39   Int_t   PhotonInBand();                     //
40   Int_t   CheckDetectorAcceptance() const;    //
41   Int_t   GetFittedHoughPhotons()                   const{ return fFittedHoughPhotons;}             //
42   Int_t   GetPhotonFlag()                           const{ return fPhotonFlag[fPhotonIndex];}       //
43   Int_t   GetTrackCharge()                          const{ return fTrackCharge;}                    //
44   Int_t   GetPhotonsNumber()                        const{ return fPhotonsNumber;}                  //
45   Int_t   GetPhotonIndex()                          const{ return fPhotonIndex;}                    //
46   Int_t   GetMipIndex()                             const{ return fMipIndex;}                       //
47   Int_t   GetTrackIndex()                           const{ return fTrackIndex;}                     //
48   Int_t   GetCandidatePhotonsNumber()               const{ return fCandidatePhotonsNumber;}         //
49   Int_t   GetHoughPhotons()                         const{ return fHoughPhotons;}                   //
50   Float_t GetPhotonEnergy()                         const{ return fPhotonEnergy;}                   //
51   Float_t GetFreonRefractiveIndex()                 const{ return fFreonRefractiveIndex;}           //
52   Float_t GetQuartzRefractiveIndex()                const{ return fQuartzRefractiveIndex;}          //
53   Float_t GetGasRefractiveIndex()                   const{ return fGasRefractiveIndex;}             //
54   Float_t GetEmissionPoint()                        const{ return fLengthEmissionPoint;}            //
55   Float_t GetMassHypotesis()                        const{ return fMassHypotesis;}                  //
56   Float_t GetBetaOfParticle()                       const{ return fTrackBeta;}                      //
57   Float_t GetEntranceX()                            const{ return fXtoentr;}                        //
58   Float_t GetEntranceY()                            const{ return fYtoentr;}                        //
59   Float_t GetThetaCerenkov()                        const{ return fThetaCerenkov;}                  //
60   Float_t GetThetaPhotonCerenkov()                  const{ return fThetaPhotonCerenkov;}            //
61   Float_t GetTrackTheta()                           const{ return fTrackTheta;}                     //
62   Float_t GetTrackPhi()                             const{ return fTrackPhi;}                       //
63   Float_t GetXPointOnCathode()                      const{ return fPhotonLimitX;}                   //
64   Float_t GetYPointOnCathode()                      const{ return fPhotonLimitY;}                   //
65   Float_t GetThetaPhotonInDRS()                     const{ return fThetaPhotonInDRS;}               //
66   Float_t GetPhiPhotonInDRS()                       const{ return fPhiPhotonInDRS;}                 //
67   Float_t GetThetaPhotonInTRS()                     const{ return fThetaPhotonInTRS;}               //
68   Float_t GetPhiPhotonInTRS()                       const{ return fPhiPhotonInTRS;}                 //
69   Float_t GetThetaAtQuartz()                        const{ return fThetaAtQuartz;}                  //
70   Float_t GetPhiPoint()                             const{ return fPhiPoint[fPhotonIndex];}         //
71   Float_t GetXCoordOfEmission()                     const{ return fXEmiss;}                         //
72   Float_t GetYCoordOfEmission()                     const{ return fYEmiss;}                         //
73   Float_t GetXInnerRing()                           const{ return fXInner;}                         //
74   Float_t GetYInnerRing()                           const{ return fYInner;}                         //
75   Float_t GetRadiusInnerRing()                      const{ return fInnerRadius;}                    //
76   Float_t GetXOuterRing()                           const{ return fXOuter;}                         //
77   Float_t GetYOuterRing()                           const{ return fYOuter;}                         //
78   Float_t GetRadiusOuterRing()                      const{ return fOuterRadius;}                    //
79   Float_t GetShiftX()                               const{ return fShiftX;}                         //
80   Float_t GetShiftY()                               const{ return fShiftY;}                         //
81   Float_t GetDetectorWhereX()                       const{ return fXcoord;}                         //
82   Float_t GetDetectorWhereY()                       const{ return fYcoord;}                         //
83   Float_t GetIntersectionX()                        const{ return fIntersectionX;}                  //
84   Float_t GetIntersectionY()                        const{ return fIntersectionY;}                  //
85   Float_t GetThetaOfRing()                          const{ return fThetaOfRing;}                    //
86   Float_t GetAreaOfRing()                           const{ return fAreaOfRing;}                     //
87   Float_t GetPortionOfRing()                        const{ return fPortionOfRing;}                  //
88   Float_t GetHoughArea()                            const{ return fHoughArea;}                      //
89   Float_t GetPhotonEta()                            const{ return fPhotonEta[fPhotonIndex];}        //
90   Float_t GetPhotonWeight()                         const{ return fPhotonWeight[fPhotonIndex];}     //
91   Float_t GetHoughRMS()                             const{ return fHoughRMS;}                       //
92   Float_t GetFittedTrackTheta()                     const{ return fFittedTrackTheta;}               //
93   Float_t GetFittedTrackPhi()                       const{ return fFittedTrackPhi;}                 //
94   Float_t GetFittedThetaCerenkov()                  const{ return fFittedThetaCerenkov;}            //
95   void SetPhotonEnergy(Float_t PhotonEnergy) { fPhotonEnergy = PhotonEnergy;}                       //
96   void SetFreonRefractiveIndex() {fFreonRefractiveIndex = fFreonScaleFactor*(1.177+0.0172*fPhotonEnergy);}//
97   void SetQuartzRefractiveIndex() {fQuartzRefractiveIndex = sqrt(1+(46.411/(113.763556-TMath::Power(fPhotonEnergy,2)))+(228.71/(328.51563-TMath::Power(fPhotonEnergy,2))));}//
98   void SetGasRefractiveIndex() { fGasRefractiveIndex = 1.;}                                         //
99   void SetFreonScaleFactor(Float_t FreonScaleFactor) {fFreonScaleFactor = FreonScaleFactor;}        //
100   void SetEmissionPoint(Float_t LengthEmissionPoint) { fLengthEmissionPoint = LengthEmissionPoint;} //
101   void SetEntranceX(Float_t Xtoentr) { fXtoentr = Xtoentr;}                                         //
102   void SetEntranceY(Float_t Ytoentr) { fYtoentr = Ytoentr;}                                         //
103   void SetThetaPhotonInTRS(Float_t Theta) {fThetaPhotonInTRS = Theta;}                              //
104   void SetPhiPhotonInTRS(Float_t Phi) {fPhiPhotonInTRS = Phi;}                                      //
105   void SetThetaPhotonInDRS(Float_t Theta) {fThetaPhotonInDRS = Theta;}                              //
106   void SetPhiPhotonInDRS(Float_t Phi) {fPhiPhotonInDRS = Phi;}                                      //
107   void SetThetaAtQuartz(Float_t ThetaAtQuartz) {fThetaAtQuartz = ThetaAtQuartz;}                    //
108   void SetPhiPoint(Float_t PhiPoint){ fPhiPoint[fPhotonIndex] = PhiPoint;}                          //
109   void SetXCoordOfEmission(Float_t XEmiss) {fXEmiss = XEmiss;}                                      //
110   void SetYCoordOfEmission(Float_t YEmiss) {fYEmiss = YEmiss;}                                      //
111   void SetXPointOnCathode(Float_t PhotonLimitX) { fPhotonLimitX = PhotonLimitX;}                    //
112   void SetYPointOnCathode(Float_t PhotonLimitY) { fPhotonLimitY = PhotonLimitY;}                    //
113   void SetXInnerRing(Float_t XInner) {fXInner = XInner;}                                            //
114   void SetYInnerRing(Float_t YInner) {fYInner = YInner;}                                            //
115   void SetRadiusInnerRing(Float_t InnerRadius) {fInnerRadius = InnerRadius;}                        //
116   void SetXOuterRing(Float_t XOuter) {fXOuter = XOuter;}                                            //
117   void SetYOuterRing(Float_t YOuter) {fYOuter = YOuter;}                                            //
118   void SetRadiusOuterRing(Float_t OuterRadius) {fOuterRadius = OuterRadius;}                        //
119   void SetThetaCerenkov(Float_t ThetaCer) {fThetaCerenkov = ThetaCer;}                              //
120   void SetThetaPhotonCerenkov(Float_t ThetaPhotCer) {fThetaPhotonCerenkov = ThetaPhotCer;}          //
121   void SetTrackTheta(Float_t TrackTheta) { fTrackTheta = TrackTheta;}                               //
122   void SetTrackPhi(Float_t TrackPhi) { fTrackPhi = TrackPhi;}                                       //
123   void SetTrackCharge(Int_t TrackCharge) { fTrackCharge = TrackCharge;}                             //
124   void SetShiftX(Float_t ShiftX) { fShiftX = ShiftX;}                                               //
125   void SetShiftY(Float_t ShiftY) { fShiftY = ShiftY;}                                               //
126   void SetDetectorWhereX(Float_t Xcoord) { fXcoord = Xcoord;}                                       //
127   void SetDetectorWhereY(Float_t Ycoord) { fYcoord = Ycoord;}                                       //
128   void SetIntersectionX(Float_t IntersectionX) { fIntersectionX = IntersectionX;}                   //
129   void SetIntersectionY(Float_t IntersectionY) { fIntersectionY = IntersectionY;}                   //
130   void SetThetaOfRing(Float_t ThetaOfRing) { fThetaOfRing = ThetaOfRing;}                           //
131   void SetAreaOfRing(Float_t AreaOfRing) { fAreaOfRing = AreaOfRing;}                               //
132   void SetPortionOfRing(Float_t PortionOfRing) { fPortionOfRing = PortionOfRing;}                   //
133   void SetHoughArea(Float_t HoughArea) { fHoughArea = HoughArea;}                                   //
134   void SetPhotonsNumber(Int_t PhotonsNumber) { fPhotonsNumber = PhotonsNumber;}                     //
135   void SetPhotonIndex(Int_t PhotonIndex) { fPhotonIndex = PhotonIndex;}                             //
136   void SetPhotonEta(Float_t PhotonEta) { fPhotonEta[fPhotonIndex] = PhotonEta;}                     //
137   void SetPhotonFlag(Int_t PhotonFlag) { fPhotonFlag[fPhotonIndex] = PhotonFlag;}                   //
138   void SetPhotonWeight(Float_t PhotonWeight) { fPhotonWeight[fPhotonIndex] = PhotonWeight;}         //
139   void SetHoughRMS(Float_t HoughRMS) { fHoughRMS = HoughRMS;}                                       //
140   void SetMipIndex(Int_t MipIndex) { fMipIndex = MipIndex;}                                         //
141   void SetTrackIndex(Int_t TrackIndex) { fTrackIndex = TrackIndex;}                                 //
142   void SetHoughPhotons(Int_t HoughPhotons) { fHoughPhotons = HoughPhotons;}                         //
143   void SetHoughPhotonsNorm(Float_t HoughPhotonsNorm) { fHoughPhotonsNorm = HoughPhotonsNorm;}       //
144   void SetFittedTrackTheta(Float_t FittedTrackTheta)    { fFittedTrackTheta = FittedTrackTheta;}    //
145   void SetFittedTrackPhi(Float_t FittedTrackPhi)    { fFittedTrackPhi = FittedTrackPhi;}            //
146   void SetFittedThetaCerenkov(Float_t FittedThetaCerenkov) { fFittedThetaCerenkov = FittedThetaCerenkov;}//
147   void SetFittedHoughPhotons(Int_t FittedHoughPhotons) { fFittedHoughPhotons = FittedHoughPhotons;} //
148   void FindBetaFromTheta(Float_t ThetaCerenkov) {fTrackBeta = 1/(fFreonRefractiveIndex*cos(ThetaCerenkov));}//
149   Float_t SnellAngle(Float_t n1, Float_t n2, Float_t theta1);                                       //
150   Float_t FromEmissionToCathode();                                                                  //
151
152 protected:
153   TClonesArray *fpClusters;                   // poiter to clusters
154   Int_t   fTrackCharge;                       // charge track
155   Int_t fMipIndex;                            // index for Mip
156   Int_t fTrackIndex;                          // index for track
157   Int_t fPhotonsNumber;                       // Number of photons candidate
158   Int_t fPhotonIndex;                         // index of photons
159   Int_t fPhotonFlag[3000];                    // flag for photons
160   Int_t fCandidatePhotonsNumber;              // number of candidate photons
161   Int_t fHoughPhotons;                        // n. photons after Hough
162   Int_t   fFittedHoughPhotons;                // n. photons after Hough and after minimization
163
164   Float_t fTrackTheta;                        // Theta of track at RICH
165   Float_t fTrackPhi;                          // Phi of track at RICH
166   Float_t fMinDist;                           // min distance between extrapolated track and MIP
167   Float_t fTrackBeta;                         // beta of the track
168   Float_t fXtoentr;                           // X entrance to RICH
169   Float_t fYtoentr;                           // Y entrance to RICH
170   Float_t fThetaPhotonInTRS;                  // Theta of photon in the Track Reference System (TRS)
171   Float_t fPhiPhotonInTRS;                    // Phi of photon in TRS
172   Float_t fThetaPhotonInDRS;                  // Theta of photon in Detector Reference System (DRS)
173   Float_t fPhiPhotonInDRS;                    // Phi of photon in DRS
174   Float_t fThetaAtQuartz;                     // Theta at the quartz entrance
175   Float_t fPhiPoint[3000];                    // array of phi of ring photons
176   Float_t fXEmiss;                            //  x emission
177   Float_t fYEmiss;                            //  y emission
178   Float_t fXInner;                            // X inner ring
179   Float_t fYInner;                            // Y inner ring
180   Float_t fXOuter;                            // X outer ring
181   Float_t fYOuter;                            // Y outer ring
182   Float_t fInnerRadius;                       // inner radius
183   Float_t fOuterRadius;                       // outer radius
184   Float_t fPhotonEnergy;                      // photon energy
185   Float_t fFreonRefractiveIndex;              // n freon
186   Float_t fQuartzRefractiveIndex;             // n quartz
187   Float_t fGasRefractiveIndex;                // n gas
188   Float_t fFreonScaleFactor;                  // scale factor for n freon
189   Float_t fLengthEmissionPoint;               // lenght of emmission point
190   Float_t fPhotonLimitX;                      // X phys limit for photon
191   Float_t fPhotonLimitY;                      // Y phys limit for photon 
192   Float_t fDistanceFromCluster;               // distance from cluster
193   Float_t fCerenkovAnglePad;                  // cherenkov angle of pad
194   Float_t fThetaPhotonCerenkov;               // theta cerenkov for photon
195   Float_t fShiftX;                            // x shift to entrance in radiator
196   Float_t fShiftY;                            // y shift to entrance in radiator
197   Float_t fXcoord;                            // ..
198   Float_t fYcoord;                            // ..
199   Float_t fIntersectionX;                     // ..
200   Float_t fIntersectionY;                     // ..
201   Float_t fMassHypotesis;                     //
202   Float_t fThetaOfRing;                       // theta of ring
203   Float_t fAreaOfRing;                        // area of the ring
204   Float_t fPortionOfRing;                     // fraction of the accepted ring
205   Float_t fHoughArea;                         // area Hough
206   Float_t fPhotonEta[3000];                   // theta cerenkov of photon candidates
207   Float_t fPhotonWeight[3000];                // weigth
208   Float_t fHoughRMS;                          // rms Hough
209   Float_t* fCandidatePhotonX;                 // x photon candidates
210   Float_t* fCandidatePhotonY;                 // y photon candidates
211   Float_t fHoughPhotonsNorm;                  // n. photons norm.
212   Float_t fFittedTrackTheta;                  // theta track after minim.
213   Float_t fFittedTrackPhi;                    // phi track after minim.
214   Float_t fFittedThetaCerenkov;               // thetacerenkov after minim.
215   Int_t   fThetaBin;                          // bin in theta
216   Float_t fThetaMin,fThetaMax;                // min max
217   Float_t fXmin,fXmax,fYmin,fYmax;            // xy min max
218   Int_t   fNrings;                            //current number of reconstructed rings
219   Bool_t  fIsWEIGHT;                          // flag to consider weight procedure
220   Bool_t  fIsBACKGROUND;                      // flag to simulate bkg
221   Float_t fRadiatorWidth;                     // radiator width
222   Float_t fQuartzWidth;                       // quartz width
223   Float_t fGapWidth;                          // gap width
224   Float_t fDTheta;                            // Step for sliding window
225   Float_t fWindowWidth;                       // Hough width of sliding window
226   
227   Int_t   fNumEtaPhotons;                     // Number of photons
228   Int_t   fEtaFlag[3000];                     // flag for good photons
229   Float_t fEtaPhotons[3000];                  // Cerenkov angle each photon
230   Float_t fWeightPhotons[3000];               // weight for each photon
231   Float_t fThetaCerenkov;                     // Theta angle for Hough
232   Float_t fWeightThetaCerenkov;               // Theta Cerenkov angle weighted
233   Float_t fThetaPeakPos;                      // Peak position
234
235
236   ClassDef(AliRICHRecon,0)
237 };
238     
239 #endif // #ifdef AliRICHRecon_cxx
240