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