]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliCFTaskVertexingHF.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliCFTaskVertexingHF.h
CommitLineData
379592af 1#ifndef ALICFTASKVERTEXINGHF_H
2#define ALICFTASKVERTEXINGHF_H
3/**************************************************************************
4 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Author: The ALICE Off-line Project. *
7 * Contributors are mentioned in the code where appropriate. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
27de2dfb 18/* $Id$ */
19
379592af 20//-----------------------------------------------------------------------
21// Class for HF corrections as a function of many variables and step
22// Author : C. Zampolli, CERN
23// D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
24// Base class for HF Unfolding - agrelli@uu.nl
25//-----------------------------------------------------------------------
26
27
28#include "AliAnalysisTaskSE.h"
29#include "AliCFVertexingHF2Prong.h"
f96b7f1a 30#include "AliCFVertexingHF3Prong.h"
5cd139bc 31#include "AliCFVertexingHFLctoV0bachelor.h"
379592af 32#include "AliCFVertexingHF.h"
afb24c40 33#include <TH1F.h>
f26726ed 34#include <TProfile.h>
379592af 35
36class TH1I;
37class TParticle ;
38class TFile ;
39class TClonesArray ;
40class AliCFManager;
41class AliAODRecoDecay;
42class AliAODRecoDecayHF2Prong;
43class AliAODMCParticle;
44class THnSparse;
5b37c6e5 45class TF1;
f2703bd2 46class AliRDHFCuts;
379592af 47class AliCFVertexingHF2Prong;
6e2e4f50 48class AliCFVertexingHF3Prong;
379592af 49
50class AliCFTaskVertexingHF: public AliAnalysisTaskSE {
51public:
52
53 enum {
54 kStepGeneratedLimAcc = 0,
55 kStepGenerated = 1,
56 kStepAcceptance = 2,
57 kStepVertex = 3,
58 kStepRefit = 4,
59 kStepReconstructed = 5,
60 kStepRecoAcceptance = 6,
61 kStepRecoITSClusters = 7,
62 kStepRecoPPR = 8,
63 kStepRecoPID = 9
64 };
fbec9fa9 65
ec5288c3 66 enum {
67 kSnail = 0, // slow configuration, all variables
68 kCheetah = 1 // fast configuration, only a subset of variables
69 };
fdd5a897 70
71 enum {
72 kAll = 0, // all decays (resonant + non-resonant)
73 kNonResonant = 1, // only non resonant
74 kL1520 = 2, // Lc --> L(1520) + p
75 kKstar = 3, // Lc --> K* + pi
76 kDelta = 4 // Lc --> Delta + K
77 };
d74f7bc1 78
79 enum { kNtrk10=0, kNtrk10to16=1, kVZERO=2 }; // multiplicity estimators
379592af 80
81 AliCFTaskVertexingHF();
5b37c6e5 82 AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts, TF1* func = 0x0);
379592af 83 AliCFTaskVertexingHF& operator= (const AliCFTaskVertexingHF& c);
84 AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c);
85 virtual ~AliCFTaskVertexingHF();
86
87 // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
88 void UserCreateOutputObjects();
89 void UserExec(Option_t *option);
f2703bd2 90 void Init();
91 void LocalInit() {Init();}
379592af 92 void Terminate(Option_t *);
93
94 // UNFOLDING
95 void SetCorrelationMatrix(THnSparse* h) {fCorrelation=h;}
96 void SetAcceptanceUnf(Bool_t AcceptanceUnf) {fAcceptanceUnf = AcceptanceUnf;}
97 Bool_t GetAcceptanceUnf() const {return fAcceptanceUnf;}
98
99
100 // CORRECTION FRAMEWORK RELATED FUNCTIONS
101 void SetCFManager(AliCFManager* io) {fCFManager = io;} // global correction manager
102 AliCFManager * GetCFManager() {return fCFManager;} // get corr manager
131192dd 103
f2703bd2 104 // Setters (and getters) for the config macro
105 void SetFillFromGenerated(Bool_t flag) {fFillFromGenerated = flag;}
106 Bool_t GetFillFromGenerated() const {return fFillFromGenerated;}
107 void SetDecayChannel (Int_t decayChannel) {fDecayChannel = decayChannel;}
3ee5eb83 108 Int_t GetDecayChannel () {return fDecayChannel;}
f2703bd2 109 void SetUseWeight(Bool_t useWeight){fUseWeight=useWeight;}
110 Bool_t GetUseWeight() const {return fUseWeight;}
111 Double_t GetWeight(Float_t pt);
112 Double_t dNdptFit(Float_t pt, Double_t* par);
9aed4aed 113 Double_t GetPtWeightFromHistogram(Float_t pt);
17bf1a34 114
115 void SetUseFlatPtWeight(Bool_t useWeight){fUseFlatPtWeight=useWeight; fUseWeight=useWeight;}
116 Bool_t GetUseFlatPtWeight() const {return fUseFlatPtWeight;}
117 void SetUseZWeight(Bool_t useWeight){fUseZWeight=useWeight;}
118 Bool_t GetUseZWeight() const {return fUseZWeight;}
119 Double_t GetZWeight(Float_t z, Int_t runnumber);
120 Double_t DodzFit(Float_t z, Double_t* par);
afb24c40 121
122 void SetUseNchWeight(Bool_t useWeight){fUseNchWeight=useWeight;}
123 Bool_t GetUseNchWeight() const {return fUseNchWeight;}
124 void SetMCNchHisto(TH1F* h){
125 if(fHistoMCNch) delete fHistoMCNch;
126 fHistoMCNch=new TH1F(*h);
127 }
128 void CreateMeasuredNchHisto();
5430095e 129 void SetMeasuredNchHisto(TH1F* h){
130 if(fHistoMeasNch) delete fHistoMeasNch;
131 fHistoMeasNch=new TH1F(*h);
132 }
afb24c40 133 Double_t GetNchWeight(Int_t nch);
d74f7bc1 134 void SetMultiplicityEstimator(Int_t value){ fMultiplicityEstimator=value; }
135 Int_t GetMultiplicityEstimator(){ return fMultiplicityEstimator; }
136 void SetIsPPData(Bool_t flag){ fIsPPData = flag; }
131192dd 137 void SetIsPPbData(Bool_t flag){ fIsPPbData = flag; }
d74f7bc1 138
746d82a8 139 void SetUseNchTrackletsWeight(Bool_t useWeight = kTRUE) { fUseNchWeight=useWeight; fUseTrackletsWeight=useWeight; fUseMultRatioAsWeight=useWeight; }
4fa6d5f8 140 Bool_t GetUseNchTrackletsWeight() const {return fUseTrackletsWeight;}
746d82a8 141 void SetUseRatioMultiplicityDistributionsAsWeight(Bool_t flag=kTRUE){ fUseMultRatioAsWeight=flag; }
142 Bool_t GetUseRatioMultiplicityDistributionsAsWeight() const {return fUseMultRatioAsWeight;}
afb24c40 143
f26726ed 144 void SetUseZvtxCorrectedNtrkEstimator(Bool_t flag) { fZvtxCorrectedNtrkEstimator=flag; }
145 Bool_t GetUseZvtxCorrectedNtrkEstimator() { return fZvtxCorrectedNtrkEstimator; }
146 void SetMultiplVsZProfileLHC10b(TProfile* hprof){
147 if(fMultEstimatorAvg[0]) delete fMultEstimatorAvg[0];
148 fMultEstimatorAvg[0]=new TProfile(*hprof);
149 }
150 void SetMultiplVsZProfileLHC10c(TProfile* hprof){
151 if(fMultEstimatorAvg[1]) delete fMultEstimatorAvg[1];
152 fMultEstimatorAvg[1]=new TProfile(*hprof);
153 }
154 void SetMultiplVsZProfileLHC10d(TProfile* hprof){
155 if(fMultEstimatorAvg[2]) delete fMultEstimatorAvg[2];
156 fMultEstimatorAvg[2]=new TProfile(*hprof);
157 }
158 void SetMultiplVsZProfileLHC10e(TProfile* hprof){
159 if(fMultEstimatorAvg[3]) delete fMultEstimatorAvg[3];
160 fMultEstimatorAvg[3]=new TProfile(*hprof);
161 }
131192dd 162
163 void SetMultiplVsZProfileLHC13b(TProfile* hprof){
164 if(fMultEstimatorAvg[0]) delete fMultEstimatorAvg[0];
165 fMultEstimatorAvg[0]=new TProfile(*hprof);
166 }
167 void SetMultiplVsZProfileLHC13c(TProfile* hprof){
168 if(fMultEstimatorAvg[1]) delete fMultEstimatorAvg[1];
169 fMultEstimatorAvg[1]=new TProfile(*hprof);
170 }
171
172
f26726ed 173 TProfile* GetEstimatorHistogram(const AliVEvent* event);
174 void SetReferenceMultiplcity(Double_t rmu){fRefMult=rmu;}
175
6e2e4f50 176 void SetDselection(UShort_t originDselection) {fOriginDselection=originDselection;}
3ee5eb83 177 UShort_t GetDselection (){return fOriginDselection;}
178 void SetSign(Char_t isSign) {fSign = isSign;}
179 Char_t GetSign() {return fSign;}
379592af 180
fbec9fa9 181 void SetCentralitySelection(Bool_t centSelec = kTRUE) {fCentralitySelection = centSelec;}
182 Bool_t GetCentralitySelection() {return fCentralitySelection;}
b7af2639 183
1f780958 184 void SetFakeSelection(Int_t fakeSel = 0) {fFakeSelection=fakeSel;}
185 Int_t GetFakeSelection(){return fFakeSelection;}
0ada222f 186
187 void SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
188 Bool_t GetRejectCandidateIfNotFromQuark(){return fRejectIfNoQuark;}
189
190 void SetUseMCVertex(Bool_t opt){fUseMCVertex=opt;}
191 Bool_t GetUseMCVertex(){return fUseMCVertex;}
fbec9fa9 192
6c62cb59 193
194 void SetKeepDsViaPhi(){fDsOption=1;}
195 void SetKeepDsViaK0star(){fDsOption=2;}
196 void SetKeepAllDs(){fDsOption=3;}
f96b7f1a 197 void SetCountAllDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountAllDsKKpi;}
198 void SetCountDsViaPhi(){fGenDsOption=AliCFVertexingHF3Prong::kCountPhipi;}
199 void SetCountDsViaK0star(){fGenDsOption=AliCFVertexingHF3Prong::kCountK0stK;}
200 void SetCountResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountResonant;}
201 void SetCountNonResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountNonResonant;}
6c62cb59 202
203 Bool_t ProcessDs(Int_t returnCodeDs) const;
ec5288c3 204
205 void SetConfiguration(Int_t configuration) {(configuration == kSnail) ? Printf("Slow configuration chosen, all variables will be used!") : Printf("Fast configuration chosen, all variablesOnly pt, y, phi, ct, fake, z_vtx, centrality and multiplicity will be used!"); fConfiguration = configuration;}
206 Int_t GetConfiguration() const {return fConfiguration;}
6c62cb59 207
5b37c6e5 208 void SetWeightFunction(TF1* func) {fFuncWeight = func;}
209 TF1* GetWeightFunction() const {return fFuncWeight;}
9aed4aed 210 void SetWeightHistogram(TH1F* histo) {
211 if(fHistoPtWeight) delete fHistoPtWeight;
212 fHistoPtWeight=new TH1F(*histo);
213 }
214 TH1F* GetWeightHistogram() const {return (TH1F*)fHistoPtWeight;}
215
942a78ce 216 void SetPtWeightsFromFONLL276overLHC12a17a();
217 void SetPtWeightsFromDataPbPb276overLHC12a17a();
1d9442de 218 void SetPtWeightsFromFONLL276overLHC12a17b();
219 void SetPtWeightsFromFONLL276andBAMPSoverLHC12a17b();
17faaf53 220 void SetPtWeightsFromFONLL276overLHC10f6a();
ecca15b8 221 void SetPtWeightsFromFONLL7overLHC10f6a();
17faaf53 222 void SetPtWeightsFromFONLL7overLHC12a12();
223 void SetPtWeightsFromFONLL7overLHC12a12bis();
224 void SetPtWeightsFromFONLL7overLHC13e2fix();
77baf975 225 void SetPtWeightsFromFONLL5overLHC10f6a();
17faaf53 226 void SetPtWeightsFromFONLL5overLHC13d3();
fdd5a897 227
228 void SetResonantDecay(UInt_t resonantDecay) {fResonantDecay = resonantDecay;}
229 UInt_t GetResonantDecay() const {return fResonantDecay;}
5cd139bc 230
231 void SetKeepLctoK0Sp() {fLctoV0bachelorOption=1;}
232 void SetKeepLctoLambdaBarpi() {fLctoV0bachelorOption=2;}
233 void SetKeepLctoLambdapi() {fLctoV0bachelorOption=4;}
234 void SetKeepLctoV0bachelor() {fLctoV0bachelorOption=7;}
235
5cd139bc 236 void SetCountLctoK0Sp(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountK0Sp;}
ff12b981 237 void SetCountLctoLambdapi(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountLambdapi;}
ca7d039b 238
239 void SetUseSelectionBit(Bool_t flag) { fUseSelectionBit=flag; }
240 Bool_t GetUseSelectionBit() const { return fUseSelectionBit; }
5cd139bc 241
242 Bool_t ProcessLctoV0Bachelor(Int_t returnCodeDs) const;
243
4539d15b 244 void SetUseAdditionalCuts(Bool_t flag) { fDecayChannel == 22 ? fUseAdditionalCuts = flag : fUseAdditionalCuts = kFALSE;}
245 Bool_t GetUseAdditionalCuts() const { return fUseAdditionalCuts; }
246 void SetUseCutsForTMVA(Bool_t useCutsForTMVA) { fDecayChannel == 22 ? fUseCutsForTMVA = useCutsForTMVA : fUseAdditionalCuts = kFALSE;}
247 Bool_t GetUseCutsForTMVA() const {return fUseCutsForTMVA;}
248
6bde58d3 249 void SetUseCascadeTaskForLctoV0bachelor(Bool_t useCascadeTaskForLctoV0bachelor) {fUseCascadeTaskForLctoV0bachelor = useCascadeTaskForLctoV0bachelor;}
250 Bool_t GetUseCascadeTaskForLctoV0bachelor() const {return fUseCascadeTaskForLctoV0bachelor;}
251
04c168b9 252 void SetCutOnMomConservation(Float_t cut) {fCutOnMomConservation = cut;}
253 Bool_t GetCutOnMomConservation() const {return fCutOnMomConservation;}
254
379592af 255protected:
379592af 256 AliCFManager *fCFManager; // pointer to the CF manager
257 TH1I *fHistEventsProcessed; //! simple histo for monitoring the number of events processed
258 THnSparse* fCorrelation; // response matrix for unfolding
f26726ed 259 TList *fListProfiles; //list of profile histos for z-vtx correction
379592af 260 Int_t fCountMC; // MC particle found
261 Int_t fCountAcc; // MC particle found that satisfy acceptance cuts
262 Int_t fCountVertex; // Reco particle found that satisfy vertex constrained
263 Int_t fCountRefit; // Reco particle found that satisfy kTPCrefit and kITSrefit
264 Int_t fCountReco; // Reco particle found that satisfy cuts
265 Int_t fCountRecoAcc; // Reco particle found that satisfy cuts in requested acceptance
266 Int_t fCountRecoITSClusters; // Reco particle found that satisfy cuts in n. of ITS clusters
267 Int_t fCountRecoPPR; // Reco particle found that satisfy cuts in PPR
268 Int_t fCountRecoPID; //Reco PID step
269 Int_t fEvents; // n. of events
f2703bd2 270 Int_t fDecayChannel; // decay channel to configure the task
379592af 271 Bool_t fFillFromGenerated; // flag to indicate whether data container should be filled with generated values also for reconstructed particles
272 UShort_t fOriginDselection; // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty
273 Bool_t fAcceptanceUnf; // flag for unfolding before or after cuts.
f2703bd2 274 AliRDHFCuts* fCuts; // cuts
17bf1a34 275 Bool_t fUseWeight; //flag to decide whether to use pt-weights != 1 when filling the container or not
f2703bd2 276 Double_t fWeight; //weight used to fill the container
17bf1a34 277 Bool_t fUseFlatPtWeight; // flag to decide to use a flat pt shape
278 Bool_t fUseZWeight; // flag to decide whether to use z-vtx weights != 1 when filling the container or not
afb24c40 279 Bool_t fUseNchWeight; // flag to decide whether to use Ncharged weights != 1 when filling the container or not
4fa6d5f8 280 Bool_t fUseTrackletsWeight; // flag to decide whether to use Ncharged weights != 1 when filling the container or not
746d82a8 281 Bool_t fUseMultRatioAsWeight; // flag to use directly the ratio of the distributions (fHistoMCNch) instead of computing it
4fa6d5f8 282 Int_t fNvar; // number of variables for the container
31da6b05 283 TString fPartName; // D meson name
284 TString fDauNames; // daughter in fin state
3ee5eb83 285 Char_t fSign; // flag to decide wheter to keep D0 only (0), D0bar only (1), or both D0 and D0bar (2)
b7af2639 286 Bool_t fCentralitySelection; //flag to switch off the centrality selection
fbec9fa9 287 Int_t fFakeSelection; //selection flag for fakes tracks
0ada222f 288 Bool_t fRejectIfNoQuark; // flag to remove events not geenrated with PYTHIA
289 Bool_t fUseMCVertex; // flag to use MC vertex (useful when runnign in pp)
c83eda41 290 Int_t fDsOption; // Ds decay option (selection level)
291 Int_t fGenDsOption; // Ds decay option (generation level)
ec5288c3 292 Int_t fConfiguration; // configuration (slow / fast) of the CF --> different variables will be allocated (all / reduced number)
5b37c6e5 293 TF1* fFuncWeight; // user-defined function to be used to calculate weights
9aed4aed 294 TH1F* fHistoPtWeight; // user-defined histogram to calculate the Pt weights
afb24c40 295 TH1F* fHistoMeasNch; // histogram with measured Nch distribution (pp 7 TeV)
296 TH1F* fHistoMCNch; // histogram with Nch distribution from MC production
fdd5a897 297 UInt_t fResonantDecay; // resonant deacy channel to be used if the CF should be run on resonant channels only
5cd139bc 298 Int_t fLctoV0bachelorOption; // Lc->V0+bachelor decay option (selection level)
299 Int_t fGenLctoV0bachelorOption; // Lc->V0+bachelor decay option (generation level)
ca7d039b 300 Bool_t fUseSelectionBit; // flag to use selection bit
04b11915 301 UInt_t fPDGcode; // PDG code
b7af2639 302
d74f7bc1 303 Int_t fMultiplicityEstimator; // Definition of the multiplicity estimator: kNtrk10=0, kNtrk10to16=1, kVZERO=2
f26726ed 304 TProfile* fMultEstimatorAvg[4]; // TProfile with mult vas. Z per period
305 Double_t fRefMult; // refrence multiplcity (period b)
306 Bool_t fZvtxCorrectedNtrkEstimator; // flag to use the z-vtx corrected (if not use uncorrected) multiplicity estimator
d74f7bc1 307 Bool_t fIsPPData; // flag for pp data (not checking centrality)
131192dd 308 Bool_t fIsPPbData; // flag for pPb data (used for multiplicity corrections)
4539d15b 309 Bool_t fUseAdditionalCuts; // flag to use additional cuts needed for Lc --> K0S + p, TMVA
310 Bool_t fUseCutsForTMVA; // flag to use additional cuts needed for Lc --> K0S + p, TMVA
311 // these are the pre-selection cuts for the TMVA
6bde58d3 312 Bool_t fUseCascadeTaskForLctoV0bachelor; // flag to define which task to use for Lc --> K0S+p
04c168b9 313 Float_t fCutOnMomConservation; // cut on momentum conservation
314
9aed4aed 315 ClassDef(AliCFTaskVertexingHF,24); // class for HF corrections as a function of many variables
379592af 316};
317
318#endif