]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/UserTasks/AliAnalysisTaskPID.h
Fix for coverity (Annalisa De Caro).
[u/mrichter/AliRoot.git] / PWGJE / UserTasks / AliAnalysisTaskPID.h
CommitLineData
77324970
CKB
1#ifndef ALI_ANALYSIS_TASK_PID_H
2#define ALI_ANALYSIS_TASK_PID_H
3
4/*
5This task collects PID output from different detectors.
6Only tracks fulfilling some standard quality cuts are taken into account.
7At the moment, only data from TPC and TOF is collected. But in future,
8data from e.g. HMPID is also foreseen.
9
10Class written by Benjamin Hess.
11Contact: bhess@cern.ch
12*/
13
14class TF1;
15class TRandom3;
16class AliAnalysisFilter;
17class AliCFContainer;
18class AliESDEvent;
19class AliMCEvent;
20class AliMCParticle;
21class AliPID;
22class AliPIDCombined;
23class AliPIDResponse;
24class AliTOFPIDResponse;
25class AliVEvent;
26class AliVTrack;
27
2d593f8c 28#include "TAxis.h"
77324970
CKB
29#include "TH1D.h"
30#include "TH2D.h"
31#include "TH3D.h"
32#include "THnSparse.h"
33#include "TProfile.h"
34#include "TString.h"
35
36#include "AliCentrality.h"
37#include "AliCFContainer.h"
38
39#include "AliPID.h"
40#include "AliAnalysisTaskPIDV0base.h"
41
42class AliAnalysisTaskPID : public AliAnalysisTaskPIDV0base {
43 public:
44 AliAnalysisTaskPID();
45 AliAnalysisTaskPID(const char *name);
46 virtual ~AliAnalysisTaskPID();
47
48 virtual void UserCreateOutputObjects();
49 virtual void UserExec(Option_t *option);
50 virtual void Terminate(const Option_t*);
51
52 enum ErrorCode { kNoErrors = 1, kWarning = 0, kError = -1};
53
54 enum dataAxes { kDataMCID = 0, kDataSelectSpecies = 1, kDataPt = 2, kDataDeltaPrimeSpecies = 3, kDataCentrality = 4,
55 kDataJetPt = 5, kDataZ = 6, kDataXi = 7, kDataCharge = 8, kDataTOFpidInfo = 9, kDataNumAxes = 10 };
56
57 enum genAxes { kGenMCID = 0, kGenSelectSpecies = 1, kGenPt = 2, kGenDeltaPrimeSpecies = 3, kGenCentrality = 4,
58 kGenJetPt = 5, kGenZ = 6, kGenXi = 7, kGenCharge = 8, kGenTOFpidInfo = 9, kGenNumAxes = 10 };
59
60 enum genYieldAxes { kGenYieldMCID = 0, kGenYieldPt = 1, kGenYieldCentrality = 2, kGenYieldJetPt = 3, kGenYieldZ = 4, kGenYieldXi = 5,
61 kGenYieldCharge = 6, kGenYieldNumAxes = 7 };
62
63 enum ptResolutionAxes { kPtResJetPt = 0, kPtResGenPt = 1, kPtResRecPt = 2, kPtResCharge = 3, kPtResCentrality = 4, kPtResNumAxes = 5 };
64
b487e69b 65 enum qaSharedClsAxes { kQASharedClsJetPt = 0, kQASharedClsPt = 1, kQASharedClsNumSharedCls = 2, kQASharedClsPadRow = 3,
cdcd2d51 66 kQASharedClsNumAxes = 4 };
b487e69b 67
2d593f8c 68 enum dEdxCheckAxes { kDeDxCheckPID = 0, kDeDxCheckP = 1, kDeDxCheckJetPt = 2, kDeDxCheckEtaAbs = 3 , kDeDxCheckDeDx = 4,
69 kDeDxCheckNumAxes = 5 };
70
77324970
CKB
71 enum efficiencyAxes { kEffMCID = 0, kEffTrackPt = 1, kEffTrackEta = 2, kEffTrackCharge = 3, kEffCentrality = 4, kEffJetPt = 5,
72 kEffZ = 6, kEffXi = 7, kEffNumAxes = 8 };
73
74 enum EffSteps { kStepGenWithGenCuts = 0, kStepRecWithGenCuts = 1, kStepRecWithGenCutsMeasuredObs = 2,
75 kStepRecWithRecCutsMeasuredObs = 3, kStepRecWithRecCutsMeasuredObsPrimaries = 4,
76 kStepRecWithRecCutsMeasuredObsStrangenessScaled = 5, kStepRecWithRecCutsPrimaries = 6, kNumSteps = 7};
77
78 enum TOFpidInfo { kNoTOFinfo = -2, kNoTOFpid = -1, kTOFpion = 0, kTOFkaon = 1, kTOFproton = 2, kNumTOFspecies = 3,
79 kNumTOFpidInfoBins = 5 };
80
1a8d4484 81 enum EventCounterType { kTriggerSel = 0, kTriggerSelAndVtxCut = 1, kTriggerSelAndVtxCutAndZvtxCutNoPileUpRejection = 2,
82 kTriggerSelAndVtxCutAndZvtxCut = 3 };
4b4d71d4 83
77324970
CKB
84 static Int_t PDGtoMCID(Int_t pdg);
85
86 static void GetJetTrackObservables(Double_t trackPt, Double_t jetPt, Double_t& z, Double_t& xi);
87
88 static Double_t GetMCStrangenessFactorCMS(Int_t motherPDG, Double_t motherGenPt);
89 static Double_t GetMCStrangenessFactorCMS(AliMCEvent* mcEvent, AliMCParticle* daughter);
90
91 static Bool_t IsSecondaryWithStrangeMotherMC(AliMCEvent* mcEvent, Int_t partLabel);
92
1a8d4484 93 virtual void ConfigureTaskForCurrentEvent(AliVEvent* event);
94
77324970
CKB
95 Int_t GetIndexOfChargeAxisData() const
96 { return fStoreAdditionalJetInformation ? kDataCharge : kDataCharge - fgkNumJetAxes; };
97 Int_t GetIndexOfChargeAxisGen() const
98 { return fStoreAdditionalJetInformation ? kGenCharge : kGenCharge - fgkNumJetAxes; };
99 Int_t GetIndexOfChargeAxisGenYield() const
100 { return fStoreAdditionalJetInformation ? kGenYieldCharge : kGenYieldCharge - fgkNumJetAxes; };
101
102 Int_t GetIndexOfTOFpidInfoAxisData() const
103 { return fStoreAdditionalJetInformation ? kDataTOFpidInfo : kDataTOFpidInfo - fgkNumJetAxes; };
104 Int_t GetIndexOfTOFpidInfoAxisGen() const
105 { return fStoreAdditionalJetInformation ? kGenTOFpidInfo : kGenTOFpidInfo - fgkNumJetAxes; };
106
107 Bool_t FillXsec(Double_t xsection)
108 { if (!fh1Xsec) return kFALSE; fh1Xsec->Fill("<#sigma>", xsection); return kTRUE; };
109 Bool_t FillPythiaTrials(Double_t avgTrials)
110 { if (!fh1Trials) return kFALSE; fh1Trials->Fill("#sum{ntrials}", avgTrials); return kTRUE; };
111
112 Bool_t FillEfficiencyContainer(const Double_t* values, EffSteps step, Double_t weight = 1.0);
113
114 Bool_t FillGeneratedYield(const Double_t* values, Double_t weight = 1.0);
115 Bool_t FillPtResolution(Int_t mcID, const Double_t* values);
116 Bool_t FillGenJets(Double_t centralityPercentile, Double_t jetPt, Double_t norm = -1.);
117 Bool_t FillRecJets(Double_t centralityPercentile, Double_t jetPt, Double_t norm = -1.);
118
4b4d71d4 119 Bool_t IncrementEventCounter(Double_t centralityPercentile, EventCounterType type);
77324970
CKB
120
121 void PostOutputData();
122
123 void PrintSettings(Bool_t printSystematicsSettings = kFALSE) const;
124
125 void PrintSystematicsSettings() const;
126
127 Bool_t ProcessTrack(const AliVTrack* track, Int_t particlePDGcode, Double_t centralityPercentile, Double_t jetPt) ;
128
129 ErrorCode GenerateDetectorResponse(ErrorCode errCode, Double_t mean, Double_t sigma, Double_t* responses,
130 Int_t nResponses,
131 Bool_t usePureGaus = kFALSE);
132 ErrorCode SetParamsForConvolutedGaus(Double_t gausMean, Double_t gausSigma);
133
134 const TString GetCentralityEstimator() const { return fCentralityEstimator; };
135 void SetCentralityEstimator(TString estimator) { fCentralityEstimator = estimator; };
136
137 Double_t GetCentralityPercentile(AliVEvent* evt) const;
138
139 inline Double_t GetConvolutedGaussTransitionPar(Int_t index) const;
140
141 Bool_t SetConvolutedGaussLambdaParameter(Double_t lambda);
142
143 Bool_t GetInputFromOtherTask() const { return fInputFromOtherTask; };
144 void SetInputFromOtherTask(Bool_t flag) { fInputFromOtherTask = flag; };
145
146 Bool_t GetDoPID() const { return fDoPID; };
147 void SetDoPID(Bool_t flag) { fDoPID = flag; };
148
149 Bool_t GetDoEfficiency() const { return fDoEfficiency; };
150 void SetDoEfficiency(Bool_t flag) { fDoEfficiency = flag; };
151
152 Bool_t GetDoPtResolution() const { return fDoPtResolution; };
153 void SetDoPtResolution(Bool_t flag) { fDoPtResolution = flag; };
154
2d593f8c 155 Bool_t GetDoDeDxCheck() const { return fDoDeDxCheck; };
156 void SetDoDeDxCheck(Bool_t flag) { fDoDeDxCheck = flag; };
157
77324970
CKB
158 Bool_t GetStoreCentralityPercentile() const { return fStoreCentralityPercentile; };
159 void SetStoreCentralityPercentile(Bool_t flag) { fStoreCentralityPercentile = flag; };
160
161 Bool_t GetStoreAdditionalJetInformation() const { return fStoreAdditionalJetInformation; };
162 void SetStoreAdditionalJetInformation(Bool_t flag) { fStoreAdditionalJetInformation = flag; };
163
164 Bool_t GetUseMCidForGeneration() const { return fUseMCidForGeneration; };
165 void SetUseMCidForGeneration(Bool_t flag) { fUseMCidForGeneration = flag; };
166
167 Bool_t GetUseConvolutedGaus() const { return fUseConvolutedGaus; };
168 void SetUseConvolutedGaus(Bool_t flag) { fUseConvolutedGaus = flag; };
169
170 Double_t GetAccuracyNonGaussianTail() const { return fAccuracyNonGaussianTail; };
171 void SetAccuracyNonGaussianTail(Double_t value) { fAccuracyNonGaussianTail = value; };
172
173 Bool_t GetTakeIntoAccountMuons() const { return fTakeIntoAccountMuons; };
174 void SetTakeIntoAccountMuons(Bool_t flag) { fTakeIntoAccountMuons = flag; };
175
176 Int_t GetTOFmode() const { return fTOFmode; };
177 void SetTOFmode(Int_t tofMode) { fTOFmode = tofMode; };
178
179 Bool_t GetUseTPCDefaultPriors() const { return fTPCDefaultPriors; };
180 void SetUseTPCDefaultPriors(Bool_t flag) { fTPCDefaultPriors = flag; };
181
182 Bool_t GetUsePriors() const { return fUsePriors; };
183 void SetUsePriors(Bool_t flag) { fUsePriors = flag; };
184
185 Bool_t GetUseITS() const { return fUseITS; };
186 void SetUseITS(Bool_t flag) { fUseITS = flag; };
187
188 Bool_t GetUseTOF() const { return fUseTOF; };
189 void SetUseTOF(Bool_t flag) { fUseTOF = flag; };
190
191 Double_t GetEtaAbsCutLow() const { return fEtaAbsCutLow; };
192 Double_t GetEtaAbsCutUp() const { return fEtaAbsCutUp; };
193 Bool_t SetEtaAbsCutRange(Double_t lowerLimit, Double_t upperLimit);
194
195 Bool_t IsInAcceptedEtaRange(Double_t etaAbs) const { return (etaAbs >= fEtaAbsCutLow && etaAbs <= fEtaAbsCutUp); };
196
1a8d4484 197 AliAnalysisTaskPIDV0base::PileUpRejectionType GetPileUpRejectionType() const { return fPileUpRejectionType; };
198 void SetPileUpRejectionType(AliAnalysisTaskPIDV0base::PileUpRejectionType newType) { fPileUpRejectionType = newType; };
199
21b0adb1 200 Double_t GetSystematicScalingSplinesThreshold() const { return fSystematicScalingSplinesThreshold; };
201 void SetSystematicScalingSplinesThreshold(Double_t threshold) { fSystematicScalingSplinesThreshold = threshold; };
202
203 Double_t GetSystematicScalingSplinesBelowThreshold() const { return fSystematicScalingSplinesBelowThreshold; };
204 void SetSystematicScalingSplinesBelowThreshold(Double_t scaleFactor)
205 { fSystematicScalingSplinesBelowThreshold = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
206
207 Double_t GetSystematicScalingSplinesAboveThreshold() const { return fSystematicScalingSplinesAboveThreshold; };
208 void SetSystematicScalingSplinesAboveThreshold(Double_t scaleFactor)
209 { fSystematicScalingSplinesAboveThreshold = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
77324970
CKB
210
211 Double_t GetSystematicScalingEtaCorrectionMomentumThr() const { return fSystematicScalingEtaCorrectionMomentumThr; };
212 void SetSystematicScalingEtaCorrectionMomentumThr(Double_t threshold) { fSystematicScalingEtaCorrectionMomentumThr = threshold; };
213
214 Double_t GetSystematicScalingEtaCorrectionLowMomenta() const { return fSystematicScalingEtaCorrectionLowMomenta; };
215 void SetSystematicScalingEtaCorrectionLowMomenta(Double_t scaleFactor)
216 { fSystematicScalingEtaCorrectionLowMomenta = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
217
218 Double_t GetSystematicScalingEtaCorrectionHighMomenta() const { return fSystematicScalingEtaCorrectionHighMomenta; };
219 void SetSystematicScalingEtaCorrectionHighMomenta(Double_t scaleFactor)
220 { fSystematicScalingEtaCorrectionHighMomenta = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
221
5709c40a 222 Double_t GetSystematicScalingEtaSigmaParaThreshold() const { return fSystematicScalingEtaSigmaParaThreshold; };
223 void SetSystematicScalingEtaSigmaParaThreshold(Double_t threshold) { fSystematicScalingEtaSigmaParaThreshold = threshold; };
224
225 Double_t GetSystematicScalingEtaSigmaParaBelowThreshold() const { return fSystematicScalingEtaSigmaParaBelowThreshold; };
226 void SetSystematicScalingEtaSigmaParaBelowThreshold(Double_t scaleFactor)
227 { fSystematicScalingEtaSigmaParaBelowThreshold = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
228
229 Double_t GetSystematicScalingEtaSigmaParaAboveThreshold() const { return fSystematicScalingEtaSigmaParaAboveThreshold; };
230 void SetSystematicScalingEtaSigmaParaAboveThreshold(Double_t scaleFactor)
231 { fSystematicScalingEtaSigmaParaAboveThreshold = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
77324970
CKB
232
233 Double_t GetSystematicScalingMultCorrection() const { return fSystematicScalingMultCorrection; };
234 void SetSystematicScalingMultCorrection(Double_t scaleFactor)
235 { fSystematicScalingMultCorrection = scaleFactor; CheckDoAnyStematicStudiesOnTheExpectedSignal(); };
236
8420c977 237 Double_t GetMaxEtaVariation(Double_t dEdxSplines);
238 Bool_t CalculateMaxEtaVariationMapFromPIDResponse();
239
77324970
CKB
240 void CleanupParticleFractionHistos();
241 Bool_t GetParticleFraction(Double_t trackPt, Double_t jetPt, Double_t multiplicity,
242 AliPID::EParticleType species, Double_t& fraction, Double_t& fractionErrorStat,
243 Double_t& fractionErrorSys) const;
244 Bool_t GetParticleFractions(Double_t trackPt, Double_t jetPt, Double_t centralityPercentile,
245 Double_t* prob, Int_t smearSpeciesByError, Int_t takeIntoAccountSpeciesSysError,
246 Bool_t uniformSystematicError = kFALSE) const;
247 const TH3D* GetParticleFractionHisto(Int_t species, Bool_t sysError = kFALSE) const;
248 Bool_t SetParticleFractionHisto(const TH3D* hist, Int_t species, Bool_t sysError = kFALSE);
249 Int_t GetParticleFractionHistoNbinsTrackPt() const;
250 Int_t GetParticleFractionHistoNbinsJetPt() const;
251 Int_t GetParticleFractionHistoNbinsCentrality() const;
252 Bool_t SetParticleFractionHistosFromFile(const TString filePathName, Bool_t sysError = kFALSE);
253 Int_t GetRandomParticleTypeAccordingToParticleFractions(Double_t trackPt, Double_t jetPt,
254 Double_t centralityPercentile,
255 Bool_t smearByError,
256 Bool_t takeIntoAccountSysError = kFALSE) const;
257
258 TOFpidInfo GetTOFType(const AliVTrack* track, Int_t tofMode) const;
259
260 protected:
261 void CheckDoAnyStematicStudiesOnTheExpectedSignal();
262 Double_t ConvolutedGaus(const Double_t* xx, const Double_t* par) const;
263 inline Double_t FastGaus(Double_t x, Double_t mean, Double_t sigma) const;
264 inline Double_t FastNormalisedGaus(Double_t x, Double_t mean, Double_t sigma) const;
265 Int_t FindBinWithinRange(TAxis* axis, Double_t value) const;
266 Int_t FindFirstBinAboveIn3dSubset(const TH3* hist, Double_t threshold, Int_t yValue, Int_t zValue) const;
267 Int_t FindLastBinAboveIn3dSubset(const TH3* hist, Double_t threshold, Int_t yValue, Int_t zValue) const;
268 virtual void SetUpGenHist(THnSparse* hist, Double_t* binsPt, Double_t* binsDeltaPrime, Double_t* binsCent, Double_t* binsJetPt) const;
269 virtual void SetUpGenYieldHist(THnSparse* hist, Double_t* binsPt, Double_t* binsCent, Double_t* binsJetPt) const;
270 virtual void SetUpHist(THnSparse* hist, Double_t* binsPt, Double_t* binsDeltaPrime, Double_t* binsCent, Double_t* binsJetPt) const;
271 virtual void SetUpPtResHist(THnSparse* hist, Double_t* binsPt, Double_t* binsJetPt, Double_t* binsCent) const;
b487e69b 272 virtual void SetUpSharedClsHist(THnSparse* hist, Double_t* binsPt, Double_t* binsJetPt) const;
2d593f8c 273 virtual void SetUpDeDxCheckHist(THnSparse* hist, const Double_t* binsPt, const Double_t* binsJetPt, const Double_t* binsEtaAbs) const;
77324970
CKB
274 virtual void SetUpPIDcombined();
275
276 static const Int_t fgkNumJetAxes; // Number of additional axes for jets
277 static const Double_t fgkEpsilon; // Double_t threshold above zero
278 static const Int_t fgkMaxNumGenEntries; // Maximum number of generated detector responses per track and delta(Prime) and associated species
279
77324970
CKB
280 static const Double_t fgkOneOverSqrt2; // = 1. / TMath::Sqrt2();
281
cdcd2d51 282 private:
8420c977 283 Int_t fRun; // Current run number
77324970
CKB
284 AliPIDCombined* fPIDcombined; //! PID combined object
285
286 Bool_t fInputFromOtherTask; // If set to kTRUE, no events are processed and the input must be fed in from another task. If set to kFALSE, normal event processing
287
288 Bool_t fDoPID; // Only do PID processing (and post the output), if flag is set to kTRUE
289 Bool_t fDoEfficiency; // Only do efficiency processing (and post the output), if flag is set to kTRUE
290 Bool_t fDoPtResolution; // Only do pT resolution processing (and post the output), if flag is set to kTRUE
2d593f8c 291 Bool_t fDoDeDxCheck; // Only check dEdx, if flag set to kTRUE
77324970
CKB
292
293 Bool_t fStoreCentralityPercentile; // If set to kTRUE, store centrality percentile for each event. In case of kFALSE (appropriate for pp), centrality percentile will be set to -1 for every event
294 Bool_t fStoreAdditionalJetInformation; // If set to kTRUE, additional jet information like jetPt, z, xi will be stored in the THnSparses
295
296 Bool_t fTakeIntoAccountMuons; // Also take into account muons for the generation of the expected response and the most probable PID
297 Bool_t fUseITS; // Use ITS for PID combined probabilities
298 Bool_t fUseTOF; // Use TOF for PID combined probabilities
299 Bool_t fUsePriors; // Use priors for PID combined probabilities
300 Bool_t fTPCDefaultPriors; // Use TPC default priors for PID combined probabilities, if priors are enabled
301
302 Bool_t fUseMCidForGeneration; // If MC, use MCid instead of PIDcombined to generate the signals
303
304 Bool_t fUseConvolutedGaus; // Use convoluted gaus to generate detector response instead of pure gaus
305 const Int_t fkConvolutedGausNPar; // Number of parameters for convoluted gaus
306 Double_t fAccuracyNonGaussianTail; // Accuracy of the non-gaussian tail (fraction of the maximum)
307 const Double_t fkDeltaPrimeLowLimit; // Lower deltaPrime limit
308 const Double_t fkDeltaPrimeUpLimit; // Upper deltaPrime limit
309 TF1* fConvolutedGausDeltaPrime; // Gaus convoluted with exponential tail to generate detector response (deltaPrime)
310
311 Int_t fTOFmode; // TOF mode used for TOF PID info (affects num sigma inclusion/exclusion)
312 Double_t fConvolutedGaussTransitionPars[3]; // Parameter for transition from gaussian parameters to asymmetric shape
313 static const Double_t fgkSigmaReferenceForTransitionPars; // Reference sigma chosen to calculate transition parameters
314
315 Double_t fEtaAbsCutLow; // Lower cut value on |eta|
316 Double_t fEtaAbsCutUp; // Upper cut value on |eta|
317
1a8d4484 318 AliAnalysisTaskPIDV0base::PileUpRejectionType fPileUpRejectionType; // Which pile-up rejection is used (if any)
319
77324970
CKB
320 // For systematic studies
321 Bool_t fDoAnySystematicStudiesOnTheExpectedSignal; // Internal flag indicating whether any systematic studies are going to be performed
21b0adb1 322 Double_t fSystematicScalingSplinesThreshold; // beta-gamma threshold for the systematic spline scale factor
323 Double_t fSystematicScalingSplinesBelowThreshold; // Systematic scale factor for the splines (1. = no systematics) below threshold
324 Double_t fSystematicScalingSplinesAboveThreshold; // Systematic scale factor for the splines (1. = no systematics) above threshold
77324970
CKB
325 Double_t fSystematicScalingEtaCorrectionMomentumThr; // Momentum threshold for the systematic scale factor for the eta correction (separates low-p from high-p
326 Double_t fSystematicScalingEtaCorrectionLowMomenta; // Systematic scale factor for the eta correction (1. = no systematics) at low momenta
327 Double_t fSystematicScalingEtaCorrectionHighMomenta; // Systematic scale factor for the eta correction (1. = no systematics) at high momenta
5709c40a 328
329 Double_t fSystematicScalingEtaSigmaParaThreshold; // dEdx threshold for the systematic scale factor for the parametrisation of the relative signal width
330 Double_t fSystematicScalingEtaSigmaParaBelowThreshold; // Systematic scale factor for the parametrisation of the relative signal width (1. = no systematics) below threshold
331 Double_t fSystematicScalingEtaSigmaParaAboveThreshold; // Systematic scale factor for the parametrisation of the relative signal width (1. = no systematics) above threshold
77324970
CKB
332 Double_t fSystematicScalingMultCorrection; // Systematic scale factor for the multiplicity correction (1. = no systematics)
333
334 TH3D* fFractionHists[AliPID::kSPECIES]; // 3D histos of particle fraction as function with trackPt, jetPt (-1 for inclusive spectra), centralityPercentile (-1 for pp)
335 TH3D* fFractionSysErrorHists[AliPID::kSPECIES]; // 3D histos of sys. error of particle fraction as function with trackPt, jetPt (-1 for inclusive spectra), centralityPercentile (-1 for pp)
336
337 TString fCentralityEstimator; // Estimator for the centrality (e.g. V0A, V0M)
338
339 THnSparseD* fhPIDdataAll; //! Data histo
340
341 // Generated response information
342 THnSparseD* fhGenEl; //! Generated response for el
343 THnSparseD* fhGenKa; //! Generated response for ka
344 THnSparseD* fhGenPi; //! Generated response for pi
345 THnSparseD* fhGenMu; //! Generated response for mu
346 THnSparseD* fhGenPr; //! Generated response for pr
347
348 // Generated responses for a single track
349 Double_t* fGenRespElDeltaPrimeEl; //! Generated responses for a single track
350 Double_t* fGenRespElDeltaPrimeKa; //! Generated responses for a single track
351 Double_t* fGenRespElDeltaPrimePi; //! Generated responses for a single track
352 Double_t* fGenRespElDeltaPrimePr; //! Generated responses for a single track
353 Double_t* fGenRespKaDeltaPrimeEl; //! Generated responses for a single track
354 Double_t* fGenRespKaDeltaPrimeKa; //! Generated responses for a single track
355 Double_t* fGenRespKaDeltaPrimePi; //! Generated responses for a single track
356 Double_t* fGenRespKaDeltaPrimePr; //! Generated responses for a single track
357 Double_t* fGenRespPiDeltaPrimeEl; //! Generated responses for a single track
358 Double_t* fGenRespPiDeltaPrimeKa; //! Generated responses for a single track
359 Double_t* fGenRespPiDeltaPrimePi; //! Generated responses for a single track
360 Double_t* fGenRespPiDeltaPrimePr; //! Generated responses for a single track
361 Double_t* fGenRespMuDeltaPrimeEl; //! Generated responses for a single track
362 Double_t* fGenRespMuDeltaPrimeKa; //! Generated responses for a single track
363 Double_t* fGenRespMuDeltaPrimePi; //! Generated responses for a single track
364 Double_t* fGenRespMuDeltaPrimePr; //! Generated responses for a single track
365 Double_t* fGenRespPrDeltaPrimeEl; //! Generated responses for a single track
366 Double_t* fGenRespPrDeltaPrimeKa; //! Generated responses for a single track
367 Double_t* fGenRespPrDeltaPrimePi; //! Generated responses for a single track
368 Double_t* fGenRespPrDeltaPrimePr; //! Generated responses for a single track
369 /*
370 Double_t* fGenRespElDeltaEl; //! Generated responses for a single track
371 Double_t* fGenRespElDeltaKa; //! Generated responses for a single track
372 Double_t* fGenRespElDeltaPi; //! Generated responses for a single track
373 Double_t* fGenRespElDeltaPr; //! Generated responses for a single track
374 Double_t* fGenRespKaDeltaEl; //! Generated responses for a single track
375 Double_t* fGenRespKaDeltaKa; //! Generated responses for a single track
376 Double_t* fGenRespKaDeltaPi; //! Generated responses for a single track
377 Double_t* fGenRespKaDeltaPr; //! Generated responses for a single track
378 Double_t* fGenRespPiDeltaEl; //! Generated responses for a single track
379 Double_t* fGenRespPiDeltaKa; //! Generated responses for a single track
380 Double_t* fGenRespPiDeltaPi; //! Generated responses for a single track
381 Double_t* fGenRespPiDeltaPr; //! Generated responses for a single track
382 Double_t* fGenRespMuDeltaEl; //! Generated responses for a single track
383 Double_t* fGenRespMuDeltaKa; //! Generated responses for a single track
384 Double_t* fGenRespMuDeltaPi; //! Generated responses for a single track
385 Double_t* fGenRespMuDeltaPr; //! Generated responses for a single track
386 Double_t* fGenRespPrDeltaEl; //! Generated responses for a single track
387 Double_t* fGenRespPrDeltaKa; //! Generated responses for a single track
388 Double_t* fGenRespPrDeltaPi; //! Generated responses for a single track
389 Double_t* fGenRespPrDeltaPr; //! Generated responses for a single track
390 */
391
2d593f8c 392 TAxis* fDeltaPrimeAxis; //! Axis holding the deltaPrime binning
8420c977 393 TH1D* fhMaxEtaVariation; //! Histo holding the maximum deviation of the eta correction factor from unity vs. 1/dEdx(splines)
394
1a8d4484 395 TH1D* fhEventsProcessed; //! Histo holding the number of processed events (i.e. passing trigger selection, vtx and zvtx cuts and (if enabled) pile-up rejection)
4b4d71d4 396 TH1D* fhEventsTriggerSel; //! Histo holding the number of events passing trigger selection
397 TH1D* fhEventsTriggerSelVtxCut; //! Histo holding the number of events passing trigger selection and vtx cut
1a8d4484 398 TH1D* fhEventsProcessedNoPileUpRejection; //! Histo holding the number of processed events before pile-up rejection
4b4d71d4 399
77324970
CKB
400 THnSparseD* fhMCgeneratedYieldsPrimaries; //! Histo holding the generated (no reco, no cuts) primary particle yields in considered eta range
401
402 TH2D* fh2FFJetPtRec; //! Number of reconstructed jets vs. jetPt and centrality
403 TH2D* fh2FFJetPtGen; //! Number of generated jets vs. jetPt and centrality
404
405 TProfile* fh1Xsec; //! pythia cross section and trials
406 TH1D* fh1Trials; //! sum of trials
407
408 AliCFContainer* fContainerEff; //! Container for efficiency determination
409
410 THnSparseD* fPtResolution[AliPID::kSPECIES]; //! Pt Resolution for the individual species
b487e69b 411 THnSparseD* fQASharedCls; //! QA for shared clusters
77324970 412
2d593f8c 413 THnSparseD* fDeDxCheck; //! dEdx check
414
77324970
CKB
415 TObjArray* fOutputContainer; //! output data container
416
2d593f8c 417 TObjArray* fQAContainer; //! output data container for QA
77324970
CKB
418
419 AliAnalysisTaskPID(const AliAnalysisTaskPID&); // not implemented
420 AliAnalysisTaskPID& operator=(const AliAnalysisTaskPID&); // not implemented
421
1a8d4484 422 ClassDef(AliAnalysisTaskPID, 21);
77324970
CKB
423};
424
425
426//_____________________________________________________________________________
427inline Bool_t AliAnalysisTaskPID::FillEfficiencyContainer(const Double_t* values, AliAnalysisTaskPID::EffSteps step,
428 Double_t weight)
429{
430 // Fill efficiency container at step "step" with the values
431
432 if (!fDoEfficiency)
433 return kFALSE;
434
435 if (!fContainerEff) {
436 AliError("Efficiency container not initialised -> cannot be filled!");
437 return kFALSE;
438 }
439
440 fContainerEff->Fill(values, step, weight);
441
442 return kTRUE;
443}
444
445
446//_____________________________________________________________________________
447inline Bool_t AliAnalysisTaskPID::FillGeneratedYield(const Double_t* values, Double_t weight)
448{
449 // Fill histos with generated primary yields with provided values
450
451 if (!fDoPID)
452 return kFALSE;
453
454 if (!fhMCgeneratedYieldsPrimaries) {
455 AliError("Histo for generated primary yield not initialised -> cannot be filled!");
456 return kFALSE;
457 }
458
459 fhMCgeneratedYieldsPrimaries->Fill(values, weight);
460
461 return kTRUE;
462}
463
464
465//_____________________________________________________________________________
466inline Bool_t AliAnalysisTaskPID::FillGenJets(Double_t centralityPercentile, Double_t jetPt, Double_t norm)
467{
468 if (!fDoPID && !fDoEfficiency)
469 return kFALSE;
470
471 if (!fh2FFJetPtGen)
472 return kFALSE;
473
474 if (norm > 0.)
475 fh2FFJetPtGen->Fill(centralityPercentile, jetPt, 1. / norm);
476 else
477 fh2FFJetPtGen->Fill(centralityPercentile, jetPt);
478
479 return kTRUE;
480}
481
482
483//_____________________________________________________________________________
484inline Bool_t AliAnalysisTaskPID::FillRecJets(Double_t centralityPercentile, Double_t jetPt, Double_t norm)
485{
486 if (!fDoPID && !fDoEfficiency)
487 return kFALSE;
488
489 if (!fh2FFJetPtRec)
490 return kFALSE;
491
492 if (norm > 0.)
493 fh2FFJetPtRec->Fill(centralityPercentile, jetPt, 1. / norm);
494 else
495 fh2FFJetPtRec->Fill(centralityPercentile, jetPt);
496
497 return kTRUE;
498}
499
500
501//_____________________________________________________________________________
502inline Bool_t AliAnalysisTaskPID::FillPtResolution(Int_t mcID, const Double_t* values)
503{
504 // Fill histos with pT resolution with provided values
505
506 if (!fDoPtResolution || mcID < 0 || mcID >= AliPID::kSPECIES)
507 return kFALSE;
508
509 if (!fPtResolution[mcID]) {
510 AliError(Form("Histo for pT resolution (species: %s) not initialised -> cannot be filled!", AliPID::ParticleName(mcID)));
511 return kFALSE;
512 }
513
514 fPtResolution[mcID]->Fill(values);
515
516 return kTRUE;
517}
518
519
520//_____________________________________________________________________________
4b4d71d4 521inline Bool_t AliAnalysisTaskPID::IncrementEventCounter(Double_t centralityPercentile, AliAnalysisTaskPID::EventCounterType type)
77324970 522{
4b4d71d4 523 // Increment the number of events for the given centrality percentile and the corresponding counter type
77324970 524
4b4d71d4 525 if (type == kTriggerSel) {
526 if (!fhEventsTriggerSel) {
527 AliError("Histogram for number of events (kTriggerSel) not initialised -> cannot be incremented!");
528 return kFALSE;
529 }
530
531 fhEventsTriggerSel->Fill(centralityPercentile);
532 }
533 else if (type == kTriggerSelAndVtxCut) {
534 if (!fhEventsTriggerSelVtxCut) {
535 AliError("Histogram for number of events (kTriggerSelAndVtxCut) not initialised -> cannot be incremented!");
536 return kFALSE;
537 }
538
539 fhEventsTriggerSelVtxCut->Fill(centralityPercentile);
77324970 540 }
4b4d71d4 541 else if (type == kTriggerSelAndVtxCutAndZvtxCut) {
542 if (!fhEventsProcessed) {
543 AliError("Histogram for number of events (kTriggerSelAndVtxCutAndZvtxCut) not initialised -> cannot be incremented!");
544 return kFALSE;
545 }
546
547 fhEventsProcessed->Fill(centralityPercentile);
548 }
1a8d4484 549 else if (type == kTriggerSelAndVtxCutAndZvtxCutNoPileUpRejection) {
550 if (!fhEventsProcessedNoPileUpRejection) {
551 AliError("Histogram for number of events (kTriggerSelAndVtxCutAndZvtxCutNoPileUpRejection) not initialised -> cannot be incremented!");
552 return kFALSE;
553 }
554
555 fhEventsProcessedNoPileUpRejection->Fill(centralityPercentile);
556 }
4b4d71d4 557
77324970 558
77324970
CKB
559 return kTRUE;
560};
561
562
563//_____________________________________________________________________________
564inline Bool_t AliAnalysisTaskPID::SetEtaAbsCutRange(Double_t lowerLimit, Double_t upperLimit)
565{
566 if (lowerLimit >= upperLimit) {
567 AliError(Form("Requested lower |eta| cut limit >= upper |eta| cut limit. Old eta cut range will be used (low %f, high %f).",
568 fEtaAbsCutLow, fEtaAbsCutUp));
569 return kFALSE;
570 }
571
572 fEtaAbsCutLow = lowerLimit;
573 fEtaAbsCutUp = upperLimit;
574
575 return kTRUE;
576};
577
578
579//_____________________________________________________________________________
580inline Double_t AliAnalysisTaskPID::GetConvolutedGaussTransitionPar(Int_t index) const
581{
582 if (index < 0 || index >= 3) {
583 printf("Invalid index %d!\n", index);
584 return -1;
585 }
586 return fConvolutedGaussTransitionPars[index];
587}
588
589
590//_____________________________________________________________________________
591inline Int_t AliAnalysisTaskPID::GetParticleFractionHistoNbinsTrackPt() const
592{
593 if (!fFractionHists[AliPID::kPion])
594 return -1;
595
596 return fFractionHists[AliPID::kPion]->GetNbinsX();
597}
598
599
600//_____________________________________________________________________________
601inline Int_t AliAnalysisTaskPID::GetParticleFractionHistoNbinsJetPt() const
602{
603 if (!fFractionHists[AliPID::kPion])
604 return -1;
605
606 return fFractionHists[AliPID::kPion]->GetNbinsY();
607}
608
609
610//_____________________________________________________________________________
611inline Int_t AliAnalysisTaskPID::GetParticleFractionHistoNbinsCentrality() const
612{
613 if (!fFractionHists[AliPID::kPion])
614 return -1;
615
616 return fFractionHists[AliPID::kPion]->GetNbinsZ();
617}
618
619
620//_____________________________________________________________________________
621inline Double_t AliAnalysisTaskPID::GetCentralityPercentile(AliVEvent* evt) const
622{
623 if (!evt)
624 return -1;
625
626 Double_t centralityPercentile = -1.;
627 if (fStoreCentralityPercentile)
628 centralityPercentile = evt->GetCentrality()->GetCentralityPercentile(fCentralityEstimator.Data());
629
630 return centralityPercentile;
631}
632
633
634//_____________________________________________________________________________
635inline void AliAnalysisTaskPID::PostOutputData()
636{
637 PostData(1, fOutputContainer);
638
639 if (fDoEfficiency)
640 PostData(2, fContainerEff);
641
2d593f8c 642 if (fDoPtResolution || fDoDeDxCheck)
643 PostData(3, fQAContainer);
77324970
CKB
644}
645
646#endif