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();
73 void ShowMessages() { fShowMessage = kTRUE; }
74 void SetTotalChargeInSlice0() { fTotalChargeInSlice0 = kTRUE; }
75 void StoreResults(const Char_t *filename = "HFEtrdPIDqa.root");
76 void SaveThresholdParameters(const Char_t * filename = "TRD.Thresholds.root", Double_t lowerLimit = 0.5, Double_t upperLimit = 3.5);
78 TGraphErrors *GetPionEfficiency(Int_t ntracklets, Int_t eleffpercent);
79 TGraphErrors *GetProtonEfficiency(Int_t ntracklets, Int_t eleffpercent);
80 TGraph *GetThreshold(Int_t ntracklets, Int_t eleffpercent);
82 void DrawTracklet(Int_t tracklet, Double_t pmin = -1., Double_t pmax = -1., Bool_t doFit = kFALSE);
85 Double_t EvalPionEfficiency(Int_t ntls, Int_t eEff, Double_t p);
86 Double_t EvalProtonEfficiency(Int_t ntls, Int_t eEff, Double_t p);
87 Double_t EvalThreshold(Int_t ntls, Int_t eEff, Double_t p);
89 Double_t CalculateIntegratedPionEfficiency(UInt_t nTracklets, Double_t electronEff, Double_t pmin, Double_t pmax, Double_t *error = NULL);
91 //---------------------------------------------------
92 // Getters for Histograms
93 THnSparseF *GetLikelihoodHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fLikeTRD")) : NULL; }
94 THnSparseF *GetQAHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAtrack")) : NULL; }
95 THnSparseF *GetdEdxHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAdEdx")) : NULL; }
96 THnSparseF *GetHistoTruncMean() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fTRDtruncMean")) : NULL; }
97 TH2 *GetSliceChargePions(Bool_t pions = kTRUE) const {
98 const Char_t * species = pions ? "Pions" : "Electrons";
99 return fHistos ? dynamic_cast<TH2 *>(fHistos->Get(Form("fTRDslices%s", species))) : NULL;
101 AliHFEcollection *GetHistos() const { return fHistos; }
102 //---------------------------------------------------
104 // Description of the containers we use to store basic information
105 // we access in the Post Processing. For all containers we have a
106 // common part containing species, momentum and number of tracklets,
107 // and a specific part. For both containers we define the number of
109 enum QuantitiesCommon_t{
113 kQuantitiesCommon = 3
115 enum QuantitiesLike_t{
120 enum QuantitiesQAtrack_t{
121 kNonZeroTrackletCharge = 3,
125 enum QuantitiesdEdx_t{
131 enum QuantitiesTruncMean_t{
135 kQuantitiesTruncMean = 6
138 void ProcessTrackESD(const AliESDtrack * const track, Int_t species);
139 void ProcessTrackAOD(const AliAODTrack * const track, Int_t species);
141 void FillTRDLikelihoods(const AliESDtrack * const track, Int_t species);
142 void FillTRDQAplots(const AliESDtrack *const track, Int_t species);
144 void AnalyseNTracklets(Int_t nTracklets);
145 Double_t CalculateHadronEfficiency(const TH1 * const hadron, const TH1 *const electron, Double_t eff, Int_t &threshbin, Double_t &error);
146 TF1 *MakeThresholds(TGraph *input, Double_t lowerLimit, Double_t upperLimit);
148 void CreateLikelihoodHistogram();
149 void CreateQAHistogram();
150 void CreatedEdxHistogram();
151 void CreateHistoTruncatedMean();
157 static const Double_t fgkElectronEff[kNElectronEffs]; // Electron efficiency bins
158 static const Int_t fgkNBinsCommon[kQuantitiesCommon]; // Number of bins for common quantities
159 static const Double_t fgkMinBinCommon[kQuantitiesCommon]; // Bin Limits for common quantities (lower limit)
160 static const Double_t fgkMaxBinCommon[kQuantitiesCommon]; // Bin Limits for common quantities (upper limit)
161 AliHFEpidTRD *fTRDpid; // HFE PID for TRD
162 AliHFEcollection *fHistos; // Histogram collection
164 // List for Histograms:
165 TList *fPionEfficiencies; //! List for Pion efficiencies
166 TList *fProtonEfficiencies; //! List for Proton efficiencies
167 TList *fKaonEfficiencies; //! List for Kaon efficiencies
169 TList *fThresholds; //! List for Threshold Graphs
171 Bool_t fShowMessage; // Display debug messages
172 Bool_t fTotalChargeInSlice0; // Flag for Foreward/Backward compatibility in TRD total charge calculation
174 ClassDef(AliHFEtrdPIDqa, 3) // QA class for TRD PID