]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEtrdPIDqa.h
Corrections for Coverity warnings
[u/mrichter/AliRoot.git] / PWG3 / 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 TBrowser;
40 class TCollection;
41 class TF1;
42 class TGraph;
43 class TH1;
44 //class TH2;
45 class TList;
46 class TObjArray;
47
48 class AliAODTrack;
49 class AliESDtrack;
50 class AliVTrack;
51 class AliHFEpidTRD;
52
53 class AliHFEtrdPIDqa : public TNamed{
54   public:
55     AliHFEtrdPIDqa();
56     AliHFEtrdPIDqa(const Char_t *name);
57     AliHFEtrdPIDqa(const AliHFEtrdPIDqa &ref);
58     AliHFEtrdPIDqa &operator=(const AliHFEtrdPIDqa &ref);
59     virtual void Copy(TObject &o) const;
60     virtual Long64_t Merge(TCollection *coll);
61     virtual ~AliHFEtrdPIDqa();
62    
63     virtual void Browse(TBrowser *b);
64     virtual Bool_t IsFolder() const { return kTRUE; }
65
66     void ProcessTracks(TObjArray * const  l, Int_t species);
67     void ProcessTrack(AliVTrack *track, Int_t species);
68
69     void Init();
70     void FinishAnalysis();
71     void ShowMessages() { fShowMessage = kTRUE; }
72     void StoreResults(const Char_t *filename = "HFEtrdPIDqa.root");
73     void SaveThresholdParameters(const Char_t * filename = "TRD.Thresholds.root");
74
75     void DrawTracklet(Int_t tracklet, Double_t pmin = 0., Double_t pmax = 0., Bool_t doFit = kFALSE);
76     void ClearLists();
77
78     Double_t EvalPionEfficiency(Int_t ntls, Int_t eEff, Double_t p);
79     Double_t EvalProtonEfficiency(Int_t ntls, Int_t eEff, Double_t p);
80     Double_t EvalThreshold(Int_t ntls, Int_t eEff, Double_t p);
81
82     //---------------------------------------------------
83     // Getters for Histograms
84     THnSparseF *GetLikelihoodHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fLikeTRD")) : NULL; }
85     THnSparseF *GetQAHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAtrack")) : NULL; }
86     THnSparseF *GetdEdxHistogram() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fQAdEdx")) : NULL; }
87     THnSparseF *GetHistoTruncMean() const { return fHistos ? dynamic_cast<THnSparseF *>(fHistos->Get("fTRDtruncMean")) : NULL; }
88     TH2 *GetSliceChargePions(Bool_t pions = kTRUE) const { 
89       const Char_t * species = pions ? "Pions" : "Electrons";
90       return fHistos ? dynamic_cast<TH2 *>(fHistos->Get(Form("fTRDslices%s", species))) : NULL; 
91     }
92     AliHFEcollection *GetHistos() const { return fHistos; }
93     //---------------------------------------------------
94   protected:
95     // Description of the containers we use to store basic information
96     // we access in the Post Processing. For all containers we have a 
97     // common part containing species, momentum and number of tracklets,
98     // and a specific part. For both containers we define the number of 
99     // variables too
100     enum QuantitiesCommon_t{
101       kSpecies = 0,
102       kP = 1,
103       kNTracklets = 2,
104       kQuantitiesCommon = 3
105     };
106     enum QuantitiesLike_t{
107       kElectronLike = 3,
108       kQuantitiesLike = 4
109     };
110     enum QuantitiesQAtrack_t{
111       kNonZeroTrackletCharge = 3,
112       kNClusters = 4,
113       kQuantitiesQA = 5
114     };
115     enum QuantitiesdEdx_t{
116       kNclusters = 3,
117       kNonZeroSlices = 4,
118       kdEdx = 5,
119       kQuantitiesdEdx = 6
120     };
121     enum QuantitiesTruncMean_t{
122       kTPCdEdx = 3,
123       kTRDdEdxMethod1 = 4,
124       kTRDdEdxMethod2 = 5,
125       kQuantitiesTruncMean = 6
126     };
127
128     void ProcessTrackESD(AliESDtrack *track, Int_t species);
129     void ProcessTrackAOD(AliAODTrack * const track, Int_t species);
130
131     void FillTRDLikelihoods(AliESDtrack *track, Int_t species);
132     void FillTRDQAplots(AliESDtrack *track, Int_t species);
133
134     void AnalyseNTracklets(Int_t nTracklets);
135     Int_t GetThresholdBin(TH1 * const input, Double_t efficiency);
136     Bool_t CalculateEfficiency(TH1 * const input, Int_t threshbin, Double_t *params);
137     TF1 *MakeThresholds(TGraph *input);
138
139     void CreateLikelihoodHistogram();
140     void CreateQAHistogram();
141     void CreatedEdxHistogram();
142     void CreateHistoTruncatedMean();
143
144   private:
145     enum{
146       kNElectronEffs = 6
147     };
148     static const Double_t fgkElectronEff[kNElectronEffs];       // Electron efficiency bins
149     static const Int_t    fgkNBinsCommon[kQuantitiesCommon];    // Number of bins for common quantities
150     static const Double_t fgkMinBinCommon[kQuantitiesCommon];   // Bin Limits for common quantities (lower limit)
151     static const Double_t fgkMaxBinCommon[kQuantitiesCommon];   // Bin Limits for common quantities (upper limit)
152     AliHFEpidTRD *fTRDpid;        // HFE PID for TRD
153     AliHFEcollection *fHistos;    // Histogram collection
154
155     // List for Histograms:
156     TList *fPionEfficiencies;     //! List for Pion efficiencies
157     TList *fProtonEfficiencies;   //! List for Proton efficiencies
158     TList *fKaonEfficiencies;     //! List for Kaon efficiencies
159
160     TList *fThresholds;           //! List for Threshold Graphs
161
162     Bool_t fShowMessage;         // Display debug messages
163   
164   ClassDef(AliHFEtrdPIDqa, 3)     // QA class for TRD PID 
165 };
166 #endif
167