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