]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEtrdPIDqa.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEtrdPIDqa.h
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15 //
16 // QA class for TRD PID
17 // Evaluate TRD PID using well identified reference tracks
18 // For more information see implementation file
19 //
20 #ifndef ALIHFETRDPIDQA_H
21 #define ALIHFETRDPIDQA_H
22
23 #ifndef ROOT_TNamed
24 #include <TNamed.h>
25 #endif
26
27 #ifndef ROOT_THnSparse
28 #include <THnSparse.h>
29 #endif
30
31 #ifndef ROOT_TH2
32 #include <TH2.h>
33 #endif
34
35 #ifndef ALIHFECOLLECTION_H
36 #include "AliHFEcollection.h"
37 #endif
38
39 class TArrayD;
40 class TBrowser;
41 class TCollection;
42 class TF1;
43 class TGraph;
44 class TGraphErrors;
45 class TH1;
46 //class TH2;
47 class TList;
48 class TObjArray;
49
50 class AliAODTrack;
51 class AliESDtrack;
52 class AliVTrack;
53 class AliHFEpidTRD;
54
55 class AliHFEtrdPIDqa : public TNamed{
56   public:
57     AliHFEtrdPIDqa();
58     AliHFEtrdPIDqa(const Char_t *name);
59     AliHFEtrdPIDqa(const AliHFEtrdPIDqa &ref);
60     AliHFEtrdPIDqa &operator=(const AliHFEtrdPIDqa &ref);
61     virtual void Copy(TObject &o) const;
62     virtual Long64_t Merge(TCollection *coll);
63     virtual ~AliHFEtrdPIDqa();
64    
65     virtual void Browse(TBrowser *b);
66     virtual Bool_t IsFolder() const { return kTRUE; }
67
68     void ProcessTracks(const TObjArray * const  l, Int_t species);
69     void ProcessTrack(const AliVTrack *const track, Int_t species);
70
71     void Init();
72     void FinishAnalysis(Int_t fCentrality = -1, Bool_t isGreaterEqual = kFALSE);
73     void ShowMessages() { fShowMessage = kTRUE; }
74     void SetTotalChargeInSlice0() { fTotalChargeInSlice0 = kTRUE; }
75     void SetCentralityBin(Int_t centrality) { fCentralityBin = centrality; };
76     void StoreResults(const Char_t *filename = "HFEtrdPIDqa.root");
77     void SaveThresholdParameters(const Char_t * filename = "TRD.Thresholds.root", Double_t lowerLimit = 0.5, Double_t upperLimit = 3.5, Int_t fCentrality = -1);
78
79     TGraphErrors *GetPionEfficiency(Int_t ntracklets, Int_t eleffpercent, Int_t centrality = -1);
80     TGraphErrors *GetProtonEfficiency(Int_t ntracklets, Int_t eleffpercent, Int_t centrality = -1);
81     TGraph *GetThreshold(Int_t ntracklets, Int_t eleffpercent, Int_t centrality = -1);
82
83     void DrawTracklet(Int_t tracklet, Double_t pmin = -1., Double_t pmax = -1., Int_t centrality = -1, Bool_t doFit = kFALSE);
84     //void DrawTrackletsame(Int_t tracklet, Double_t pmin = -1., Double_t pmax = -1., Bool_t doFit = kFALSE);
85     void ClearLists();
86
87     Double_t EvalPionEfficiency(Int_t ntls, Int_t eEff, Double_t p, Int_t centrality = -1);
88     Double_t EvalProtonEfficiency(Int_t ntls, Int_t eEff, Double_t p, Int_t centrality = -1);
89     Double_t EvalThreshold(Int_t ntls, Int_t eEff, Double_t p, Int_t centrality = -1);
90
91     Double_t CalculateIntegratedPionEfficiency(UInt_t nTracklets, Double_t electronEff, Double_t pmin, Double_t pmax, Int_t icentrality =-1, Double_t *error = NULL);
92
93
94
95     //---------------------------------------------------
96     // Getters for Histograms
97     THnSparseF *GetLikelihoodHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fLikeTRD")) : NULL; }
98     THnSparseF *GetQAHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAtrack")) : NULL; }
99     THnSparseF *GetdEdxHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAdEdx")) : NULL; }
100     THnSparseF *GetHistoTruncMean() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fTRDtruncMean")) : NULL; }
101     TH2 *GetSliceChargePions(Bool_t pions = kTRUE) const { 
102       const Char_t * species = pions ? "Pions" : "Electrons";
103       return fHistos ? dynamic_cast<TH2 *>(fHistos->Get(Form("fTRDslices%s", species))) : NULL; 
104     }
105     AliHFEcollection *GetHistos() const { return fHistos; }
106     //---------------------------------------------------
107   protected:
108     // Description of the containers we use to store basic information
109     // we access in the Post Processing. For all containers we have a 
110     // common part containing species, momentum and number of tracklets,
111     // and a specific part. For both containers we define the number of 
112     // variables too
113     enum QuantitiesCommon_t{
114       kSpecies = 0,
115       kP = 1,
116       kNTracklets = 2,
117       kQuantitiesCommon = 3
118     };
119     enum QuantitiesLike_t{
120       kElectronLike = 3,
121       kNClustersLike = 4,
122       kCentralityBinLike = 5,
123       kQuantitiesLike = 6
124     };
125     enum QuantitiesQAtrack_t{
126       kNonZeroTrackletCharge = 3,
127       kNClusters = 4,
128       kCentralityBinQA = 5,
129       kQuantitiesQA = 6
130     };
131     enum QuantitiesdEdx_t{
132       kNclusters = 3,
133       kNonZeroSlices = 4,
134       kdEdx = 5,
135       kCentralityBindEdx = 6,
136       kQuantitiesdEdx = 7
137     };
138     enum QuantitiesTruncMean_t{
139       kTPCdEdx = 3,
140       kTRDdEdxMethod1 = 4,
141       kTRDdEdxMethod2 = 5,
142       kCentralityBinTruncMean = 6,
143       kQuantitiesTruncMean = 7
144     };
145
146     void ProcessTrackESD(const AliESDtrack * const track, Int_t species);
147     void ProcessTrackAOD(const AliAODTrack * const track, Int_t species);
148
149     void FillTRDLikelihoods(const AliESDtrack * const track, Int_t species);
150     void FillTRDQAplots(const AliESDtrack *const track, Int_t species);
151
152     void AnalyseNTracklets(Int_t nTracklets, Int_t fCentrality = -1, Bool_t isGreaterEqual = kFALSE);
153     Double_t CalculateHadronEfficiency(const TH1 * const hadron, const TH1 *const electron, Double_t eff, Int_t &threshbin, Double_t &error);
154     Double_t EstimateThresholdError(const TH1 * const electron, Int_t threshbin);
155     TF1 *MakeThresholds(TGraph *input, Double_t lowerLimit, Double_t upperLimit);
156
157     void CreateLikelihoodHistogram();
158     void CreateQAHistogram();
159     void CreatedEdxHistogram();
160     void CreateHistoTruncatedMean();
161
162   private:
163     enum{
164       kNElectronEffs = 6
165     };
166     static const Double_t fgkElectronEff[kNElectronEffs];       // Electron efficiency bins
167     static const Int_t    fgkNBinsCommon[kQuantitiesCommon];    // Number of bins for common quantities
168     static const Double_t fgkMinBinCommon[kQuantitiesCommon];   // Bin Limits for common quantities (lower limit)
169     static const Double_t fgkMaxBinCommon[kQuantitiesCommon];   // Bin Limits for common quantities (upper limit)
170     AliHFEpidTRD *fTRDpid;        // HFE PID for TRD
171     AliHFEcollection *fHistos;    // Histogram collection
172
173     // List for Histograms:
174     TList *fPionEfficiencies;     //! List for Pion efficiencies
175     TList *fProtonEfficiencies;   //! List for Proton efficiencies
176     TList *fKaonEfficiencies;     //! List for Kaon efficiencies
177
178     TList *fThresholds;           //! List for Threshold Graphs
179
180     Bool_t fShowMessage;          // Display debug messages
181     Bool_t fTotalChargeInSlice0;  // Flag for Foreward/Backward compatibility in TRD total charge calculation
182
183     Int_t  fCentralityBin;         // Centrality Bin
184
185   ClassDef(AliHFEtrdPIDqa, 3)     // QA class for TRD PID 
186 };
187 #endif
188