Updates by Ionut
[u/mrichter/AliRoot.git] / PWGPP / TRD / AliTRDcheckESD.h
CommitLineData
6982e2cc 1#ifndef ALITRDCHECKESD_H
2#define ALITRDCHECKESD_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id: AliTRDcheckESD.h 27496 2008-07-22 08:35:45Z cblume $ */
7
8/////////////////////////////////////////////////////
9//
10// Check basic detector results at ESD level
11//
12// Author
13// Alex Bercuci <A.Bercuci@gsi.de>
14//
15//////////////////////////////////////////////////////
16
17#ifndef ALIANALYSISTASK_H
18#include "AliAnalysisTaskSE.h"
19#endif
20
21class AliESDEvent;
22class AliMCEvent;
23class AliESDpid;
24class AliCFContainer;
25class AliAnalysisCuts;
26class TH1;
27class TH2;
28class TH1F;
29class TH1D;
30class TH2F;
31class TH3F;
32class TH3;
33class TObjArray;
34class TGraph;
35class TGraphErrors;
36class TAxis;
37
38class AliTRDcheckESD : public AliAnalysisTaskSE {
39public:
40 enum ETRDcheckESDstatus {
41 kMC = BIT(0) // use MC info
42 ,kCollision = BIT(1) //
43 };
44 enum ETRDcheckESDhistos {
45 kNCl = 1 // number of clusters per track
46 ,kTRDstat // TRD tracks status
47 ,kTRDmom // TRD track momentum
48 ,kPtRes // Pt resolution @ vertex for TRD
49 ,kTPCVertex // event vertex from TPC
50 ,kEventVertex // event vertex
51 ,kNTracksAll // ntracks - all
52 ,kNTracksAcc // ntracks - inside acc. and DCA cut
53 ,kNTracksTPC // additional cut on number of TPC clusters
54 ,kDCAxy // transverse DCA
55 ,kDCAz // z - DCA
56 ,kPt1 // Pt distribution, eta and ptmin cuts
57 ,kPt2 // Pt distribution, cuts from kPt1 and DCA cuts
58 ,kPt3pos // Pt distribution, cuts from kPt2 and cut on TPC clusters for positives (>100)
59 ,kPt3neg // Pt distribution, cuts from kPt2 and cut on TPC clusters for negatives (>100)
60 ,kPt4pos // Pt distribution, cuts from kPt3pos and at least one TRD tracklet
61 ,kPt4neg // Pt distribution, cuts from kPt3neg and at least one TRD tracklet
62 ,kTheta // distribution of theta for tracks passing the cuts from kPt4pos and kPt4neg
63 ,kPhi // distribution of phi for tracks passing the cuts from kPt4pos and kPt4neg
64 ,kNTPCCl // number of TPC clusters, cuts from kPt2
65 ,kNTPCCl2 // number of TPC clusters, cuts from kPt2 + pt>1 GeV/c
66 ,kTPCDedx // TPC dE/dx, cuts from kPt3pos or kPt3neg
67 ,kEtaPhi // (eta,phi) distrib. for tracks after the cuts from kPt3pos or kPt3neg
68 ,kEtaNclsTPC // (TPC_Ncls,eta) distrib. for tracks after the cuts from kPt3pos or kPt3neg
69 ,kPhiNclsTPC // (TPC_Ncls,phi) distrib. for tracks after the cuts from kPt3pos or kPt3neg
70 ,kSPDMult // SPD multiplicity
71 ,kNTrackletsTRD // (TRD tracklets per track, P) distribution, after cuts from kPt4pos or kPt4neg
72 ,kNClsTrackTRD=kNTrackletsTRD+6 // (TRD clusters per track, P) distribution, after cuts from kPt4pos or kPt4neg
73 ,kPHSlice=kNClsTrackTRD+6 // (slicePH,sliceNo) distribution, after cuts from kPt4pos or kPt4neg
74 ,kPHSliceTPCpions=kPHSlice+6 // (slicePH,sliceNo) distribution for TPC pions, after cuts from kPt4pos or kPt4neg
75 ,kTPCdedxPions=kPHSliceTPCpions+6 // (TPC dedx,P) for selected TPC pions
76 ,kPHSliceTPCelectrons=kTPCdedxPions+6 // (slicePH,sliceNo) distribution for TPC electrons, after cuts from kPt4pos or kPt4neg
77 ,kTPCdedxElectrons=kPHSliceTPCelectrons+6 // (TPC dedx,P) for selected TPC electrons
78 ,kQtotP=kTPCdedxElectrons+6 // (total Q from slices, momentum) distribution, after cuts from kPt4pos or kPt4neg
79 ,kPropagXYvsP=kQtotP+6 // (X,Y,momentum) distribution after AliESDtrack::PropagateTo(r=300.)
80 ,kPropagRZvsP // (R,Z,momentum) distribution after AliESDtrack::PropagateTo(r=300.)
81 ,kTPCRefTracksPos // (eta,detector phi,Pt) distribution of reference TPC positive tracks (fulfill cuts from kPt3pos)
82 ,kTPCRefTracksNeg=kTPCRefTracksPos+6 // (eta,detector phi,Pt) distribution of reference TPC negative tracks (fulfill cuts from kPt3neg)
83 ,kTRDRefTracksPos=kTPCRefTracksNeg+6 // (eta,detector phi,Pt) distribution of reference TRD positive tracks (fulfill cuts from kPt4pos)
84 ,kTRDRefTracksNeg=kTRDRefTracksPos+6 // (eta,detector phi,Pt) distribution of reference TRD negative tracks (fulfill cuts from kPt4neg)
85 ,kTRDRefTracksPos4=kTRDRefTracksNeg+6 // (eta,detector phi,Pt) distribution of reference TRD positive tracks with 4 tracklets (fulfill cuts from kPt4pos)
86 ,kTRDRefTracksNeg4=kTRDRefTracksPos4+6 // (eta,detector phi,Pt) distribution of reference TRD negative tracks with 4 tracklets (fulfill cuts from kPt4neg)
87 ,kTRDRefTracksPos5=kTRDRefTracksNeg4+6
88 ,kTRDRefTracksNeg5=kTRDRefTracksPos5+6
89 ,kTRDRefTracksPos6=kTRDRefTracksNeg5+6
90 ,kTRDRefTracksNeg6=kTRDRefTracksPos6+6
91 ,kTRDEtaPhiAvNtrkl=kTRDRefTracksNeg6+6 // (eta, detector phi) profile of average number of tracklets
92 ,kTRDEtaDeltaPhiAvNtrkl=kTRDEtaPhiAvNtrkl+6 // (eta, delta-phi) profile of average number of tracklets
93 // delta-phi is the angle made by the track with the normal to the chamber entrance plane
94 ,kTRDEtaPhiAvQtot=kTRDEtaDeltaPhiAvNtrkl+6 // (eta, detector phi) profile of total tracklet charge from slices
95 ,kTriggerDefs=kTRDEtaPhiAvQtot+36
96 ,kMatchingPhiEtaCF
97 ,kMatchingPtCF
98 ,kBunchCrossingsCF
99 ,kCentralityCF
100 ,kQtotCF
101 ,kPulseHeightCF
102 ,kExpertCF
103 ,kNhistos // number of histograms
104 ,kNrefs = 4 // number of reference plots
105 };
106 enum ETrdCfVariables {
107 kEventVtxZ=0,
108 kEventMult,
109 kEventTrigger,
110 kEventBC,
111 kTrackTOFBC,
112 kTrackDCAxy,
113 kTrackDCAz,
114 kTrackCharge,
115 kTrackPhi,
116 kTrackEta,
117 kTrackPt,
118 kTrackP,
119 kTrackTrdTracklets,
120 kTrackTrdClusters,
121 kTrackPHslice,
122 kTrackQtot=kTrackPHslice+8,
123 kNTrdCfVariables=kTrackQtot+6,
124 kNMaxAssignedTriggers = 100
125 };
126 enum ETRDcheckESDbits {
127 kTPCout = 1 // track left TPC
128 ,kTRDin // track reach TRD fiducial volume
129 ,kTRDout // track reconstructed in TRD
130 ,kTRDpid // PID calculated in TRD
131 ,kTRDref // track refitted in TRD
132 };
133
134 AliTRDcheckESD();
135 AliTRDcheckESD(char* name);
136 virtual ~AliTRDcheckESD();
137
138 void UserCreateOutputObjects();
139 Bool_t GetRefFigure(Int_t ifig);
140 Int_t GetNRefFigures() const { return fNRefFigures; }
141 void UserExec(Option_t *);
142
143 void SetRefTrackFilter(AliAnalysisCuts* const filter) {fReferenceTrackFilter = filter;}
144
145 Bool_t HasMC() const { return TESTBIT(fStatus, kMC);}
146 Bool_t IsCollision() const {return TESTBIT(fStatus, kCollision);}
147 void SetCollision(Bool_t set=kTRUE) {set ? SETBIT(fStatus, kCollision) : CLRBIT(fStatus, kCollision);}
148 TObjArray* Histos();
149 AliCFContainer* GetMatchingPhiEtaCF() const {return fMatchingPhiEtaCF;}
150 AliCFContainer* GetMatchingPtCF() const {return fMatchingPtCF;}
151 AliCFContainer* GetBunchCrossingsCF() const {return fBunchCrossingsCF;}
152 AliCFContainer* GetCentralityCF() const {return fCentralityCF;}
153 AliCFContainer* GetQtotCF() const {return fQtotCF;}
154 AliCFContainer* GetPulseHeightCF() const {return fPulseHeightCF;}
155 AliCFContainer* GetExpertCF() const {return fExpertCF;}
156 Int_t GetTriggerCounter(const Char_t* triggerName) const;
157 void PrintTriggers() const;
158 Bool_t Load(const Char_t *fn="AnalysisResults.root", const Char_t *dir="TRD_Performance", const Char_t *name=NULL);
159 void SetMC(Bool_t mc = kTRUE) { mc ? SETBIT(fStatus, kMC) : CLRBIT(fStatus, kMC);}
160 Bool_t PutTrendValue(const Char_t *name, Double_t val);
161 void Terminate(Option_t *);
162 void MakeSummary(Double_t* trendValues=0x0);
163 void MakeSummaryFromCF(Double_t* trendValues=0x0, const Char_t* triggerName="", Bool_t useIsolatedBC=kFALSE, Bool_t cutTOFbc=kFALSE);
164 //virtual Long64_t Merge(TCollection* list);
165 Int_t GetNAssignedTriggers();
166 void AddUserTrigger(const Char_t* name) {fUserEnabledTriggers += name; fUserEnabledTriggers += ";";}
167
168 // configure the expert CF container
169 void AddExpertCFVar(AliTRDcheckESD::ETrdCfVariables var, Int_t nbins, Double_t lowLim, Double_t highLim);
170 void AddExpertCFVar(AliTRDcheckESD::ETrdCfVariables var, const Char_t* bins);
171 void EnableExpertCFStep(Int_t step) {if(step>=0 && step<3) fExpertCFEnabledSteps[step] = kTRUE;}
172
173private:
174 static const Float_t fgkxTPC; // end radial position of TPC
175 static const Float_t fgkxTOF; // start radial position of TOF
176 static const UChar_t fgkNgraph[kNrefs]; // number of graphs/ref plot
177
178 Bool_t PlotTrackingSummary(Int_t centralityClass=1, Double_t* trendValues=0x0); // 1 <= centralityClass <= 5; 0-all centrality classes together
179 Bool_t PlotPidSummary(Int_t centralityClass=1, Double_t* trendValues=0x0); // 1 <= centralityClass <= 5; 0-all centrality classes together
180 Bool_t PlotCentSummary(Double_t* trendValues=0x0); // centrality dependent plots
181
182 void PlotTrackingSummaryFromCF(Double_t* trendValues=0x0,
183 const Char_t* triggerName="",
184 Bool_t useIsolatedBC=kFALSE, Bool_t cutTOFbc=kFALSE); // 1 <= centralityClass <= 5; 0-all centrality classes together
185 void PlotPidSummaryFromCF(Double_t* trendValues=0x0,
186 const Char_t* triggerName="",
187 Bool_t useIsolatedBC=kFALSE, Bool_t cutTOFbc=kFALSE); // 1 <= centralityClass <= 5; 0-all centrality classes together
188 void PlotCentSummaryFromCF(Double_t* trendValues=0x0, const Char_t* triggerName="",
189 Bool_t useIsolatedBC=kFALSE, Bool_t cutTOFbc=kFALSE); // centrality dependent plots
190
191 AliTRDcheckESD(const AliTRDcheckESD&);
192 AliTRDcheckESD& operator=(const AliTRDcheckESD&);
193 Int_t Pdg2Idx(Int_t pdg) const;
194 void Process(TH1 **h, TGraphErrors *g);
195 void Process2D(TH2 * const h, TGraphErrors **g);
196 void PrintStatus(ULong_t s);
197 TH2F* Proj3D(TH3* hist, TH2* accMap, Int_t binLow, Int_t binHigh, Float_t &entries);
198 TH1D* Proj2D(TH2* hist, TH1* fitErr=0x0);
199 TH1F* EfficiencyTRD(TH3* tpc3D, TH3* trd3D, Bool_t useAcceptance=kTRUE);
200 TH1F* EfficiencyFromPhiPt(AliCFContainer* cf, Int_t minNtrkl, Int_t maxNtrkl, Int_t stepNom, Int_t stepDenom, const Char_t* varStr="pt", const Char_t* type="TPCTRD");
201 void DrawTRDGrid();
202 void SetStyle(TH1* hist, Int_t lineStyle, Int_t lineColor, Int_t lineWidth,
203 Int_t markerStyle, Int_t markerColor, Int_t markerSize);
204 void SetStyle(TAxis* axis, const Char_t* title, Float_t titleSize, Float_t titleOffset, Bool_t centerTitle,
205 Float_t labelSize);
206 void CheckActiveSM(TH1D* phiProj, Bool_t activeSM[18]);
207 void FindIsolatedBCs(TH1D* bcHist, Bool_t isIsolated[3500]);
208 void InitializeCFContainers();
209 AliCFContainer* CreateCFContainer(const Char_t* name, const Char_t *title);
210 Int_t GetTriggerIndex(const Char_t* name, Bool_t createNew=kTRUE);
211
212 Int_t fStatus; // bit mask for controlling the task
213 Int_t fNRefFigures; // number of current ref plots
214 AliESDEvent *fESD; //! ESD event
215 AliMCEvent *fMC; //! MC event
216 AliESDpid *fESDpid; // ESD pid object
217 TObjArray *fHistos; //! QA histos
218 TObjArray *fResults; // QA graphs
219 static FILE *fgFile; //! trend file streamer
220
221 AliCFContainer* fExpertCF; // CF container configured for expert checks
222 Int_t fExpertCFVars[kNTrdCfVariables];
223 Bool_t fExpertCFVarsEnabled[kNTrdCfVariables];
224 Int_t fExpertCFVarNBins[kNTrdCfVariables];
225 Double_t fExpertCFVarRanges[kNTrdCfVariables][2];
226 TString fExpertCFVarBins[kNTrdCfVariables];
227 Bool_t fExpertCFEnabledSteps[3]; // enabled steps 0-TPC; 1-TRD; 2-TOF
228
229 AliCFContainer* fMatchingPhiEtaCF; // Small CF containers tuned for running over central QA
230 Int_t fMatchingPhiEtaCFVars[kNTrdCfVariables];
231 AliCFContainer* fMatchingPtCF; // Small CF containers tuned for running over central QA
232 Int_t fMatchingPtCFVars[kNTrdCfVariables];
233 AliCFContainer* fBunchCrossingsCF; //
234 Int_t fBunchCrossingsCFVars[kNTrdCfVariables];
235 AliCFContainer* fCentralityCF; // Small CF containers tuned for running over central QA
236 Int_t fCentralityCFVars[kNTrdCfVariables];
237 AliCFContainer* fQtotCF; //
238 Int_t fQtotCFVars[kNTrdCfVariables];
239 AliCFContainer* fPulseHeightCF; //
240 Int_t fPulseHeightCFVars[kNTrdCfVariables];
241
242 AliAnalysisCuts* fReferenceTrackFilter; // reference track filter
243 Bool_t fPhysSelTriggersEnabled; // flag wheter physics selection triggers were enabled
244 TString fUserEnabledTriggers; // list of user enabled triggers
245 Int_t fNAssignedTriggers; // number of assigned triggers
246
247 // Vertex selection
248 static const Float_t fgkEvVertexZ;// cm
249 static const Int_t fgkEvVertexN;// cm
250 // Track selection
251 static const Float_t fgkTrkDCAxy; // cm
252 static const Float_t fgkTrkDCAz; // cm
253 static const Int_t fgkNclTPC; // N clusters TPC
254 static const Float_t fgkPt; // min. pt
255 static const Float_t fgkEta; // eta range
256
257 static const Float_t fgkQs; // scale for the total charge
258
259 ClassDef(AliTRDcheckESD, 9) // user oriented TRD analysis based on ESD-MC data
260};
261#endif