]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaRec/AliTRDcheckPID.h
- prepare train for merging with TPC.
[u/mrichter/AliRoot.git] / TRD / qaRec / AliTRDcheckPID.h
1 #ifndef ALITRDCHECKPID_H
2 #define ALITRDCHECKPID_H
3
4 //////////////////////////////////////////////////////
5 //
6 // Task to check PID performance of the TRD
7 //
8 // Author : Alex Wilk <wilka@uni-muenster.de>
9 //          Alex Bercuci <A.Bercuci@gsi.de>
10 //          Markus Fasel <M.Fasel@gsi.de>
11 //
12 ///////////////////////////////////////////////////////
13
14 #ifndef ROOT_TAxis
15 #include "TAxis.h"
16 #endif
17
18 #ifndef ALITRDRECOTASK_H
19 #include "AliTRDrecoTask.h"
20 #endif
21
22 class AliTRDReconstructor;
23 class AliTRDpidUtil;
24 class AliTRDcheckPID : public AliTRDrecoTask 
25 {
26   // Plots registered for this task
27   enum{
28      kEfficiency     =  0     // pi Efficiency plot
29     ,kdEdx           =  1     // dE/dx spectra
30     ,kdEdxSlice      =  2     // dE/dx spectra
31     ,kPH             =  3     // pulse height spectra
32     ,kNClus          =  4     //  number of clusters per track
33     ,kMomentum       =  5     // momentum distribution
34     ,kMomentumBin    =  6     // momentum distribution
35     ,kThresh         =  7     // threshold in efficiency
36     ,kNTracklets     =  8     // Number of tracklets per track
37     ,kNPlots         =  9     // Number of plots for this tasks 
38   };
39 public:
40   AliTRDcheckPID();
41   virtual ~AliTRDcheckPID();
42   
43   virtual void    CreateOutputObjects();
44   virtual Bool_t  GetRefFigure(Int_t ifig);
45   virtual Bool_t  PostProcess();
46   virtual void    Terminate(Option_t *);
47
48   TH1 *PlotLQ(const AliTRDtrackV1 *track = 0x0);
49   TH1 *PlotNN(const AliTRDtrackV1 *track = 0x0);
50   TH1 *PlotESD(const AliTRDtrackV1 *track = 0x0);
51   TH1 *PlotdEdx(const AliTRDtrackV1 *track = 0x0);
52   TH1 *PlotdEdxSlice(const AliTRDtrackV1 *track = 0x0);
53   TH1 *PlotPH(const AliTRDtrackV1 *track = 0x0);
54   TH1 *PlotNClus(const AliTRDtrackV1 *track = 0x0);
55   TH1 *PlotNTracklets(const AliTRDtrackV1 *track = 0x0);
56   TH1 *PlotMom(const AliTRDtrackV1 *track = 0x0);
57   TH1 *PlotMomBin(const AliTRDtrackV1 *track = 0x0);
58
59   void SetRequireMinNTracklets(Int_t mintracklets) { fMinNTracklets = mintracklets; }
60   void SetRequireMaxNTracklets(Int_t maxtracklets) { fMaxNTracklets = maxtracklets; }
61
62   TObjArray *GetGraphs() { return fGraph; };
63   //TObjArray *GetHistos() { return fContainer; };
64   virtual TObjArray *Histos();
65   void EvaluatePionEfficiency(TObjArray *histoContainer, TObjArray *results, Float_t electron_efficiency);
66   inline void SetMomentumBinning(Int_t nBins, Double_t *bins);
67   inline Int_t FindBin(Int_t species, Double_t momentum);
68   inline Bool_t IsInRange(Double_t momentum);
69
70 private:
71   AliTRDcheckPID(const AliTRDcheckPID&);               // not implemented
72   AliTRDcheckPID& operator=(const AliTRDcheckPID&);    // not implemented
73
74   Int_t  CalcPDG(AliTRDtrackV1* track = 0x0);
75   Bool_t CheckTrackQuality(const AliTRDtrackV1* track = 0x0);
76   
77   AliTRDReconstructor *fReconstructor;     //! reconstructor needed for recalculation the PID
78   AliTRDpidUtil       *fUtil;              //! utility class for PID calculations
79   TObjArray           *fGraph;             //! array of graphs filled in PostProcess
80   TObjArray           *fEfficiency;        //! array of histograms with efficiency
81   TAxis               *fMomentumAxis;      //! helper mementum binning
82   Int_t                fMinNTracklets;     // minimum number of required Tracklets (for systematic studies)
83   Int_t                fMaxNTracklets;     // maximum number of required Tracklets (for systematic studies) 
84   ClassDef(AliTRDcheckPID, 1); // TRD PID checker
85 };
86
87 //________________________________________________________________________
88 inline void AliTRDcheckPID::SetMomentumBinning(Int_t nBins, Double_t *bins){
89   //
90   // Set the Momentum Bins
91   //
92   if(fMomentumAxis) delete fMomentumAxis;
93   fMomentumAxis = new TAxis(nBins, bins);
94 }
95
96 //________________________________________________________________________
97 inline Int_t AliTRDcheckPID::FindBin(Int_t species, Double_t momentum){
98   //
99   // Find the Bin in the 2D Histogram
100   //
101   return species * fMomentumAxis->GetNbins() + (fMomentumAxis->FindBin(momentum) -1);
102 }
103
104 //________________________________________________________________________
105 inline Bool_t AliTRDcheckPID::IsInRange(Double_t momentum){
106   //
107   // Check Whether momentum is in the defined Range
108   //
109   return (momentum >= fMomentumAxis->GetXmin() && momentum <= fMomentumAxis->GetXmax());
110 }
111
112 #endif