Adding makefile for Darwin and XLC compiler
[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 AliRICH;
19 class TFile;
20 class TNtuple;
21 class TCanvas;
22
23 class AliRICHRecon : public TTask 
24 {
25 public : 
26     AliRICHRecon(const char*, const char*);
27    ~AliRICHRecon(){EndProcessEvent();}
28
29   AliRICH* Rich() {return fRich;}             //main pointer to RICH
30   void StartProcessEvent();                   //
31   void EndProcessEvent();                     //
32   //PH  void InitRecon();                           //
33   void PatRec();                              //
34   void Minimization();                        //
35   void FillHistograms();                      //
36   void FindThetaPhotonCerenkov();             //
37   void FindAreaAndPortionOfRing();            //
38   void FindEmissionPoint();                   //
39   void FindPhotonAnglesInDRS();               //
40   void FindPhiPoint();                        //
41   void FindThetaAtQuartz(Float_t ThetaCer);   //
42   void HoughResponse();                       //
43   void HoughFiltering(float HCS[]);           //
44   void FlagPhotons();                         //
45   void FindWeightThetaCerenkov();             //
46   void EstimationOfTheta();                   //
47   void FindIntersectionWithDetector();        //
48   void Waiting();                             //
49   Float_t FindMassOfParticle();               //
50   Float_t Cerenkovangle(Float_t n, Float_t b);//
51   Float_t PhotonPositionOnCathode();          //
52   Int_t   PhotonInBand();                     //
53   void DrawEvent(Int_t flag)  const;          //
54   Int_t   CheckDetectorAcceptance() const;    //
55   Int_t   GetFittedHoughPhotons()                   const{ return fFittedHoughPhotons;}             //
56   Int_t   GetPhotonFlag()                           const{ return fPhotonFlag[fPhotonIndex];}       //
57   Int_t   GetTrackCharge()                          const{ return fTrackCharge;}                    //
58   Int_t   GetPhotonsNumber()                        const{ return fPhotonsNumber;}                  //
59   Int_t   GetPhotonIndex()                          const{ return fPhotonIndex;}                    //
60   Int_t   GetMipIndex()                             const{ return fMipIndex;}                       //
61   Int_t   GetTrackIndex()                           const{ return fTrackIndex;}                     //
62   Int_t   GetCandidatePhotonsNumber()               const{ return fCandidatePhotonsNumber;}         //
63   Int_t   GetHoughPhotons()                         const{ return fHoughPhotons;}                   //
64   Float_t GetEventVertexZ()                         const{ return fEventVertZ;}                     //
65   Float_t GetEventMultiplicity()                    const{ return fEventMultiplicity;}              //
66   Float_t GetPhotonEnergy()                         const{ return fPhotonEnergy;}                   //
67   Float_t GetFreonRefractiveIndex()                 const{ return fFreonRefractiveIndex;}           //
68   Float_t GetQuartzRefractiveIndex()                const{ return fQuartzRefractiveIndex;}          //
69   Float_t GetGasRefractiveIndex()                   const{ return fGasRefractiveIndex;}             //
70   Float_t GetFreonScaleFactor()                     const{ return fFreonScaleFactor;}               //
71   Float_t GetEmissionPoint()                        const{ return fLengthEmissionPoint;}            //
72   Float_t GetMassHypotesis()                        const{ return fMassHypotesis;}                  //
73   Float_t GetBetaOfParticle()                       const{ return fTrackBeta;}                      //
74   Float_t GetEntranceX()                            const{ return fXtoentr;}                        //
75   Float_t GetEntranceY()                            const{ return fYtoentr;}                        //
76   Float_t GetThetaCerenkov()                        const{ return fThetaCerenkov;}                  //
77   Float_t GetThetaPhotonCerenkov()                  const{ return fThetaPhotonCerenkov;}            //
78   Float_t GetTrackMomentum()                        const{ return fTrackMomentum;}                  //
79   Float_t GetTrackEta()                             const{ return fTrackEta;}                       //
80   Float_t GetTrackTheta()                           const{ return fTrackTheta;}                     //
81   Float_t GetTrackPhi()                             const{ return fTrackPhi;}                       //
82   Float_t GetTrackPt()                              const{ return fTrackPt;}                        //
83   Float_t GetTrackTPCLastZ()                        const{ return fTrackTPCLastZ;}                  //
84   Float_t GetMinDist()                              const{ return fMinDist;}                        //
85   Float_t GetXPointOnCathode()                      const{ return fPhotonLimitX;}                   //
86   Float_t GetYPointOnCathode()                      const{ return fPhotonLimitY;}                   //
87   Float_t GetThetaPhotonInDRS()                     const{ return fThetaPhotonInDRS;}               //
88   Float_t GetPhiPhotonInDRS()                       const{ return fPhiPhotonInDRS;}                 //
89   Float_t GetThetaPhotonInTRS()                     const{ return fThetaPhotonInTRS;}               //
90   Float_t GetPhiPhotonInTRS()                       const{ return fPhiPhotonInTRS;}                 //
91   Float_t GetThetaAtQuartz()                        const{ return fThetaAtQuartz;}                  //
92   Float_t GetPhiPoint()                             const{ return fPhiPoint;}                       //
93   Float_t GetXCoordOfEmission()                     const{ return fXEmiss;}                         //
94   Float_t GetYCoordOfEmission()                     const{ return fYEmiss;}                         //
95   Float_t GetXInnerRing()                           const{ return fXInner;}                         //
96   Float_t GetYInnerRing()                           const{ return fYInner;}                         //
97   Float_t GetRadiusInnerRing()                      const{ return fInnerRadius;}                    //
98   Float_t GetXOuterRing()                           const{ return fXOuter;}                         //
99   Float_t GetYOuterRing()                           const{ return fYOuter;}                         //
100   Float_t GetRadiusOuterRing()                      const{ return fOuterRadius;}                    //
101   Float_t GetShiftX()                               const{ return fShiftX;}                         //
102   Float_t GetShiftY()                               const{ return fShiftY;}                         //
103   Float_t GetDetectorWhereX()                       const{ return fXcoord;}                         //
104   Float_t GetDetectorWhereY()                       const{ return fYcoord;}                         //
105   Float_t GetIntersectionX()                        const{ return fIntersectionX;}                  //
106   Float_t GetIntersectionY()                        const{ return fIntersectionY;}                  //
107   Float_t GetThetaOfRing()                          const{ return fThetaOfRing;}                    //
108   Float_t GetAreaOfRing()                           const{ return fAreaOfRing;}                     //
109   Float_t GetPortionOfRing()                        const{ return fPortionOfRing;}                  //
110   Float_t GetHoughArea()                            const{ return fHoughArea;}                      //
111   Float_t GetPhotonEta()                            const{ return fPhotonEta[fPhotonIndex];}        //
112   Float_t GetPhotonWeight()                         const{ return fPhotonWeight[fPhotonIndex];}     //
113   Float_t GetHoughRMS()                             const{ return fHoughRMS;}                       //
114   Float_t* GetCandidatePhotonX()                    const{ return fCandidatePhotonX;}               //
115   Float_t* GetCandidatePhotonY()                    const{ return fCandidatePhotonY;}               //
116   Float_t GetHoughPhotonsNorm()                     const{ return fHoughPhotonsNorm;}               //
117   Float_t GetFittedTrackTheta()                     const{ return fFittedTrackTheta;}               //
118   Float_t GetFittedTrackPhi()                       const{ return fFittedTrackPhi;}                 //
119   Float_t GetFittedThetaCerenkov()                  const{ return fFittedThetaCerenkov;}            //
120   Float_t GetEstimationOfTheta()                    const{ return fEstimationOfTheta;}              //
121   Float_t GetEstimationOfThetaRMS()                 const{ return fEstimationOfThetaRMS;}           //
122   void SetEventVertexZ(Float_t EventVertZ) { fEventVertZ = EventVertZ;}                             //
123   void SetEventMultiplicity(Float_t EventMultiplicity) { fEventMultiplicity = EventMultiplicity;}   //
124   void SetPhotonEnergy(Float_t PhotonEnergy) { fPhotonEnergy = PhotonEnergy;}                       //
125   void SetFreonRefractiveIndex() {fFreonRefractiveIndex = fFreonScaleFactor*(1.177+0.0172*fPhotonEnergy);}//
126   void SetQuartzRefractiveIndex() {fQuartzRefractiveIndex = sqrt(1+(46.411/(113.763556-TMath::Power(fPhotonEnergy,2)))+(228.71/(328.51563-TMath::Power(fPhotonEnergy,2))));}//
127   void SetGasRefractiveIndex() { fGasRefractiveIndex = 1.;}                                         //
128   void SetFreonScaleFactor(Float_t FreonScaleFactor) {fFreonScaleFactor = FreonScaleFactor;}        //
129   void SetEmissionPoint(Float_t LengthEmissionPoint) { fLengthEmissionPoint = LengthEmissionPoint;} //
130   void SetMassHypotesis(Float_t mass) {fMassHypotesis = mass;}                                      //
131   void SetBetaOfParticle() { fTrackBeta = fTrackMomentum/sqrt(TMath::Power(fTrackMomentum,2)+TMath::Power(fMassHypotesis,2));}//
132   void SetEntranceX(Float_t Xtoentr) { fXtoentr = Xtoentr;}                                         //
133   void SetEntranceY(Float_t Ytoentr) { fYtoentr = Ytoentr;}                                         //
134   void SetThetaPhotonInTRS(Float_t Theta) {fThetaPhotonInTRS = Theta;}                              //
135   void SetPhiPhotonInTRS(Float_t Phi) {fPhiPhotonInTRS = Phi;}                                      //
136   void SetThetaPhotonInDRS(Float_t Theta) {fThetaPhotonInDRS = Theta;}                              //
137   void SetPhiPhotonInDRS(Float_t Phi) {fPhiPhotonInDRS = Phi;}                                      //
138   void SetThetaAtQuartz(Float_t ThetaAtQuartz) {fThetaAtQuartz = ThetaAtQuartz;}                    //
139   void SetPhiPoint(Float_t PhiPoint){ fPhiPoint = PhiPoint;}                                        //
140   void SetXCoordOfEmission(Float_t XEmiss) {fXEmiss = XEmiss;}                                      //
141   void SetYCoordOfEmission(Float_t YEmiss) {fYEmiss = YEmiss;}                                      //
142   void SetXPointOnCathode(Float_t PhotonLimitX) { fPhotonLimitX = PhotonLimitX;}                    //
143   void SetYPointOnCathode(Float_t PhotonLimitY) { fPhotonLimitY = PhotonLimitY;}                    //
144   void SetXInnerRing(Float_t XInner) {fXInner = XInner;}                                            //
145   void SetYInnerRing(Float_t YInner) {fYInner = YInner;}                                            //
146   void SetRadiusInnerRing(Float_t InnerRadius) {fInnerRadius = InnerRadius;}                        //
147   void SetXOuterRing(Float_t XOuter) {fXOuter = XOuter;}                                            //
148   void SetYOuterRing(Float_t YOuter) {fYOuter = YOuter;}                                            //
149   void SetRadiusOuterRing(Float_t OuterRadius) {fOuterRadius = OuterRadius;}                        //
150   void SetThetaCerenkov(Float_t ThetaCer) {fThetaCerenkov = ThetaCer;}                              //
151   void SetThetaPhotonCerenkov(Float_t ThetaPhotCer) {fThetaPhotonCerenkov = ThetaPhotCer;}          //
152   void SetTrackMomentum(Float_t TrackMomentum) {fTrackMomentum = TrackMomentum;}                    //
153   void SetTrackEta(Float_t TrackEta) {fTrackEta = TrackEta;}                                        //
154   void SetTrackTheta(Float_t TrackTheta) { fTrackTheta = TrackTheta;}                               //
155   void SetTrackPhi(Float_t TrackPhi) { fTrackPhi = TrackPhi;}                                       //
156   void SetTrackPt(Float_t TrackPt) { fTrackPt = TrackPt;}                                           //
157   void SetTrackCharge(Int_t TrackCharge) { fTrackCharge = TrackCharge;}                             //
158   void SetTrackTPCLastZ(Float_t TrackTPCLastZ) { fTrackTPCLastZ = TrackTPCLastZ;}                   //
159   void SetMinDist(Float_t MinDist) { fMinDist = MinDist;}                                           //
160   void SetShiftX(Float_t ShiftX) { fShiftX = ShiftX;}                                               //
161   void SetShiftY(Float_t ShiftY) { fShiftY = ShiftY;}                                               //
162   void SetDetectorWhereX(Float_t Xcoord) { fXcoord = Xcoord;}                                       //
163   void SetDetectorWhereY(Float_t Ycoord) { fYcoord = Ycoord;}                                       //
164   void SetIntersectionX(Float_t IntersectionX) { fIntersectionX = IntersectionX;}                   //
165   void SetIntersectionY(Float_t IntersectionY) { fIntersectionY = IntersectionY;}                   //
166   void SetThetaOfRing(Float_t ThetaOfRing) { fThetaOfRing = ThetaOfRing;}                           //
167   void SetAreaOfRing(Float_t AreaOfRing) { fAreaOfRing = AreaOfRing;}                               //
168   void SetPortionOfRing(Float_t PortionOfRing) { fPortionOfRing = PortionOfRing;}                   //
169   void SetHoughArea(Float_t HoughArea) { fHoughArea = HoughArea;}                                   //
170   void SetPhotonsNumber(Int_t PhotonsNumber) { fPhotonsNumber = PhotonsNumber;}                     //
171   void SetPhotonIndex(Int_t PhotonIndex) { fPhotonIndex = PhotonIndex;}                             //
172   void SetPhotonEta(Float_t PhotonEta) { fPhotonEta[fPhotonIndex] = PhotonEta;}                     //
173   void SetPhotonFlag(Int_t PhotonFlag) { fPhotonFlag[fPhotonIndex] = PhotonFlag;}                   //
174   void SetPhotonWeight(Float_t PhotonWeight) { fPhotonWeight[fPhotonIndex] = PhotonWeight;}         //
175   void SetHoughRMS(Float_t HoughRMS) { fHoughRMS = HoughRMS;}                                       //
176   void SetMipIndex(Int_t MipIndex) { fMipIndex = MipIndex;}                                         //
177   void SetTrackIndex(Int_t TrackIndex) { fTrackIndex = TrackIndex;}                                 //
178   void SetCandidatePhotonX(Float_t *CandidatePhotonX) { fCandidatePhotonX = CandidatePhotonX;}      //
179   void SetCandidatePhotonY(Float_t *CandidatePhotonY) { fCandidatePhotonY = CandidatePhotonY;}      //
180   void SetCandidatePhotonsNumber(Int_t CandidatePhotonsNumber) { fCandidatePhotonsNumber = CandidatePhotonsNumber;}//
181   void SetHoughPhotons(Int_t HoughPhotons) { fHoughPhotons = HoughPhotons;}                         //
182   void SetHoughPhotonsNorm(Float_t HoughPhotonsNorm) { fHoughPhotonsNorm = HoughPhotonsNorm;}       //
183   void SetFittedTrackTheta(Float_t FittedTrackTheta)    { fFittedTrackTheta = FittedTrackTheta;}    //
184   void SetFittedTrackPhi(Float_t FittedTrackPhi)    { fFittedTrackPhi = FittedTrackPhi;}            //
185   void SetFittedThetaCerenkov(Float_t FittedThetaCerenkov) { fFittedThetaCerenkov = FittedThetaCerenkov;}//
186   void SetFittedHoughPhotons(Int_t FittedHoughPhotons) { fFittedHoughPhotons = FittedHoughPhotons;} //
187   void SetEstimationOfTheta(Float_t EstimationOfTheta) { fEstimationOfTheta = EstimationOfTheta;}   //
188   void SetEstimationOfThetaRMS(Float_t EstimationOfThetaRMS) { fEstimationOfThetaRMS = EstimationOfThetaRMS;}//
189   void FindBetaFromTheta(Float_t ThetaCerenkov) {fTrackBeta = 1/(fFreonRefractiveIndex*cos(ThetaCerenkov));}//
190   Float_t SnellAngle(Float_t n1, Float_t n2, Float_t theta1);                                       //
191   Float_t FromEmissionToCathode();                                                                  //
192
193 protected:
194   AliRICH* fRich;                             // main poiter to RICH
195   Int_t   fTrackCharge;                       // charge track
196   Int_t fMipIndex;                            // index for Mip
197   Int_t fTrackIndex;                          // index for track
198   Int_t fPhotonsNumber;                       // Number of photons candidate
199   Int_t fPhotonIndex;                         // index of photons
200   Int_t fPhotonFlag[3000];                    // flag for photons
201   Int_t fCandidatePhotonsNumber;              // number of candidate photons
202   Int_t fHoughPhotons;                        // n. photons after Hough
203   Int_t   fFittedHoughPhotons;                // n. photons after Hough and after minimization
204   Float_t fEventVertZ;                        // z coord. of the primary vertex
205   Float_t fEventMultiplicity;                 // event primary multiplicity
206   Float_t fTrackTheta;                        // Theta of track at RICH
207   Float_t fTrackPhi;                          // Phi of track at RICH
208   Float_t fTrackMomentum;                     // track momentum
209   Float_t fTrackEta;                          // track pseudorapidity
210   Float_t fTrackPt;                           // pt of track
211   Float_t fTrackTPCLastZ;                     // z last point of the TPC
212   Float_t fMinDist;                           // min distance between extrapolated track and MIP
213   Float_t fTrackBeta;                         // beta of the track
214   Float_t fXtoentr;                           // X entrance to RICH
215   Float_t fYtoentr;                           // Y entrance to RICH
216   Float_t fThetaPhotonInTRS;                  // Theta of photon in the Track Reference System (TRS)
217   Float_t fPhiPhotonInTRS;                    // Phi of photon in TRS
218   Float_t fThetaPhotonInDRS;                  // Theta of photon in Detector Reference System (DRS)
219   Float_t fPhiPhotonInDRS;                    // Phi of photon in DRS
220   Float_t fThetaAtQuartz;                     // Theta at the quartz entrance
221   Float_t fPhiPoint;                          // phi of ring point
222   Float_t fXEmiss;                            //  x emission
223   Float_t fYEmiss;                            //  y emission
224   Float_t fXInner;                            // X inner ring
225   Float_t fYInner;                            // Y inner ring
226   Float_t fXOuter;                            // X outer ring
227   Float_t fYOuter;                            // Y outer ring
228   Float_t fInnerRadius;                       // inner radius
229   Float_t fOuterRadius;                       // outer radius
230   Float_t fPhotonEnergy;                      // photon energy
231   Float_t fFreonRefractiveIndex;              // n freon
232   Float_t fQuartzRefractiveIndex;             // n quartz
233   Float_t fGasRefractiveIndex;                // n gas
234   Float_t fFreonScaleFactor;                  // scale factor for n freon
235   Float_t fLengthEmissionPoint;               // lenght of emmission point
236   Float_t fPhotonLimitX;                      // X phys limit for photon
237   Float_t fPhotonLimitY;                      // Y phys limit for photon 
238   Float_t fDistanceFromCluster;               // distance from cluster
239   Float_t fMassHypotesis;                     // reconstructed mass
240   Float_t fCerenkovAnglePad;                  // cherenkov angle of pad
241   Float_t fThetaPhotonCerenkov;               // theta cerenkov for photon
242   Float_t fShiftX;                            // x shift to entrance in radiator
243   Float_t fShiftY;                            // y shift to entrance in radiator
244   Float_t fXcoord;                            // ..
245   Float_t fYcoord;                            // ..
246   Float_t fIntersectionX;                     // ..
247   Float_t fIntersectionY;                     // ..
248   Float_t fThetaOfRing;                       // theta of ring
249   Float_t fAreaOfRing;                        // area of the ring
250   Float_t fPortionOfRing;                     // fraction of the accepted ring
251   Float_t fHoughArea;                         // area Hough
252   Float_t fPhotonEta[3000];                   // theta cerenkov of photon candidates
253   Float_t fPhotonWeight[3000];                // weigth
254   Float_t fHoughRMS;                          // rms Hough
255   Float_t* fCandidatePhotonX;                 // x photon candidates
256   Float_t* fCandidatePhotonY;                 // y photon candidates
257   Float_t fHoughPhotonsNorm;                  // n. photons norm.
258   Float_t fFittedTrackTheta;                  // theta track after minim.
259   Float_t fFittedTrackPhi;                    // phi track after minim.
260   Float_t fFittedThetaCerenkov;               // thetacerenkov after minim.
261   Float_t fEstimationOfTheta;                 // theta estimate
262   Float_t fEstimationOfThetaRMS;              // theta RMS
263   Int_t   fThetaBin;                          // bin in theta
264   Float_t fThetaMin,fThetaMax;                // min max
265   Float_t fXmin,fXmax,fYmin,fYmax;            // xy min max
266   TFile  *fOutFile;                           // histogram output
267   TNtuple *fNtuple;                           // output ntuple
268   TCanvas *fDisplay;                          // for display
269   Int_t   fNrings;                            //current number of reconstructed rings
270   Bool_t  fDebug;                             // flag for debug
271   Bool_t  fIsDISPLAY;                         // flag for display
272   Bool_t  fIsWEIGHT;                          // flag to consider weight procedure
273   Bool_t  fIsBACKGROUND;                      // flag to simulate bkg
274   Bool_t  fIsMINIMIZER;                       // flag to start with (theta,phi) minimization
275   Int_t   fNpadX;                             // npadx
276   Int_t   fNpadY;                             // npady
277   Float_t fPadSizeX;                          // sizepad x
278   Float_t fPadSizeY;                          // sizepad y
279   Float_t fRadiatorWidth;                     // radiator width
280   Float_t fQuartzWidth;                       // quartz width
281   Float_t fGapWidth;                          // gap width
282   Float_t fDTheta;                            // Step for sliding window
283   Float_t fWindowWidth;                       // Hough width of sliding window
284   
285   Int_t   fNumEtaPhotons;                     // Number of photons
286   Int_t   fEtaFlag[3000];                     // flag for good photons
287   Float_t fEtaPhotons[3000];                  // Cerenkov angle each photon
288   Float_t fWeightPhotons[3000];               // weight for each photon
289   Float_t fThetaCerenkov;                     // Theta angle for Hough
290   Float_t fWeightThetaCerenkov;               // Theta Cerenkov angle weighted
291   Float_t fThetaPeakPos;                      // Peak position
292
293
294   ClassDef(AliRICHRecon,0)
295 };
296     
297 #endif // #ifdef AliRICHRecon_cxx
298