1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // QA class for TRD PID
17 // Evaluate TRD PID using well identified reference tracks
18 // For more information see implementation file
20 #ifndef ALIHFETRDPIDQA_H
21 #define ALIHFETRDPIDQA_H
27 #ifndef ROOT_THnSparse
28 #include <THnSparse.h>
35 #ifndef ALIHFECOLLECTION_H
36 #include "AliHFEcollection.h"
55 class AliHFEtrdPIDqa : public TNamed{
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();
65 virtual void Browse(TBrowser *b);
66 virtual Bool_t IsFolder() const { return kTRUE; }
68 void ProcessTracks(const TObjArray * const l, Int_t species);
69 void ProcessTrack(const AliVTrack *const track, Int_t species);
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);
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);
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);
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);
91 Double_t CalculateIntegratedPionEfficiency(UInt_t nTracklets, Double_t electronEff, Double_t pmin, Double_t pmax, Int_t icentrality =-1, Double_t *error = NULL);
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;
105 AliHFEcollection *GetHistos() const { return fHistos; }
106 //---------------------------------------------------
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
113 enum QuantitiesCommon_t{
117 kQuantitiesCommon = 3
119 enum QuantitiesLike_t{
122 kCentralityBinLike = 5,
125 enum QuantitiesQAtrack_t{
126 kNonZeroTrackletCharge = 3,
128 kCentralityBinQA = 5,
131 enum QuantitiesdEdx_t{
135 kCentralityBindEdx = 6,
138 enum QuantitiesTruncMean_t{
142 kCentralityBinTruncMean = 6,
143 kQuantitiesTruncMean = 7
146 void ProcessTrackESD(const AliESDtrack * const track, Int_t species);
147 void ProcessTrackAOD(const AliAODTrack * const track, Int_t species);
149 void FillTRDLikelihoods(const AliESDtrack * const track, Int_t species);
150 void FillTRDQAplots(const AliESDtrack *const track, Int_t species);
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);
157 void CreateLikelihoodHistogram();
158 void CreateQAHistogram();
159 void CreatedEdxHistogram();
160 void CreateHistoTruncatedMean();
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
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
178 TList *fThresholds; //! List for Threshold Graphs
180 Bool_t fShowMessage; // Display debug messages
181 Bool_t fTotalChargeInSlice0; // Flag for Foreward/Backward compatibility in TRD total charge calculation
183 Int_t fCentralityBin; // Centrality Bin
185 ClassDef(AliHFEtrdPIDqa, 3) // QA class for TRD PID