]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/AliIntSpotEstimator.h
585b055aa90ff501ee97ddb495855cad62305d35
[u/mrichter/AliRoot.git] / PWG1 / AliIntSpotEstimator.h
1 #ifndef ALIINTSPOTESTIMATOR_H
2 #define ALIINTSPOTESTIMATOR_H
3
4 #include <TNamed.h>
5 #include <TObjArray.h>
6 #include <TMath.h>
7 #include <TH2F.h>
8 #include <TAxis.h>
9
10 class TH1;
11 class TCanvas;
12 class AliESDEvent;
13 class AliESDtrack;
14 class AliESDVertex;
15 class AliVertexerTracks;
16
17 class AliIntSpotEstimator : public TNamed {
18   //
19  public:
20   //
21   AliIntSpotEstimator(Bool_t initDef=kFALSE);
22   AliIntSpotEstimator(const char* name, Double_t outcut=1e-4,
23                       Int_t nPhiBins=12,Int_t nestb=500,
24                       Double_t estmin=-2e-2,Double_t estmax=6e-2,
25                       Int_t ntrBins=10,Int_t ntMn=2,Int_t ntMx=32,
26                       Int_t nPBins=14,Double_t pmn=0.2,Double_t pmx=3.);
27   ~AliIntSpotEstimator();
28   AliIntSpotEstimator &operator += (const AliIntSpotEstimator &src);  
29   //
30   void          InitEstimators(Int_t nPhiBins=12,Int_t nestb=500,
31                                Double_t estmin=-2e-2,Double_t estmax=6e-2,
32                                Int_t ntrBins=10,Int_t ntMn=2,Int_t ntMx=32,
33                                Int_t nPBins=14,Double_t pmn=0.2,Double_t pmx=3.);
34   //
35   Bool_t        ProcessEvent(const AliESDEvent* esd, const AliESDVertex* vtx=0);
36   Bool_t        ProcessEvent(const TObjArray* tracks);
37   //
38   Double_t      GetIPCenter(Int_t id)                 const  {return fIPCenterStat>0 ? fIPCenter[id]/fIPCenterStat:0;}
39   Double_t      GetIPSigma(Int_t phibin=0)            const;
40   Double_t      GetVtxSigma(int ntr)                  const;
41   Double_t      GetDCASigma(double p)                 const;
42   //
43   Int_t         GetEventsAccepted()                   const  {return fIPCenterStat;} 
44   Int_t         GetEventsProcessed()                  const  {return fEvProc;} 
45   //
46   void          SetOutlierCut(Double_t v=1e-4)               {fOutlierCut = v;}
47   //
48   TH2F*         GetHistoIP()                          const  {return fEstimIP;}
49   TH2F*         GetHistoVtx()                         const  {return fEstimVtx;}
50   TH2F*         GetHistoTrc()                         const  {return fEstimTrc;}
51   AliVertexerTracks* GetVertexer()                    const  {return fVertexer;}
52   //
53   Int_t         GetNPhiBins()    const {return !IsValid() ? 0:fEstimIP->GetXaxis()->GetNbins();}
54   Int_t         GetNTrackBins()  const {return !IsValid() ? 0:fEstimVtx->GetXaxis()->GetNbins();}
55   Int_t         GetMinTracks()   const {return !IsValid() ? 0:TMath::Nint(fEstimVtx->GetXaxis()->GetXmin());}
56   Int_t         GetMaxTracks()   const {return !IsValid() ? 0:TMath::Nint(fEstimVtx->GetXaxis()->GetXmax());}
57   Int_t         GetNPBins()      const {return !IsValid() ? 0:fEstimTrc->GetXaxis()->GetNbins();}
58   Double_t      GetTrackMinP()   const {return !IsValid() ? 0:1./fEstimTrc->GetXaxis()->GetXmax();}
59   Double_t      GetTrackMaxP()   const {return !IsValid() ? 0:1./fEstimTrc->GetXaxis()->GetXmin();}
60   //
61   TCanvas*      CreateReport(const char* outname = 0);
62   virtual void  Print(Option_t *opt="")               const;
63   virtual void  Clear(Option_t *opt="");
64   virtual Long64_t Merge(TCollection *coll);
65   static Double_t CalcMean(TH1* histo, Double_t ctfact);
66   //
67  protected:
68   Bool_t        IsValid()       const {return fEstimIP!=0;}
69   Bool_t        IsZero(Double_t v,Double_t thresh=1e-15) const {return TMath::Abs(v)<thresh;}
70   Bool_t        ProcessTracks();
71   Bool_t        ProcessIPCenter(const AliESDVertex* vtx);
72   Bool_t        ProcessEstimators(const AliESDEvent* esd);
73   void          UpdateEstimators(double rvD, double rtD, double nTracks, double pTrack, double phiTrack);
74   //
75  private :
76   AliIntSpotEstimator(const AliIntSpotEstimator &src);
77   AliIntSpotEstimator &operator=(const AliIntSpotEstimator &src);  
78   //
79  protected:
80   //
81   Int_t         fEvProc;                         // number of events processed
82   Int_t         fIPCenterStat;                   // number of events used for fIPCenter
83   Double_t      fOutlierCut;                     // cut on outliers
84   Double_t      fIPCenter[3];                    // mean IP position XYZ
85   //
86   TH2F         *fEstimIP;                        // distribution of IP estimator
87   TH2F         *fEstimVtx;                       // distribution of VTRes estimator
88   TH2F         *fEstimTrc;                       // distribution of DCA res estimator
89   //
90   AliVertexerTracks* fVertexer;                  //! vertex fitter
91   TObjArray    *fTracks;                         //! storage for processed tracks
92   //
93  ClassDef(AliIntSpotEstimator,1)
94 };
95
96
97 #endif