AliPhysics  v5-06-40-01 (42bb456)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliCFTaskVertexingHFCutVarFDSub.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, 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 //-----------------------------------------------------------------------
17 // Class for HF corrections as a function of many variables
18 // 6 Steps introduced: MC, MC Acc, Reco, Reco Acc, Reco Acc + ITS Cl,
19 // Reco Acc + ITS Cl + PPR cuts
20 // 12 variables used: pt, y, cosThetaStar, ptPi, ptK, ct,
21 // dca, d0Pi, d0K, d0Pixd0K, cosPointingAngle, phi
22 //
23 //-----------------------------------------------------------------------
24 // Author : C. Zampolli, CERN
25 // D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
26 //-----------------------------------------------------------------------
27 //-----------------------------------------------------------------------
28 // Base class for HF Unfolding (pt and eta)
29 // correlation matrix filled at Acceptance and PPR level
30 // Author: A.Grelli , Utrecht - agrelli@uu.nl
31 //-----------------------------------------------------------------------
32 //-----------------------------------------------------------------------
33 // Modified by for analysis of D0 candidates using the cut-variation
34 // feed-down subtraction method
35 // by
36 // Andrea Rossi <Andrea.Rossi@cern.ch>
37 // Felix Reidt <Felix.Reidt@cern.ch>
38 //-----------------------------------------------------------------------
40 
41 #include "TCanvas.h"
42 #include "TProfile.h"
43 #include "TH1I.h"
44 #include "TH3F.h"
45 #include "TH1F.h"
46 #include "TStyle.h"
47 #include "TFile.h"
48 #include "TF1.h"
49 
50 #include "AliCFManager.h"
51 #include "AliCFContainer.h"
52 #include "AliLog.h"
53 #include "AliInputEventHandler.h"
54 #include "AliAnalysisManager.h"
55 #include "AliAODHandler.h"
56 #include "AliAODEvent.h"
57 #include "AliAODRecoDecayHF.h"
61 #include "AliAODRecoCascadeHF.h"
62 #include "AliAODMCParticle.h"
63 #include "AliAODMCHeader.h"
64 #include "AliESDtrack.h"
65 
66 #include "THnSparse.h"
67 #include "AliESDtrackCuts.h"
68 #include "AliRDHFCuts.h"
69 #include "AliRDHFCutsD0toKpi.h"
72 #include "AliRDHFCutsDstoKKpi.h"
73 #include "AliRDHFCutsLctopKpi.h"
74 #include "AliRDHFCutsD0toKpipipi.h"
75 #include "AliRDHFCutsLctoV0.h"
76 #include "AliCFVertexingHF2Prong.h"
77 #include "AliCFVertexingHF3Prong.h"
80 #include "AliCFVertexingHF.h"
81 #include "AliVertexingHFUtils.h"
82 #include "AliAnalysisDataSlot.h"
83 #include "AliAnalysisDataContainer.h"
84 #include "AliAnalysisTaskSE.h"
85 #include "AliPIDResponse.h"
86 #include "AliHFsubtractBFDcuts.h"
87 
91 
92 //__________________________________________________________________________
94  AliAnalysisTaskSE(),
95  fCFManager(0x0),
96  fHistEventsProcessed(0x0),
97  fCorrelation(0x0),
98  fListProfiles(0),
99  fCountMC(0),
100  fCountAcc(0),
101  fCountVertex(0),
102  fCountRefit(0),
103  fCountReco(0),
104  fCountRecoAcc(0),
105  fCountRecoITSClusters(0),
106  fCountRecoPPR(0),
107  fCountRecoPID(0),
108  fEvents(0),
109  fDecayChannel(0),
110  fFillFromGenerated(kFALSE),
111  fOriginDselection(0),
112  fAcceptanceUnf(kTRUE),
113  fCuts(0),
114  fUseWeight(kFALSE),
115  fWeight(1.),
116  fUseFlatPtWeight(kFALSE),
117  fUseZWeight(kFALSE),
118  fUseNchWeight(kFALSE),
119  fUseTrackletsWeight(kFALSE),
120  fUseMultRatioAsWeight(kFALSE),
121  fNvar(0),
122  fPartName(""),
123  fDauNames(""),
124  fSign(2),
125  fCentralitySelection(kTRUE),
126  fFakeSelection(0),
127  fRejectIfNoQuark(kTRUE),
128  fUseMCVertex(kFALSE),
129  fDsOption(1),
130  fGenDsOption(3),
131  fConfiguration(kCheetah), // by default, setting the fast configuration
132  fFuncWeight(0x0),
133  fHistoPtWeight(0x0),
134  fHistoMotherPtWeight(0x0),
135  fHistoMeasNch(0x0),
136  fHistoMCNch(0x0),
137  fResonantDecay(0),
138  fLctoV0bachelorOption(1),
139  fGenLctoV0bachelorOption(0),
140  fUseSelectionBit(kTRUE),
141  fPDGcode(0),
142  fMultiplicityEstimator(kNtrk10),
143  fRefMult(9.26),
144  fZvtxCorrectedNtrkEstimator(kFALSE),
145  fIsPPData(kFALSE),
146  fIsPPbData(kFALSE),
147  fUseAdditionalCuts(kFALSE),
148  fUseCutsForTMVA(kFALSE),
149  fUseCascadeTaskForLctoV0bachelor(kFALSE),
150  fCutOnMomConservation(0.00001),
151  fObjSpr(0x0),
152  fTHnAnalysis(0x0),
153  fTHnGenerator(0x0),
154  fhBptCutVar(0x0),
155  fListBdecays(0x0),
156  fQAHists(0x0)
157 {
158  //
159  //Default ctor
160  //
161  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=0;
162 }
163 //___________________________________________________________________________
165  AliAnalysisTaskSE(name),
166  fCFManager(0x0),
167  fHistEventsProcessed(0x0),
168  fCorrelation(0x0),
169  fListProfiles(0),
170  fCountMC(0),
171  fCountAcc(0),
172  fCountVertex(0),
173  fCountRefit(0),
174  fCountReco(0),
175  fCountRecoAcc(0),
176  fCountRecoITSClusters(0),
177  fCountRecoPPR(0),
178  fCountRecoPID(0),
179  fEvents(0),
180  fDecayChannel(0),
181  fFillFromGenerated(kFALSE),
182  fOriginDselection(0),
183  fAcceptanceUnf(kTRUE),
184  fCuts(cuts),
185  fUseWeight(kFALSE),
186  fWeight(1.),
187  fUseFlatPtWeight(kFALSE),
188  fUseZWeight(kFALSE),
189  fUseNchWeight(kFALSE),
190  fUseTrackletsWeight(kFALSE),
191  fUseMultRatioAsWeight(kFALSE),
192  fNvar(0),
193  fPartName(""),
194  fDauNames(""),
195  fSign(2),
196  fCentralitySelection(kTRUE),
197  fFakeSelection(0),
198  fRejectIfNoQuark(kTRUE),
199  fUseMCVertex(kFALSE),
200  fDsOption(1),
201  fGenDsOption(3),
202  fConfiguration(kCheetah), // by default, setting the fast configuration
203  fFuncWeight(func),
204  fHistoPtWeight(0x0),
205  fHistoMotherPtWeight(0x0),
206  fHistoMeasNch(0x0),
207  fHistoMCNch(0x0),
208  fResonantDecay(0),
209  fLctoV0bachelorOption(1),
210  fGenLctoV0bachelorOption(0),
211  fUseSelectionBit(kTRUE),
212  fPDGcode(0),
213  fMultiplicityEstimator(kNtrk10),
214  fRefMult(9.26),
215  fZvtxCorrectedNtrkEstimator(kFALSE),
216  fIsPPData(kFALSE),
217  fIsPPbData(kFALSE),
218  fUseAdditionalCuts(kFALSE),
219  fUseCutsForTMVA(kFALSE),
220  fUseCascadeTaskForLctoV0bachelor(kFALSE),
221  fCutOnMomConservation(0.00001),
222  fObjSpr(0x0),
223  fTHnAnalysis(0x0),
224  fTHnGenerator(0x0),
225  fhBptCutVar(0x0),
226  fListBdecays(0x0),
227  fQAHists(0x0)
228 {
229  //
230  // Constructor. Initialization of Inputs and Outputs
231  //
232  /*
233  DefineInput(0) and DefineOutput(0)
234  are taken care of by AliAnalysisTaskSE constructor
235  */
236  DefineOutput(1,TH1I::Class());
237  DefineOutput(2,AliCFContainer::Class());
238  DefineOutput(3,THnSparseD::Class());
239  DefineOutput(4,AliRDHFCuts::Class());
240  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=0;
241  DefineOutput(5,TList::Class()); // slot #5 keeps the zvtx Ntrakclets correction profiles
242  DefineOutput(6,THnSparseF::Class());
243  DefineOutput(7,TH3F::Class());
244  DefineOutput(8,TH1F::Class());
245  DefineOutput(9,TList::Class());
246  DefineOutput(10,TList::Class());
247 
248  fCuts->PrintAll();
249 }
250 
251 //___________________________________________________________________________
253 {
254  //
255  // Assignment operator
256  //
257  if (this!=&c) {
258  AliAnalysisTaskSE::operator=(c) ;
261  fCuts = c.fCuts;
267  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=c.fMultEstimatorAvg[i];
268  fObjSpr=c.fObjSpr;
272  fListBdecays=c.fListBdecays; // FIXME: TList copy contructor not implemented
273  fQAHists=c.fQAHists; // FIXME: TList copy contructor not implemented
274  }
275  return *this;
276 }
277 
278 //___________________________________________________________________________
280  AliAnalysisTaskSE(c),
281  fCFManager(c.fCFManager),
282  fHistEventsProcessed(c.fHistEventsProcessed),
283  fCorrelation(c.fCorrelation),
284  fListProfiles(c.fListProfiles),
285  fCountMC(c.fCountMC),
286  fCountAcc(c.fCountAcc),
287  fCountVertex(c.fCountVertex),
288  fCountRefit(c.fCountRefit),
289  fCountReco(c.fCountReco),
290  fCountRecoAcc(c.fCountRecoAcc),
291  fCountRecoITSClusters(c.fCountRecoITSClusters),
292  fCountRecoPPR(c.fCountRecoPPR),
293  fCountRecoPID(c.fCountRecoPID),
294  fEvents(c.fEvents),
295  fDecayChannel(c.fDecayChannel),
296  fFillFromGenerated(c.fFillFromGenerated),
297  fOriginDselection(c.fOriginDselection),
298  fAcceptanceUnf(c.fAcceptanceUnf),
299  fCuts(c.fCuts),
300  fUseWeight(c.fUseWeight),
301  fWeight(c.fWeight),
302  fUseFlatPtWeight(c.fUseFlatPtWeight),
303  fUseZWeight(c.fUseZWeight),
304  fUseNchWeight(c.fUseNchWeight),
305  fUseTrackletsWeight(c.fUseTrackletsWeight),
306  fUseMultRatioAsWeight(c.fUseMultRatioAsWeight),
307  fNvar(c.fNvar),
308  fPartName(c.fPartName),
309  fDauNames(c.fDauNames),
310  fSign(c.fSign),
311  fCentralitySelection(c.fCentralitySelection),
312  fFakeSelection(c.fFakeSelection),
313  fRejectIfNoQuark(c.fRejectIfNoQuark),
314  fUseMCVertex(c.fUseMCVertex),
315  fDsOption(c.fDsOption),
316  fGenDsOption(c.fGenDsOption),
317  fConfiguration(c.fConfiguration),
318  fFuncWeight(c.fFuncWeight),
319  fHistoPtWeight(c.fHistoPtWeight),
320  fHistoMotherPtWeight(c.fHistoMotherPtWeight),
321  fHistoMeasNch(c.fHistoMeasNch),
322  fHistoMCNch(c.fHistoMCNch),
323  fResonantDecay(c.fResonantDecay),
324  fLctoV0bachelorOption(c.fLctoV0bachelorOption),
325  fGenLctoV0bachelorOption(c.fGenLctoV0bachelorOption),
326  fUseSelectionBit(c.fUseSelectionBit),
327  fPDGcode(c.fPDGcode),
328  fMultiplicityEstimator(c.fMultiplicityEstimator),
329  fRefMult(c.fRefMult),
330  fZvtxCorrectedNtrkEstimator(c.fZvtxCorrectedNtrkEstimator),
331  fIsPPData(c.fIsPPData),
332  fIsPPbData(c.fIsPPbData),
333  fUseAdditionalCuts(c.fUseAdditionalCuts),
334  fUseCutsForTMVA(c.fUseCutsForTMVA),
335  fUseCascadeTaskForLctoV0bachelor(c.fUseCascadeTaskForLctoV0bachelor),
336  fCutOnMomConservation(c.fCutOnMomConservation),
337  fObjSpr(c.fObjSpr),
338  fTHnAnalysis(c.fTHnAnalysis),
339  fTHnGenerator(c.fTHnGenerator),
340  fhBptCutVar(c.fhBptCutVar),
341  fListBdecays(c.fListBdecays), // FIXME: TList copy contructor not implemented
342  fQAHists(c.fQAHists) // FIXME: TList copy contructor not implemented
343 {
344  //
345  // Copy Constructor
346  //
347  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=c.fMultEstimatorAvg[i];
348 }
349 
350 //___________________________________________________________________________
352 {
353  //
354  //destructor
355  //
356  if (fCFManager) { delete fCFManager; fCFManager=0x0; }
358  if (fCorrelation) { delete fCorrelation; fCorrelation=0x0; }
359  if (fListProfiles) { delete fListProfiles; fListProfiles=0x0; }
360  if (fCuts) { delete fCuts; fCuts=0x0; }
361  if (fFuncWeight) { delete fFuncWeight; fFuncWeight=0x0; }
362  if (fHistoPtWeight) { delete fHistoPtWeight; fHistoPtWeight=0x0; }
364  if (fHistoMeasNch) { delete fHistoMeasNch; fHistoMeasNch=0x0; }
365  if (fHistoMCNch) { delete fHistoMCNch; fHistoMCNch=0x0; }
366  if (fObjSpr) { delete fObjSpr; fObjSpr=0x0; }
367  if (fTHnAnalysis) { delete fTHnAnalysis; fTHnAnalysis=0x0; }
368  if (fTHnGenerator) { delete fTHnGenerator; fTHnGenerator=0x0; }
369  if (fhBptCutVar) { delete fhBptCutVar; fhBptCutVar=0x0; }
370  if (fListBdecays) { delete fListBdecays; fListBdecays=0x0; }
371  if (fQAHists) { delete fQAHists; fQAHists=0x0; }
372  for(Int_t i=0; i<4; i++) {
373  if(fMultEstimatorAvg[i]) { delete fMultEstimatorAvg[i]; fMultEstimatorAvg[i]=0x0; }
374  }
375 }
376 
377 //__________________________________________________________________________
379 {
380  //
381  // Initialization
382  //
383 
384  if (fDebug>1) printf("AliCFTaskVertexingHFCutVarFDSub::Init()");
385  if(fUseWeight && fUseZWeight) { AliFatal("Can not use at the same time pt and z-vtx weights, please choose"); return; }
386  if(fUseWeight && fUseNchWeight) { AliInfo("Beware, using at the same time pt and Nch weights, please check"); }
387  if(fUseNchWeight && !fHistoMCNch) { AliFatal("Need to pass the MC Nch distribution to use Nch weights"); return; }
389 
390  AliRDHFCuts *copyfCuts = 0x0;
391  if (!fCuts){
392  AliFatal("No cuts defined - Exiting...");
393  return;
394  }
395 
396  switch (fDecayChannel){
397  case 2:{
398  fPDGcode = 421;
399  copyfCuts = new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
400  switch (fConfiguration) {
401  case kSnail: // slow configuration: all variables in
402  fNvar = 16;
403  break;
404  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
405  fNvar = 8;
406  break;
407  }
408  fPartName="D0";
409  fDauNames="K+pi";
410  break;
411  }
412  case 21:{
413  fPDGcode = 413;
414  copyfCuts = new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
415  switch (fConfiguration) {
416  case kSnail: // slow configuration: all variables in
417  fNvar = 16;
418  break;
419  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
420  fNvar = 8;
421  break;
422  }
423  fPartName="Dstar";
424  fDauNames="K+pi+pi";
425  break;
426  }
427  case 22:{
428  fPDGcode = 4122;
429  copyfCuts = new AliRDHFCutsLctoV0(*(static_cast<AliRDHFCutsLctoV0*>(fCuts)));
430  switch (fConfiguration) {
431  case kSnail: // slow configuration: all variables in
432  fNvar = 16;
433  break;
434  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
435  fNvar = 8;
436  break;
437  }
438  fPartName="Lambdac";
439  fDauNames="V0+bachelor";
440  break;
441  }
442  case 31:{
443  fPDGcode = 411;
444  copyfCuts = new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
445  switch (fConfiguration) {
446  case kSnail: // slow configuration: all variables in
447  fNvar = 14;
448  break;
449  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
450  fNvar = 8;
451  break;
452  }
453  fPartName="Dplus";
454  fDauNames="K+pi+pi";
455  break;
456  }
457  case 32:{
458  fPDGcode = 4122;
459  copyfCuts = new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
460  switch (fConfiguration) {
461  case kSnail: // slow configuration: all variables in
462  fNvar = 18;
463  break;
464  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
465  fNvar = 8;
466  break;
467  }
468  fPartName="Lambdac";
469  fDauNames="p+K+pi";
470  break;
471  }
472  case 33:{
473  fPDGcode = 431;
474  copyfCuts = new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
475  switch (fConfiguration) {
476  case kSnail: // slow configuration: all variables in
477  fNvar = 14;
478  break;
479  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
480  fNvar = 8;
481  break;
482  }
483  fPartName="Ds";
484  fDauNames="K+K+pi";
485  break;
486  }
487  case 4:{
488  fPDGcode = 421;
489  copyfCuts = new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
490  switch (fConfiguration) {
491  case kSnail: // slow configuration: all variables in
492  fNvar = 16;
493  break;
494  case kCheetah:// fast configuration: only pt_candidate, y, phi, ct, fake, z_vtx, centrality, multiplicity will be filled
495  fNvar = 8;
496  break;
497  }
498  fPartName="D0";
499  fDauNames="K+pi+pi+pi";
500  break;
501  }
502  default:
503  AliFatal("The decay channel MUST be defined according to AliCFVertexing::DecayChannel - Exiting...");
504  break;
505  }
506 
507  const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
508  if (copyfCuts){
509  copyfCuts->SetName(nameoutput);
510 
511  //Post the data
512  PostData(4, copyfCuts);
513  }
514  else{
515  AliFatal("Failing initializing AliRDHFCuts object - Exiting...");
516  }
517 
518  fListProfiles = new TList();
519  fListProfiles->SetOwner();
520  TString period[4];
521  Int_t nProfiles=4;
522 
523  if (fIsPPbData) { //if pPb, use only two estimator histos
524  period[0] = "LHC13b"; period[1] = "LHC13c";
525  nProfiles = 2;
526  } else { // else assume pp (four histos for LHC10)
527  period[0] = "LHC10b"; period[1] = "LHC10c"; period[2] = "LHC10d"; period[3] = "LHC10e";
528  nProfiles = 4;
529  }
530 
531  for(Int_t i=0; i<nProfiles; i++){
532  if(fMultEstimatorAvg[i]){
533  TProfile* hprof=new TProfile(*fMultEstimatorAvg[i]);
534  hprof->SetName(Form("ProfileTrkVsZvtx%s\n",period[i].Data()));
535  fListProfiles->Add(hprof);
536  }
537  }
538 
545 
546  PostData(5,fListProfiles);
547 
548  return;
549 }
550 
551 //_________________________________________________
553 {
554  //
555  // Main loop function
556  //
557 
558  PostData(1,fHistEventsProcessed) ;
559  PostData(2,fCFManager->GetParticleContainer()) ;
560  PostData(3,fCorrelation);
561 
562  AliDebug(3,Form("*** Processing event %d\n", fEvents));
563 
564  if (fFillFromGenerated){
565  AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!");
566  }
567 
568  if (!fInputEvent) {
569  Error("UserExec","NO EVENT FOUND!");
570  return;
571  }
572 
573  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
574 
575  TClonesArray *arrayBranch=0;
576 
577  if(!aodEvent && AODEvent() && IsStandardAOD()) {
578  // In case there is an AOD handler writing a standard AOD, use the AOD
579  // event in memory rather than the input (ESD) event.
580  aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
581  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
582  // have to taken from the AOD event hold by the AliAODExtension
583  AliAODHandler* aodHandler = (AliAODHandler*)
584  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
585  if(aodHandler->GetExtensions()) {
586  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
587  AliAODEvent *aodFromExt = ext->GetAOD();
588 
589  switch (fDecayChannel){
590  case 2:{
591  arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
592  break;
593  }
594  case 21:{
595  arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
596  break;
597  }
598  case 22:{
599  arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
600  break;
601  }
602  case 31:
603  case 32:
604  case 33:{
605  arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
606  break;
607  }
608  case 4:{
609  arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
610  break;
611  }
612  default:
613  break;
614  }
615  }
616  }
617  else {
618  switch (fDecayChannel){
619  case 2:{
620  arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("D0toKpi");
621  break;
622  }
623  case 21:{
624  arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Dstar");
625  break;
626  }
627  case 22:{
628  arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("CascadesHF");
629  break;
630  }
631  case 31:
632  case 32:
633  case 33:{
634  arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm3Prong");
635  break;
636  }
637  case 4:{
638  arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm4Prong");
639  break;
640  }
641  default:
642  break;
643  }
644  }
645 
646  AliAODVertex *aodVtx = (AliAODVertex*)aodEvent->GetPrimaryVertex();
647  if (!aodVtx) {
648  AliDebug(3, "The event was skipped due to missing vertex");
649  return;
650  }
651 
652  if (!arrayBranch) {
653  AliError("Could not find array of HF vertices");
654  return;
655  }
656 
657  fEvents++;
658 
659  fCFManager->SetRecEventInfo(aodEvent);
660  fCFManager->SetMCEventInfo(aodEvent);
661 
662  //******** DEFINE number of variables of the container***** for now set at 13, in the future in the config macro.
663 
664  //loop on the MC event
665 
666  TClonesArray* mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
667  if (!mcArray) {
668  AliError("Could not find Monte-Carlo in AOD");
669  return;
670  }
671  Int_t icountMC = 0;
672  Int_t icountAcc = 0;
673  Int_t icountReco = 0;
674  Int_t icountVertex = 0;
675  Int_t icountRefit = 0;
676  Int_t icountRecoAcc = 0;
677  Int_t icountRecoITSClusters = 0;
678  Int_t icountRecoPPR = 0;
679  Int_t icountRecoPID = 0;
680  Int_t cquarks = 0;
681 
682  AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
683  if (!mcHeader) {
684  AliError("Could not find MC Header in AOD");
685  return;
686  }
687 
688  fHistEventsProcessed->Fill(0.5);
689 
690  Double_t* containerInput = new Double_t[fNvar];
691  Double_t* containerInputMC = new Double_t[fNvar];
692 
693 
694  AliCFVertexingHF* cfVtxHF=0x0;
695  switch (fDecayChannel){
696  case 2:{
697  cfVtxHF = new AliCFVertexingHF2Prong(mcArray, fOriginDselection);
698  break;
699  }
700  case 21:{
701  cfVtxHF = new AliCFVertexingHFCascade(mcArray, fOriginDselection);
702  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGcascade(413);
703  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGbachelor(211);
704  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaugh(421);
705  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughForMC(421);
706  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughPositive(211);
707  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughNegative(321);
708  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPrimaryVertex(aodVtx);
709  break;
710  }
711  case 22:{
712  // Lc -> K0S+proton
714  cfVtxHF = new AliCFVertexingHFCascade(mcArray, fOriginDselection);
715  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGcascade(4122);
716  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGbachelor(2212);
717  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaugh(310);
718  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughForMC(311);
719  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughPositive(211);
720  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughNegative(211);
721  ((AliCFVertexingHFCascade*)cfVtxHF)->SetPrimaryVertex(aodVtx);
722  ((AliCFVertexingHFCascade*)cfVtxHF)->SetCutOnMomConservation(fCutOnMomConservation);
723  if (fUseAdditionalCuts) ((AliCFVertexingHFCascade*)cfVtxHF)->SetUseCutsForTMVA(fUseCutsForTMVA);
724  }
725  else {
727  }
728  break;
729  }
730  case 31:
731  // case 32:
732  case 33:{
733  cfVtxHF = new AliCFVertexingHF3Prong(mcArray, fOriginDselection, fDecayChannel);
734  if(fDecayChannel==33){
735  ((AliCFVertexingHF3Prong*)cfVtxHF)->SetGeneratedDsOption(fGenDsOption);
736  }
737  break;
738  }
739  case 32:{
741  }
742  case 4:{
743  //cfVtxHF = new AliCFVertexingHF4Prong(mcArray, originDselection); // not there yet
744  break;
745  }
746  default:
747  break;
748  }
749  if (!cfVtxHF){
750  AliError("No AliCFVertexingHF initialized");
751  delete[] containerInput;
752  delete[] containerInputMC;
753  return;
754  }
755 
756  Double_t zPrimVertex = aodVtx ->GetZ();
757  Double_t zMCVertex = mcHeader->GetVtxZ();
758  Int_t runnumber = aodEvent->GetRunNumber();
759 
760  // Multiplicity definition with tracklets
761  Double_t nTracklets = 0;
762  Int_t nTrackletsEta10 = static_cast<Int_t>(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.,1.));
763  Int_t nTrackletsEta16 = static_cast<Int_t>(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.6,1.6));
764  nTracklets = (Double_t)nTrackletsEta10;
765  if(fMultiplicityEstimator==kNtrk10to16) { nTracklets = (Double_t)(nTrackletsEta16 - nTrackletsEta10); }
766 
767  // Apply the Ntracklets z-vtx data driven correction
769  TProfile* estimatorAvg = GetEstimatorHistogram(aodEvent);
770  if(estimatorAvg) {
771  Int_t nTrackletsEta10Corr = static_cast<Int_t>(AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta10,zPrimVertex,fRefMult));
772  Int_t nTrackletsEta16Corr = static_cast<Int_t>(AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta16,zPrimVertex,fRefMult));
773  nTracklets = (Double_t)nTrackletsEta10Corr;
774  if(fMultiplicityEstimator==kNtrk10to16) { nTracklets = (Double_t)(nTrackletsEta16Corr - nTrackletsEta10Corr); }
775  }
776  }
777 
778 
779  fWeight=1.;
780  if(fUseZWeight) fWeight *= GetZWeight(zMCVertex,runnumber);
781  if(fUseNchWeight){
782  Int_t nChargedMCPhysicalPrimary=AliVertexingHFUtils::GetGeneratedPhysicalPrimariesInEtaRange(mcArray,-1.0,1.0);
783  if(!fUseTrackletsWeight) fWeight *= GetNchWeight(nChargedMCPhysicalPrimary);
784  else fWeight *= GetNchWeight(static_cast<Int_t>(nTracklets));
785  AliDebug(2,Form("Using Nch weights, Mult=%d Weight=%f\n",nChargedMCPhysicalPrimary,fWeight));
786  }
787  Double_t eventWeight=fWeight;
788 
789  if (TMath::Abs(zMCVertex) > fCuts->GetMaxVtxZ()){
790  AliDebug(3,Form("z coordinate of MC vertex = %f, it was required to be within [-%f, +%f], skipping event", zMCVertex, fCuts->GetMaxVtxZ(), fCuts->GetMaxVtxZ()));
791  delete[] containerInput;
792  delete[] containerInputMC;
793  delete cfVtxHF;
794  return;
795  }
796 
797  if(aodEvent->GetTriggerMask()==0 &&
798  (runnumber>=195344 && runnumber<=195677)){
799  AliDebug(3,"Event rejected because of null trigger mask");
800  delete[] containerInput;
801  delete[] containerInputMC;
802  delete cfVtxHF;
803  return;
804  }
805 
806  AliESDtrackCuts** trackCuts = new AliESDtrackCuts*[cfVtxHF->GetNProngs()];
807  if (fDecayChannel == 21){
808  // for the D*, setting the third element of the array of the track cuts to those for the soft pion
809  for (Int_t iProng = 0; iProng<cfVtxHF->GetNProngs()-1; iProng++){
810  trackCuts[iProng]=fCuts->GetTrackCuts();
811  }
812  trackCuts[2] = fCuts->GetTrackCutsSoftPi();
813  }
814  else if (fDecayChannel == 22) {
815  // for the Lc->V0+bachelor, setting the second and third elements of the array of the track cuts to those for the V0 daughters
816  trackCuts[0]=fCuts->GetTrackCuts();
817  trackCuts[1]=fCuts->GetTrackCutsV0daughters();
818  trackCuts[2]=fCuts->GetTrackCutsV0daughters();
819  }
820  else {
821  for (Int_t iProng = 0; iProng<cfVtxHF->GetNProngs(); iProng++){
822  trackCuts[iProng]=fCuts->GetTrackCuts();
823  }
824  }
825 
826  //General settings: vertex, feed down and fill reco container with generated values.
827  cfVtxHF->SetRecoPrimVertex(zPrimVertex);
828  cfVtxHF->SetMCPrimaryVertex(zMCVertex);
830  cfVtxHF->SetNVar(fNvar);
834 
835  // switch-off the trigger class selection (doesn't work for MC)
836  fCuts->SetTriggerClass("");
837 
838  // MC vertex, to be used, in case, for pp
840 
841  if (fCentralitySelection){ // keep only the requested centrality
842 
843  if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) {
844  delete[] containerInput;
845  delete[] containerInputMC;
846  delete [] trackCuts;
847  delete cfVtxHF;
848  return;
849  }
850  } else { // keep all centralities
851  fCuts->SetMinCentrality(0.);
852  fCuts->SetMaxCentrality(100.);
853  }
854 
855  Float_t centValue = 0.;
856  if(!fIsPPData) centValue = fCuts->GetCentrality(aodEvent);
857  cfVtxHF->SetCentralityValue(centValue);
858 
859  // multiplicity estimator with VZERO
860  Double_t vzeroMult=0;
861  AliAODVZERO *vzeroAOD = (AliAODVZERO*)aodEvent->GetVZEROData();
862  if(vzeroAOD) vzeroMult = vzeroAOD->GetMTotV0A() + vzeroAOD->GetMTotV0C();
863 
864  Double_t multiplicity = nTracklets; // set to the Ntracklet estimator
865  if(fMultiplicityEstimator==kVZERO) { multiplicity = vzeroMult; }
866 
867  cfVtxHF->SetMultiplicity(multiplicity);
868 
869  // printf("Multiplicity estimator %d, value %2.2f\n",fMultiplicityEstimator,multiplicity);
870 
871  for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) {
872  AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(mcArray->At(iPart));
873  if (!mcPart){
874  AliError("Failed casting particle from MC array!, Skipping particle");
875  continue;
876  }
877 
878  // Obtain B0 pt spectrum
879  if ((((mcPart->GetPdgCode()%1000)/100==5||(mcPart->GetPdgCode()%1000)/100==-5)) &&
880  (mcPart->Y()<1.)&&(mcPart->Y()>-1.)) {
881  fhBptCutVar->Fill(mcPart->Pt());
882  }
883 
884  //counting c quarks
885  cquarks += cfVtxHF->MCcquarkCounting(mcPart);
886 
887  // check the MC-level cuts, must be the desidered particle
888  if (!fCFManager->CheckParticleCuts(0, mcPart)) {
889  AliDebug(2,"Check the MC-level cuts - not desidered particle");
890  continue; // 0 stands for MC level
891  }
892  else {
893  AliDebug(3, Form("\n\n---> COOL! we found a particle (particle %d)!!! with PDG code = %d \n\n", iPart, mcPart->GetPdgCode()));
894  }
895  cfVtxHF->SetMCCandidateParam(iPart);
896 
897 
898  if (!(cfVtxHF->SetLabelArray())){
899  AliDebug(2,Form("Impossible to set the label array for particle %d (decaychannel = %d)", iPart, fDecayChannel));
900  continue;
901  }
902 
903  //check the candiate family at MC level
904  if (!(cfVtxHF->CheckMCPartFamily(mcPart, mcArray))) {
905  AliDebug(2,Form("Check on the family wrong for particle %d!!! (decaychannel = %d)", iPart, fDecayChannel));
906  continue;
907  }
908  else{
909  AliDebug(2,Form("Check on the family OK for particle %d!!! (decaychannel = %d)", iPart, fDecayChannel));
910  }
911 
912  //Fill the MC container
913  Bool_t mcContainerFilled = cfVtxHF -> FillMCContainer(containerInputMC);
914  AliDebug(2, Form("particle = %d mcContainerFilled = %d", iPart, mcContainerFilled));
915  if (mcContainerFilled) {
916  if (fUseWeight){
917  if (fHistoPtWeight) { // using an histogram as weight function
918  AliDebug(2,"Using Histogram as Pt weight function");
919  fWeight = eventWeight*GetPtWeightFromHistogram(containerInputMC[0]);
920  }
921  else if (fFuncWeight){ // using user-defined function
922  AliDebug(2,"Using function");
923  fWeight = eventWeight*fFuncWeight->Eval(containerInputMC[0]);
924  }
925  else{ // using FONLL
926  AliDebug(2,"Using FONLL");
927  fWeight = eventWeight*GetWeight(containerInputMC[0]);
928  }
929  AliDebug(2,Form("pt = %f, weight = %f",containerInputMC[0], fWeight));
930  }
931  if (!fCuts->IsInFiducialAcceptance(containerInputMC[0],containerInputMC[1])) {
932  AliDebug(3, Form("Not in limited acceptance, containerInputMC[0] = %f, containerInputMC[1] = %f", containerInputMC[0], containerInputMC[1]));
933  continue;
934  }
935  else{
936  AliDebug(3, Form("YES!! in limited acceptance, containerInputMC[0] = %f, containerInputMC[1] = %f", containerInputMC[0],containerInputMC[1]));
937  }
938 
939  //MC Limited Acceptance
940  if (TMath::Abs(containerInputMC[1]) < 0.5) {
941  fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepGeneratedLimAcc, fWeight);
942  AliDebug(3,"MC Lim Acc container filled\n");
943  }
944 
945  //MC
946  fCFManager->GetParticleContainer()->Fill(containerInputMC, kStepGenerated, fWeight);
947  icountMC++;
948  AliDebug(3,"MC container filled \n");
949 
950  // MC in acceptance
951  // check the MC-Acceptance level cuts
952  // since standard CF functions are not applicable, using Kine Cuts on daughters
953  Bool_t mcAccepStep = cfVtxHF-> MCAcceptanceStep();
954  if (mcAccepStep){
955  fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepAcceptance, fWeight);
956  AliDebug(3,"MC acceptance cut passed\n");
957  icountAcc++;
958  if(fTHnGenerator){fObjSpr->FillGenStep(mcPart, mcPart->Pt(), fWeight, mcArray);}
959 
960  //MC Vertex step
961  if (fCuts->IsEventSelected(aodEvent)){
962  // filling the container if the vertex is ok
963  fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepVertex, fWeight) ;
964  AliDebug(3,"Vertex cut passed and container filled\n");
965  icountVertex++;
966 
967  //mc Refit requirement
968  Bool_t mcRefitStep = cfVtxHF->MCRefitStep(aodEvent, &trackCuts[0]);
969  if (mcRefitStep){
970  fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepRefit, fWeight);
971  AliDebug(3,"MC Refit cut passed and container filled\n");
972  icountRefit++;
973  }
974  else{
975  AliDebug(3,"MC Refit cut not passed\n");
976  continue;
977  }
978  }
979  else{
980  AliDebug (3, "MC vertex step not passed\n");
981  continue;
982  }
983  }
984  else{
985  AliDebug (3, "MC in acceptance step not passed\n");
986  continue;
987  }
988  }
989  else {
990  AliDebug (3, "MC container not filled\n");
991  }
992  }
993 
994  if (cquarks<2) AliDebug(2,Form("Event with %d c-quarks", cquarks));
995  AliDebug(2,Form("Found %i MC particles that are %s!!",icountMC,fPartName.Data()));
996  AliDebug(2,Form("Found %i MC particles that are %s and satisfy Acc cuts!!",icountAcc,fPartName.Data()));
997  AliDebug(2,Form("Found %i MC particles that are %s and satisfy Vertex cuts!!",icountVertex,fPartName.Data()));
998  AliDebug(2,Form("Found %i MC particles that are %s and satisfy Refit cuts!!",icountRefit,fPartName.Data()));
999 
1000  // Now go to rec level
1001  fCountMC += icountMC;
1002  fCountAcc += icountAcc;
1003  fCountVertex+= icountVertex;
1004  fCountRefit+= icountRefit;
1005 
1006  AliDebug(2,Form("Found %d vertices for decay channel %d",arrayBranch->GetEntriesFast(),fDecayChannel));
1007 
1008  for(Int_t iCandid = 0; iCandid<arrayBranch->GetEntriesFast();iCandid++){
1009  AliAODRecoDecayHF* charmCandidate=0x0;
1010  switch (fDecayChannel){
1011  case 2:{
1012  charmCandidate = (AliAODRecoDecayHF2Prong*)arrayBranch->At(iCandid);
1013  break;
1014  }
1015  case 21:
1016  case 22:{
1017  charmCandidate = (AliAODRecoCascadeHF*)arrayBranch->At(iCandid);
1018  break;
1019  }
1020  case 31:
1021  case 32:
1022  case 33:{
1023  charmCandidate = (AliAODRecoDecayHF3Prong*)arrayBranch->At(iCandid);
1024  break;
1025  }
1026  case 4:{
1027  charmCandidate = (AliAODRecoDecayHF4Prong*)arrayBranch->At(iCandid);
1028  break;
1029  }
1030  default:
1031  break;
1032  }
1033 
1034  Double_t motherPtWeight=1.;
1036  if (fHistoMotherPtWeight) {
1037  AliDebug(2,"Using Histogram as mother pt weight function");
1038  Double_t motherPt = GetMotherPtFromRecoDecay(charmCandidate,mcArray);
1039  motherPtWeight = GetMotherPtWeightFromHistogram(motherPt);
1040  AliDebug(2,Form("mother pt = %f, weight = %f", motherPt, fWeight));
1041  }
1042  else AliDebug(2, "Couldn't find mother pt dependend weights");
1043  }
1044 
1045  Bool_t unsetvtx=kFALSE;
1046  if(!charmCandidate->GetOwnPrimaryVtx()) {
1047  charmCandidate->SetOwnPrimaryVtx(aodVtx); // needed to compute all variables
1048  unsetvtx=kTRUE;
1049  }
1050 
1051  Bool_t signAssociation = cfVtxHF->SetRecoCandidateParam((AliAODRecoDecayHF*)charmCandidate);
1052  if (!signAssociation){
1053  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1054  continue;
1055  }
1056 
1057  Int_t isPartOrAntipart = cfVtxHF->CheckReflexion(fSign);
1058  if (isPartOrAntipart == 0){
1059  AliDebug(2, Form("The candidate pdg code doesn't match the requirement set in the task (fSign = %d)",fSign));
1060  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1061  continue;
1062  }
1063 
1064  AliDebug(3,Form("iCandid=%d - signAssociation=%d, isPartOrAntipart=%d",iCandid, signAssociation, isPartOrAntipart));
1065 
1066  Bool_t recoContFilled = cfVtxHF->FillRecoContainer(containerInput);
1067  AliDebug(3, Form("CF task: RecoContFilled for candidate %d is %d", iCandid, (Int_t)recoContFilled));
1068  if (recoContFilled){
1069 
1070  // weight according to pt
1071  if (fUseWeight){
1072  if (fHistoPtWeight) {
1073  AliDebug(2,"Using Histogram as Pt weight function");
1074  fWeight = eventWeight*GetPtWeightFromHistogram(containerInput[0]);
1075  }
1076  else if (fFuncWeight){ // using user-defined function
1077  AliDebug(2, "Using function");
1078  fWeight = eventWeight*fFuncWeight->Eval(containerInput[0]);
1079  }
1080  else{ // using FONLL
1081  AliDebug(2, "Using FONLL");
1082  fWeight = eventWeight*GetWeight(containerInput[0]);
1083  }
1084  AliDebug(2, Form("pt = %f, weight = %f",containerInput[0], fWeight));
1085  }
1086 
1087  if (!fCuts->IsInFiducialAcceptance(containerInput[0],containerInput[1])){
1088  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1089  continue;
1090  }
1091  //Reco Step
1092  Bool_t recoStep = cfVtxHF->RecoStep();
1093  if (recoStep) AliDebug(2, Form("particle = %d --> CF task: Reco step for candidate %d is %d", iCandid, iCandid, (Int_t)recoStep));
1094  Bool_t vtxCheck = fCuts->IsEventSelected(aodEvent);
1095 
1096 
1097  // Selection on the filtering bit
1098  Bool_t isBitSelected = kTRUE;
1099  if(fDecayChannel==2) {
1100  if(fUseSelectionBit && !charmCandidate->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) isBitSelected = kFALSE;
1101  }else if(fDecayChannel==31){
1102  if(fUseSelectionBit && !charmCandidate->HasSelectionBit(AliRDHFCuts::kDplusCuts)) isBitSelected = kFALSE;
1103  }else if(fDecayChannel==33){
1104  if(fUseSelectionBit && !charmCandidate->HasSelectionBit(AliRDHFCuts::kDsCuts)) isBitSelected = kFALSE;
1105  }else if(fDecayChannel==32){
1106  if(fUseSelectionBit && !charmCandidate->HasSelectionBit(AliRDHFCuts::kLcCuts)) isBitSelected = kFALSE;
1107  }
1108  if(!isBitSelected){
1109  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1110  continue;
1111  }
1112 
1113 
1114  if (recoStep && recoContFilled && vtxCheck){
1115  fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed, fWeight) ;
1116  icountReco++;
1117  AliDebug(3,"Reco step passed and container filled\n");
1118 
1119  //Reco in the acceptance -- take care of UNFOLDING!!!!
1120  Bool_t recoAcceptanceStep = cfVtxHF->RecoAcceptStep(&trackCuts[0]);
1121  if (recoAcceptanceStep) {
1122  fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance, fWeight) ;
1123  icountRecoAcc++;
1124  AliDebug(3,"Reco acceptance cut passed and container filled\n");
1125 
1126  if(fAcceptanceUnf){
1127  Double_t fill[4]; //fill response matrix
1128  Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fPDGcode,fill);
1129  if (bUnfolding) fCorrelation->Fill(fill);
1130  }
1131 
1132  //Number of ITS cluster requirements
1133  Int_t recoITSnCluster = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kTracks);
1134  if (recoITSnCluster){
1135  fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters, fWeight) ;
1136  icountRecoITSClusters++;
1137  AliDebug(3,"Reco n ITS cluster cut passed and container filled\n");
1138 
1139  Bool_t iscutsusingpid = fCuts->GetIsUsePID();
1140  Int_t recoAnalysisCuts = -1, recoPidSelection = -1;
1141  fCuts->SetUsePID(kFALSE);
1142  recoAnalysisCuts = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
1143 
1144  if (fDecayChannel==33){ // Ds case, where more possibilities are considered
1145  Bool_t keepDs=ProcessDs(recoAnalysisCuts);
1146  if(keepDs) recoAnalysisCuts=3;
1147  }
1148  else if (fDecayChannel==22){ // Lc->V0+bachelor case, where more possibilities are considered
1149  Bool_t keepLctoV0bachelor = ProcessLctoV0Bachelor(recoAnalysisCuts);
1150  if (keepLctoV0bachelor) recoAnalysisCuts=3;
1151  AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
1152  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
1153  AliPIDResponse* pidResponse = inputHandler->GetPIDResponse();
1154  if (fUseAdditionalCuts){
1155  if (!((AliCFVertexingHFCascade*)cfVtxHF)->CheckAdditionalCuts(pidResponse)) recoAnalysisCuts = -1;
1156  }
1157  }
1158 
1159  fCuts->SetUsePID(iscutsusingpid); //restoring usage of the PID from the cuts object
1160  Bool_t tempAn=(recoAnalysisCuts == 3 || recoAnalysisCuts == isPartOrAntipart);
1161  if (fDecayChannel == 22) tempAn = (recoAnalysisCuts == 3);
1162  if (fDecayChannel == 32) tempAn=(recoAnalysisCuts >0 || recoAnalysisCuts == isPartOrAntipart);
1163 
1164  if (tempAn){
1165  fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPPR, fWeight);
1166  icountRecoPPR++;
1167  AliDebug(3,"Reco Analysis cuts passed and container filled \n");
1168  //pid selection
1169  //recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kPID);
1170  //if((fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==isPartOrAntipart)||(fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==3)){
1171  recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
1172 
1173  if (fDecayChannel==33){ // Ds case, where more possibilities are considered
1174  Bool_t keepDs=ProcessDs(recoPidSelection);
1175  if(keepDs) recoPidSelection=3;
1176  } else if (fDecayChannel==22){ // Lc->V0+bachelor case, where more possibilities are considered
1177  Bool_t keepLctoV0bachelor=ProcessLctoV0Bachelor(recoPidSelection);
1178  if (keepLctoV0bachelor) recoPidSelection=3;
1179  }
1180 
1181  Bool_t tempPid=(recoPidSelection == 3 || recoPidSelection == isPartOrAntipart);
1182  if (fDecayChannel == 22) tempPid = (recoPidSelection == 3);
1183  if (fDecayChannel == 32) tempPid=(recoPidSelection >0 || recoPidSelection == isPartOrAntipart);
1184 
1185  if (tempPid){
1186  Double_t weigPID = 1.;
1187  if (fDecayChannel == 2){ // D0 with Bayesian PID using weights
1188  if(((AliRDHFCutsD0toKpi*)fCuts)->GetCombPID() && (((AliRDHFCutsD0toKpi*)fCuts)->GetBayesianStrategy() == AliRDHFCutsD0toKpi::kBayesWeight || ((AliRDHFCutsD0toKpi*)fCuts)->GetBayesianStrategy() == AliRDHFCutsD0toKpi::kBayesWeightNoFilter)){
1189  if (isPartOrAntipart == 1){
1190  weigPID = ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsNegative()[AliPID::kKaon] * ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsPositive()[AliPID::kPion];
1191  }else if (isPartOrAntipart == 2){
1192  weigPID = ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsPositive()[AliPID::kKaon] * ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsNegative()[AliPID::kPion];
1193  }
1194  if ((weigPID < 0) || (weigPID > 1)) weigPID = 0.;
1195  }
1196  }else if (fDecayChannel == 33){ // Ds with Bayesian PID using weights
1198  Int_t labDau0=((AliAODTrack*)charmCandidate->GetDaughter(0))->GetLabel();
1199  AliAODMCParticle* firstDau=(AliAODMCParticle*)mcArray->UncheckedAt(TMath::Abs(labDau0));
1200  if(firstDau){
1201  Int_t pdgCode0=TMath::Abs(firstDau->GetPdgCode());
1202  if(pdgCode0==321){
1203  weigPID=((AliRDHFCutsDstoKKpi*)fCuts)->GetWeightForKKpi();
1204  }else if(pdgCode0==211){
1205  weigPID=((AliRDHFCutsDstoKKpi*)fCuts)->GetWeightForpiKK();
1206  }
1207  if ((weigPID < 0) || (weigPID > 1)) weigPID = 0.;
1208  }else{
1209  weigPID=0.;
1210  }
1211  }
1212  }
1213  fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPID, fWeight*weigPID);
1214 
1215  AliAODRecoDecayHF2Prong *d0toKpi = (AliAODRecoDecayHF2Prong*)charmCandidate;
1216  fObjSpr->SetFillMC(kTRUE);
1217  fObjSpr->FillSparses(d0toKpi, recoAnalysisCuts, d0toKpi->Pt(),d0toKpi->InvMassD0(), d0toKpi->InvMassD0bar(), fWeight*weigPID, mcArray, aodEvent);
1218 
1219  icountRecoPID++;
1220  AliDebug(3,"Reco PID cuts passed and container filled \n");
1221  if(!fAcceptanceUnf){
1222  Double_t fill[4]; //fill response matrix
1223  Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fPDGcode,fill);
1224  if (bUnfolding) fCorrelation->Fill(fill);
1225  }
1226  }
1227  else {
1228  AliDebug(3, "Analysis Cuts step not passed \n");
1229  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1230  continue;
1231  }
1232  }
1233  else {
1234  AliDebug(3, "PID selection not passed \n");
1235  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1236  continue;
1237  }
1238  }
1239  else{
1240  AliDebug(3, "Number of ITS cluster step not passed\n");
1241  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1242  continue;
1243  }
1244  }
1245  else{
1246  AliDebug(3, "Reco acceptance step not passed\n");
1247  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1248  continue;
1249  }
1250  }
1251  else {
1252  AliDebug(3, "Reco step not passed\n");
1253  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1254  continue;
1255  }
1256  }
1257 
1258  if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
1259  } // end loop on candidate
1260 
1261  fCountReco+= icountReco;
1262  fCountRecoAcc+= icountRecoAcc;
1263  fCountRecoITSClusters+= icountRecoITSClusters;
1264  fCountRecoPPR+= icountRecoPPR;
1265  fCountRecoPID+= icountRecoPID;
1266 
1267  fHistEventsProcessed->Fill(1.5);
1268 
1269  delete[] containerInput;
1270  delete[] containerInputMC;
1271  delete cfVtxHF;
1272  if (trackCuts){
1273  // for (Int_t i=0; i<cfVtxHF->GetNProngs(); i++){
1274  // delete [] trackCuts[i];
1275  // }
1276  delete [] trackCuts;
1277  }
1278 
1279 
1280 }
1281 
1282 //___________________________________________________________________________
1284 {
1285  // The Terminate() function is the last function to be called during
1286  // a query. It always runs on the client, it can be used to present
1287  // the results graphically or save the results to file.
1288 
1289  AliAnalysisTaskSE::Terminate();
1290 
1291  AliInfo(Form("Found %i MC particles that are %s in MC, in %d events",fCountMC,fPartName.Data(),fEvents));
1292  AliInfo(Form("Found %i MC particles that are %s in MC and satisfy Acc cuts, in %d events",fCountAcc,fPartName.Data(),fEvents));
1293  AliInfo(Form("Found %i MC particles that are %s in MC and satisfy Acc cuts, and satisfy Vertex requirement in %d events",fCountVertex,fPartName.Data(),fEvents));
1294  AliInfo(Form("Found %i MC particles that are %s in MC and satisfy Acc cuts, and satisfy ITS+TPC refit requirementin %d events",fCountRefit,fPartName.Data(),fEvents));
1295  AliInfo(Form("Found %i reco %s that are decaying in %s, in %d events",fCountReco,fPartName.Data(),fDauNames.Data(),fEvents));
1296  AliInfo(Form("Among the above, found %i reco %s that are decaying in %s and are in the requested acceptance, in %d events",fCountRecoAcc,fPartName.Data(),fDauNames.Data(),fEvents));
1297  AliInfo(Form("Among the above, found %i reco %s that are decaying in %s and have at least 5 clusters in ITS, in %d events",fCountRecoITSClusters,fPartName.Data(),fDauNames.Data(),fEvents));
1298  AliInfo(Form("Among the above, found %i reco %s that are decaying in %s and satisfy PPR cuts, in %d events",fCountRecoPPR,fPartName.Data(),fDauNames.Data(),fEvents));
1299  AliInfo(Form("Among the above, found %i reco %s that are decaying in %s and satisfy PPR+PID cuts, in %d events",fCountRecoPID,fPartName.Data(),fDauNames.Data(),fEvents));
1300 
1301  // draw some example plots....
1302  AliCFContainer *cont= dynamic_cast<AliCFContainer*> (GetOutputData(2));
1303  if(!cont) {
1304  printf("CONTAINER NOT FOUND\n");
1305  return;
1306  }
1307  // projecting the containers to obtain histograms
1308  // first argument = variable, second argument = step
1309 
1310  TH1D** h = new TH1D*[3];
1311  Int_t nvarToPlot = 0;
1312  if (fConfiguration == kSnail){
1313  //h = new TH1D[3][12];
1314  for (Int_t ih = 0; ih<3; ih++){
1315  if(fDecayChannel==22){
1316  nvarToPlot = 16;
1317  } else {
1318  nvarToPlot = 12;
1319  }
1320  h[ih] = new TH1D[nvarToPlot];
1321  }
1322  for(Int_t iC=1;iC<nvarToPlot; iC++){
1323  // MC-level
1324  h[0][iC] = *(cont->ShowProjection(iC,0));
1325  // MC-Acceptance level
1326  h[1][iC] = *(cont->ShowProjection(iC,1));
1327  // Reco-level
1328  h[2][iC] = *(cont->ShowProjection(iC,4));
1329  }
1330  }
1331  else {
1332  //h = new TH1D[3][12];
1333  nvarToPlot = 8;
1334  for (Int_t ih = 0; ih<3; ih++){
1335  h[ih] = new TH1D[nvarToPlot];
1336  }
1337  for(Int_t iC=0;iC<nvarToPlot; iC++){
1338  // MC-level
1339  h[0][iC] = *(cont->ShowProjection(iC,0));
1340  // MC-Acceptance level
1341  h[1][iC] = *(cont->ShowProjection(iC,1));
1342  // Reco-level
1343  h[2][iC] = *(cont->ShowProjection(iC,4));
1344  }
1345  }
1346  TString* titles;
1347  //Int_t nvarToPlot = 0;
1348  if (fConfiguration == kSnail){
1349  if(fDecayChannel==31){
1350  //nvarToPlot = 12;
1351  titles = new TString[nvarToPlot];
1352  titles[0]="pT_Dplus (GeV/c)";
1353  titles[1]="rapidity";
1354  titles[2]="phi (rad)";
1355  titles[3]="cT (#mum)";
1356  titles[4]="cosPointingAngle";
1357  titles[5]="pT_1 (GeV/c)";
1358  titles[6]="pT_2 (GeV/c)";
1359  titles[7]="pT_3 (GeV/c)";
1360  titles[8]="d0_1 (#mum)";
1361  titles[9]="d0_2 (#mum)";
1362  titles[10]="d0_3 (#mum)";
1363  titles[11]="zVertex (cm)";
1364  } else if (fDecayChannel==22) {
1365  //nvarToPlot = 16;
1366  titles = new TString[nvarToPlot];
1367  titles[0]="p_{T}(#Lambda_{c}) [GeV/c]";
1368  titles[1]="y(#Lambda_{c})";
1369  titles[2]="#varphi(#Lambda_{c}) [rad]";
1370  titles[3]="onTheFlyStatusV0";
1371  titles[4]="z_{vtx} [cm]";
1372  titles[5]="centrality";
1373  titles[6]="fake";
1374  titles[7]="multiplicity";
1375  //titles[8]="pT(bachelor) [GeV/c]";
1376  titles[8]="p(bachelor) [GeV/c]";
1377  titles[9]="p_{T}(V0) [GeV/c]";
1378  titles[10]="y(V0)";
1379  titles[11]="#varphi(V0) [rad]";
1380  titles[12]="m_{inv}(#pi^{+}#pi^{+}) [GeV/c^{2}]";
1381  titles[13]="dcaV0 (nSigma)";
1382  titles[14]="cosine pointing angle (V0)";
1383  titles[15]="cosine pointing angle (#Lambda_{c})";
1384  //titles[16]="c#tauV0 (#mum)";
1385  //titles[17]="c#tau (#mum)";
1386  } else {
1387  //nvarToPlot = 12;
1388  titles = new TString[nvarToPlot];
1389  titles[0]="pT_D0 (GeV/c)";
1390  titles[1]="rapidity";
1391  titles[2]="cosThetaStar";
1392  titles[3]="pT_pi (GeV/c)";
1393  titles[4]="pT_K (Gev/c)";
1394  titles[5]="cT (#mum)";
1395  titles[6]="dca (#mum)";
1396  titles[7]="d0_pi (#mum)";
1397  titles[8]="d0_K (#mum)";
1398  titles[9]="d0xd0 (#mum^2)";
1399  titles[10]="cosPointingAngle";
1400  titles[11]="phi (rad)";
1401  }
1402  }
1403  else {
1404  //nvarToPlot = 8;
1405  titles = new TString[nvarToPlot];
1406  if (fDecayChannel==22) {
1407  titles[0]="p_{T}(#Lambda_{c}) [GeV/c]";
1408  titles[1]="y(#Lambda_{c})";
1409  titles[2]="#varphi(#Lambda_{c}) [rad]";
1410  titles[3]="onTheFlyStatusV0";
1411  titles[4]="z_{vtx} [cm]";
1412  titles[5]="centrality";
1413  titles[6]="fake";
1414  titles[7]="multiplicity";
1415  } else {
1416  titles[0]="pT_candidate (GeV/c)";
1417  titles[1]="rapidity";
1418  titles[2]="cT (#mum)";
1419  titles[3]="phi";
1420  titles[4]="z_{vtx}";
1421  titles[5]="centrality";
1422  titles[6]="fake";
1423  titles[7]="multiplicity";
1424  }
1425  }
1426 
1427  Int_t markers[16]={20,24,21,25,27,28,
1428  20,24,21,25,27,28,
1429  20,24,21,25};
1430  Int_t colors[3]={2,8,4};
1431  for(Int_t iC=0;iC<nvarToPlot; iC++){
1432  for(Int_t iStep=0;iStep<3;iStep++){
1433  h[iStep][iC].SetTitle(titles[iC].Data());
1434  h[iStep][iC].GetXaxis()->SetTitle(titles[iC].Data());
1435  Double_t maxh=h[iStep][iC].GetMaximum();
1436  h[iStep][iC].GetYaxis()->SetRangeUser(0,maxh*1.2);
1437  h[iStep][iC].SetMarkerStyle(markers[iC]);
1438  h[iStep][iC].SetMarkerColor(colors[iStep]);
1439  }
1440  }
1441 
1442  gStyle->SetCanvasColor(0);
1443  gStyle->SetFrameFillColor(0);
1444  gStyle->SetTitleFillColor(0);
1445  gStyle->SetStatColor(0);
1446 
1447  // drawing in 2 separate canvas for a matter of clearity
1448  TCanvas * c1 =new TCanvas(Form("c1New_%d",fDecayChannel),"Vars 0, 1, 2, 3",1100,1200);
1449  c1->Divide(3,4);
1450  Int_t iPad=1;
1451  for(Int_t iVar=0; iVar<4; iVar++){
1452  c1->cd(iPad++);
1453  h[0][iVar].DrawCopy("p");
1454  c1->cd(iPad++);
1455  h[1][iVar].DrawCopy("p");
1456  c1->cd(iPad++);
1457  h[2][iVar].DrawCopy("p");
1458  }
1459 
1460  TCanvas * c2 =new TCanvas(Form("c2New_%d",fDecayChannel),"Vars 4, 5, 6, 7",1100,1200);
1461  c2->Divide(3,4);
1462  iPad=1;
1463  for(Int_t iVar=4; iVar<8; iVar++){
1464  c2->cd(iPad++);
1465  h[0][iVar].DrawCopy("p");
1466  c2->cd(iPad++);
1467  h[1][iVar].DrawCopy("p");
1468  c2->cd(iPad++);
1469  h[2][iVar].DrawCopy("p");
1470  }
1471 
1472  if (fConfiguration == kSnail){
1473  TCanvas * c3 =new TCanvas(Form("c3New_%d",fDecayChannel),"Vars 8, 9, 10, 11",1100,1200);
1474  c3->Divide(3,4);
1475  iPad=1;
1476  for(Int_t iVar=8; iVar<12; iVar++){
1477  c3->cd(iPad++);
1478  h[0][iVar].DrawCopy("p");
1479  c3->cd(iPad++);
1480  h[1][iVar].DrawCopy("p");
1481  c3->cd(iPad++);
1482  h[2][iVar].DrawCopy("p");
1483  }
1484  if (fDecayChannel==22) {
1485  TCanvas * c4 =new TCanvas(Form("c4New_%d",fDecayChannel),"Vars 12, 13, 14, 15",1100,1200);
1486  c4->Divide(3,4);
1487  iPad=1;
1488  for(Int_t iVar=12; iVar<16; iVar++){
1489  c4->cd(iPad++);
1490  h[0][iVar].DrawCopy("p");
1491  c4->cd(iPad++);
1492  h[1][iVar].DrawCopy("p");
1493  c4->cd(iPad++);
1494  h[2][iVar].DrawCopy("p");
1495  }
1496  }
1497  }
1498 
1499  /*
1500  THnSparseD* hcorr = dynamic_cast<THnSparseD*> (GetOutputData(3));
1501 
1502  TH2D* corr1 = hcorr->Projection(0,2);
1503  TH2D* corr2 = hcorr->Projection(1,3);
1504 
1505  TCanvas * c7 =new TCanvas(Form("c7New_%d",fDecayChannel),"",800,400);
1506  c7->Divide(2,1);
1507  c7->cd(1);
1508  corr1->DrawCopy("text");
1509  c7->cd(2);
1510  corr2->DrawCopy("text");
1511  */
1512  TFile* file_projection = new TFile("CFtaskHFprojectionNew.root","RECREATE");
1513 
1514  // corr1->Write();
1515  // corr2->Write();
1516 
1517  for(Int_t iC=0;iC<nvarToPlot; iC++){
1518  for(Int_t iStep=0;iStep<3;iStep++){
1519  h[iStep][iC].Write(Form("Step%d_%s",iStep,titles[iC].Data()));
1520  }
1521  }
1522  file_projection->Close();
1523  for (Int_t ih = 0; ih<3; ih++) delete [] h[ih];
1524  delete [] h;
1525  delete [] titles;
1526 
1527 }
1528 
1529 //___________________________________________________________________________
1531 {
1532  //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
1533  //TO BE SET BEFORE THE EXECUTION OF THE TASK
1534  //
1535  Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
1536 
1537  //slot #1
1538  OpenFile(1);
1539  const char* nameoutput=GetOutputSlot(1)->GetContainer()->GetName();
1540  fHistEventsProcessed = new TH1I(nameoutput,"",2,0,2) ;
1541  fHistEventsProcessed->GetXaxis()->SetBinLabel(1,"Events processed (all)");
1542  fHistEventsProcessed->GetXaxis()->SetBinLabel(2,"Events analyzed (after selection)");
1543 
1544  if(!fObjSpr){
1545  fObjSpr=new AliHFsubtractBFDcuts("feedDownCuts","feedDownCuts");
1546  fObjSpr->InitHistos();
1551  }
1552 
1553  fhBptCutVar = new TH1F("hBptCutVar", "B meson #it{p}_{T} spectrum;#it{p}_{T};Counts (a.u.)",201,0.,50.25);
1554 
1555  PostData( 1,fHistEventsProcessed) ;
1556  PostData( 2,fCFManager->GetParticleContainer()) ;
1557  PostData( 3,fCorrelation) ;
1558  PostData( 6,fTHnAnalysis);
1559  PostData( 7,fTHnGenerator);
1560  PostData( 8,fhBptCutVar);
1561  PostData( 9,fListBdecays);
1562  PostData(10,fQAHists);
1563 }
1564 
1565 
1566 //_________________________________________________________________________
1568  // ad-hoc weight function from ratio of
1569  // pt spectra from FONLL 2.76 TeV and
1570  // pt spectra from MC production LHC12a17a (PYTHIA Perugia0 with pthard bins)
1571  if(fFuncWeight) delete fFuncWeight;
1572  fFuncWeight=new TF1("funcWeight","[0]+[1]*TMath::Exp(-[2]*x)",0.,50.);
1573  fFuncWeight->SetParameter(0,4.63891e-02);
1574  fFuncWeight->SetParameter(1,1.51674e+01);
1575  fFuncWeight->SetParameter(2,4.09941e-01);
1576  fUseWeight=kTRUE;
1577 }
1578 //_________________________________________________________________________
1580  // ad-hoc weight function from ratio of
1581  // D0 pt spectra in PbPb 2011 0-10% centrality and
1582  // pt spectra from MC production LHC12a17a (PYTHIA Perugia0 with pthard bins)
1583  if(fFuncWeight) delete fFuncWeight;
1584  fFuncWeight=new TF1("funcWeight","[0]+[1]/TMath::Power(x,[2])",0.05,50.);
1585  fFuncWeight->SetParameter(0,1.43116e-02);
1586  fFuncWeight->SetParameter(1,4.37758e+02);
1587  fFuncWeight->SetParameter(2,3.08583);
1588  fUseWeight=kTRUE;
1589 }
1590 
1591 //_________________________________________________________________________
1593  // weight function from the ratio of the LHC12a17b MC
1594  // and FONLL calculations for pp data
1595  if(fFuncWeight) delete fFuncWeight;
1596  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,50.);
1597  fFuncWeight->SetParameters(1.92381e+01, 5.05055e+00, 1.05314e+01, 2.5, 1.88214e-03, 3.44871e+00, -9.74325e-02, 1.97671e+00, -3.21278e-01);
1598  fUseWeight=kTRUE;
1599 }
1600 
1601 //_________________________________________________________________________
1603  // weight function from the ratio of the LHC12a17b MC
1604  // and FONLL calculations for pp data
1605  // corrected by the BAMPS Raa calculation for 30-50% CC
1606  if(fFuncWeight) delete fFuncWeight;
1607  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,50.);
1608  fFuncWeight->SetParameters(6.10443e+00, 1.53487e+00, 1.99474e+00, 2.5, 5.51172e-03, 5.86590e+00, -5.46963e-01, 9.41201e-02, -1.64323e-01);
1609  fUseWeight=kTRUE;
1610 }
1611 
1612 //_________________________________________________________________________
1614  // weight function from the ratio of the LHC13d3 MC
1615  // and FONLL calculations for pp data
1616  if(fFuncWeight) delete fFuncWeight;
1617  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,30.);
1618  fFuncWeight->SetParameters(2.94999e+00,3.47032e+00,2.81278e+00,2.5,1.93370e-02,3.86865e+00,-1.54113e-01,8.86944e-02,2.56267e-02);
1619  fUseWeight=kTRUE;
1620 }
1621 
1622 //_________________________________________________________________________
1627 
1628  Double_t weights[] = { 0.958796, 0.94262, 1.00746, 1.00264, 1.0103, 1.00033, 0.970773, 0.925759, 0.873651, 0.827537, 0.793838, 0.770711, 0.753224, 0.740698, 0.729354, 0.720129, 0.71487, 0.711469, 0.706371, 0.704551, 0.705003, 0.702572, 0.704875, 0.706797, 0.70574, 0.710273, 0.714451, 0.716691, 0.720462, 0.719736, 0.722672, 0.724752, 0.731169, 0.734225, 0.741758, 0.749343, 0.741116, 0.747457, 0.746682, 0.754226, 0.763797, 0.765175, 0.762687, 0.772638, 0.767542, 0.779808, 0.782834, 0.781626 };
1629  Int_t nBins=48;
1630  Double_t xMin=0.;
1631  Double_t xMax=24.;
1632  fHistoMotherPtWeight = new TH1F("hMotherPtWeight",";Mother #it{p}_T;Weight",nBins,xMin,xMax);
1633  for (Int_t ix=1;ix<nBins+1;++ix) fHistoMotherPtWeight->SetBinContent(ix, weights[ix]);
1634  fUseMotherPtWeight=kTRUE;
1635 }
1636 
1637 //_________________________________________________________________________
1639  // weight function from the ratio of the LHC10f6a MC
1640  // and FONLL calculations for pp data
1641  if(fFuncWeight) delete fFuncWeight;
1642  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
1643  fFuncWeight->SetParameters(2.41522e+01,4.92146e+00,6.72495e+00,2.5,6.15361e-03,4.78995e+00,-4.29135e-01,3.99421e-01,-1.57220e-02);
1644  fUseWeight=kTRUE;
1645 }
1646 
1647 //_________________________________________________________________________
1649  // weight function from the ratio of the LHC12a12 MC
1650  // and FONLL calculations for pp data
1651  if(fFuncWeight) delete fFuncWeight;
1652  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
1653  fFuncWeight->SetParameters(1.31497e+01,3.30503e+00,3.45594e+00,2.5,2.28642e-02,1.42372e+00,2.32892e-04,5.21986e-02,-2.14236e-01,3.86200e+00);
1654  fUseWeight=kTRUE;
1655 }
1656 
1657 //_________________________________________________________________________
1659  // weight function from the ratio of the LHC12a12bis MC
1660  // and FONLL calculations for pp data
1661  if(fFuncWeight) delete fFuncWeight;
1662  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
1663  fFuncWeight->SetParameters(6.54519e+00,2.74007e+00,2.48325e+00,2.5,1.61113e-01,-5.32546e-01,-3.75916e-04,2.38189e-01,-2.17561e-01,2.35975e+00);
1664  fUseWeight=kTRUE;
1665 }
1666 
1667 //_________________________________________________________________________
1669  // weight function from the ratio of the LHC13e2fix MC
1670  // and FONLL calculations for pp data
1671  if(fFuncWeight) delete fFuncWeight;
1672  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
1673  fFuncWeight->SetParameters(1.85862e+01,2.48171e+00,3.39356e+00,2.5,1.70426e-02,2.28453e+00,-4.57749e-02,5.84585e-02,-3.19719e-01,4.16789e+00);
1674  fUseWeight=kTRUE;
1675 }
1676 
1677 //________________________________________________________________
1679  // weight function from the ratio of the LHC10f6a MC
1680  // and FONLL calculations for pp data
1681  if(fFuncWeight) delete fFuncWeight;
1682  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
1683  fFuncWeight->SetParameters(2.77730e+01,4.78942e+00,7.45378e+00,2.5,9.86255e-02,2.30120e+00,-4.16435e-01,3.43770e-01,-2.29380e-02);
1684  fUseWeight=kTRUE;
1685 }
1686 
1687 //________________________________________________________________
1689  // weight function from the ratio of the LHC10f6a MC
1690  // and FONLL calculations for pp data
1691  if(fFuncWeight) delete fFuncWeight;
1692  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,40.);
1693  fFuncWeight->SetParameters(1.34412e+01,3.20068e+00,5.14481e+00,2.5,7.59405e-04,7.51821e+00,-3.93811e-01,2.16849e-02,-3.37768e-02,2.40308e+00);
1694  fUseWeight=kTRUE;
1695 }
1696 
1697 //_________________________________________________________________________
1699 {
1700  //
1701  // calculating the weight to fill the container
1702  //
1703 
1704  // FNOLL central:
1705  // p0 = 1.63297e-01 --> 0.322643
1706  // p1 = 2.96275e+00
1707  // p2 = 2.30301e+00
1708  // p3 = 2.50000e+00
1709 
1710  // PYTHIA
1711  // p0 = 1.85906e-01 --> 0.36609
1712  // p1 = 1.94635e+00
1713  // p2 = 1.40463e+00
1714  // p3 = 2.50000e+00
1715 
1716  Double_t func1[4] = {0.322643,2.96275,2.30301,2.5};
1717  Double_t func2[4] = {0.36609,1.94635,1.40463,2.5};
1718 
1719  Double_t dndpt_func1 = dNdptFit(pt,func1);
1720  if(fUseFlatPtWeight) dndpt_func1 = 1./30.;
1721  Double_t dndpt_func2 = dNdptFit(pt,func2);
1722  AliDebug(2,Form("pt = %f, FONLL = %f, Pythia = %f, ratio = %f",pt,dndpt_func1,dndpt_func2,dndpt_func1/dndpt_func2));
1723  return dndpt_func1/dndpt_func2;
1724 }
1725 
1726 //__________________________________________________________________________________________________
1727 Double_t AliCFTaskVertexingHFCutVarFDSub::dNdptFit(Float_t pt, Double_t* par)
1728 {
1729  //
1730  // calculating dNdpt
1731  //
1732 
1733  Double_t denom = TMath::Power((pt/par[1]), par[3] );
1734  Double_t dNdpt = par[0]*pt/TMath::Power(1.+denom, par[2]);
1735 
1736  return dNdpt;
1737 }
1738 
1739 //_________________________________________________________________________
1741 {
1742  //
1743  // Using an histogram as weight function
1744  // weight = 0 in the range outside the function
1745  //
1746  Double_t weight = 0.0;
1747  Int_t histoNbins = fHistoPtWeight->GetNbinsX();
1748  Int_t histobin = fHistoPtWeight->FindBin(pt);
1749  if( (histobin>0) && (histobin<=histoNbins) ) {
1750  weight = fHistoPtWeight->GetBinContent(histobin);
1751  }
1752 
1753  return weight;
1754 }
1755 
1756 //_________________________________________________________________________
1758 {
1759  //
1762  //
1763  Double_t weight = 0.0;
1764  Int_t histoNbins = fHistoMotherPtWeight->GetNbinsX();
1765  Int_t histobin = fHistoMotherPtWeight->FindBin(motherPt);
1766  if( (histobin>0) && (histobin<=histoNbins) ) {
1767  weight = fHistoMotherPtWeight->GetBinContent(histobin);
1768  }
1769 
1770  return weight;
1771 }
1772 
1773 //_________________________________________________________________________
1775 {
1776  //
1778  //
1779  Double_t motherPt = -1.;
1780  Int_t labDau0=((AliAODTrack*)charmCandidate->GetDaughter(0))->GetLabel();
1781  if (labDau0<0) labDau0*=-1;
1782  AliAODMCParticle* firstDau=(AliAODMCParticle*)mcArray->UncheckedAt(labDau0);
1783  Int_t labMother=firstDau->GetMother();
1784  if (labMother<0) labMother*=-1;
1785  AliAODMCParticle* mother=(AliAODMCParticle*)mcArray->UncheckedAt(labMother);
1786  Int_t pdgMother=mother->GetPdgCode();
1787  while ((pdgMother%1000)/100==4 || (pdgMother%10000)/1000==4) {
1789  labMother=mother->GetMother();
1790  if (labMother<0) labMother*=-1;
1791  mother=(AliAODMCParticle*)mcArray->UncheckedAt(labMother);
1792  pdgMother=mother->GetPdgCode();
1793  }
1794  if ((pdgMother%1000)/100!=5 && (pdgMother%10000)/1000!=5) {
1795  AliDebug(3, "Found strange decay, expected the mother to be a beauty hadron!");
1796  }
1797  else {
1798  motherPt=mother->Pt();
1799  }
1800  return motherPt;
1801 }
1802 
1803 
1804 //__________________________________________________________________________________________________
1805 Double_t AliCFTaskVertexingHFCutVarFDSub::GetZWeight(Float_t z, Int_t runnumber){
1806  //
1807  // calculating the z-vtx weight for the given run range
1808  //
1809 
1810  if(runnumber>146824 || runnumber<146803) return 1.0;
1811 
1812  Double_t func1[3] = {1.0, -0.5, 6.5 };
1813  Double_t func2[3] = {1.0, -0.5, 5.5 };
1814 
1815  Double_t dzFunc1 = DodzFit(z,func1);
1816  Double_t dzFunc2 = DodzFit(z,func2);
1817 
1818  return dzFunc1/dzFunc2;
1819 }
1820 
1821 //__________________________________________________________________________________________________
1822 Double_t AliCFTaskVertexingHFCutVarFDSub::DodzFit(Float_t z, Double_t* par) {
1823 
1824  //
1825  // Gaussian z-vtx shape
1826  //
1827  //gaussian = [0]/TMath::Sqrt(2.*TMath::Pi())/[2]*exp[-(x-[1])*(x-[1])/(2*[2]*[2])]
1828 
1829  Double_t value = par[0]/TMath::Sqrt(2.*TMath::Pi())/par[2]*TMath::Exp(-(z-par[1])*(z-par[1])/2./par[2]/par[2]);
1830 
1831  return value;
1832 }
1833 //__________________________________________________________________________________________________
1835  //
1836  // calculates the Nch weight using the measured and generateed Nch distributions
1837  //
1838  if(nch<=0) return 0.;
1839  if(!fHistoMeasNch || !fHistoMCNch) { AliError("Input histos to evaluate Nch weights missing"); return 0.; }
1840  Double_t pMeas=fHistoMeasNch->GetBinContent(fHistoMeasNch->FindBin(nch));
1841  Double_t pMC=fHistoMCNch->GetBinContent(fHistoMCNch->FindBin(nch));
1842  Double_t weight = pMC>0 ? pMeas/pMC : 0.;
1843  if(fUseMultRatioAsWeight) weight = pMC;
1844  return weight;
1845 }
1846 //__________________________________________________________________________________________________
1848  // creates historgam with measured multiplcity distribution in pp 7 TeV collisions (from Eur. Phys. J. C (2010) 68: 345–354)
1849  //
1850  // for Nch > 70 the points were obtained with a double NBD distribution fit
1851  // TF1 *fit1 = new TF1("fit1","[0]*(TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1])))*(TMath::Power(([2]/[1]),x))*(TMath::Power((1+([2]/[1])),-x-[1]))"); fit1->SetParameter(0,1.);// normalization constant
1852  // fit1->SetParameter(1,1.63); // k parameter
1853  // fit1->SetParameter(2,12.8); // mean multiplicity
1854  //
1855  Double_t nchbins[82]={0.50,1.50,2.50,3.50,4.50,5.50,6.50,7.50,8.50,9.50,
1856  10.50,11.50,12.50,13.50,14.50,15.50,16.50,17.50,18.50,19.50,
1857  20.50,21.50,22.50,23.50,24.50,25.50,26.50,27.50,28.50,29.50,
1858  30.50,31.50,32.50,33.50,34.50,35.50,36.50,37.50,38.50,39.50,
1859  40.50,41.50,42.50,43.50,44.50,45.50,46.50,47.50,48.50,49.50,
1860  50.50,51.50,52.50,53.50,54.50,55.50,56.50,57.50,58.50,59.50,
1861  60.50,62.50,64.50,66.50,68.50,70.50,72.50,74.50,76.50,78.50,
1862  80.50,82.50,84.50,86.50,88.50,90.50,92.50,94.50,96.50,98.50,
1863  100.50,102.50};
1864  Double_t pch[81]={0.062011,0.072943,0.070771,0.067245,0.062834,0.057383,0.051499,0.04591,0.041109,0.036954,
1865  0.03359,0.030729,0.028539,0.026575,0.024653,0.0229,0.021325,0.019768,0.018561,0.017187,
1866  0.01604,0.014836,0.013726,0.012576,0.011481,0.010393,0.009502,0.008776,0.008024,0.007452,
1867  0.006851,0.006428,0.00594,0.005515,0.005102,0.00469,0.004162,0.003811,0.003389,0.003071,
1868  0.002708,0.002422,0.002184,0.001968,0.00186,0.00165,0.001577,0.001387,0.001254,0.001118,
1869  0.001037,0.000942,0.000823,0.000736,0.000654,0.000579,0.000512,0.00049,0.00045,0.000355,
1870  0.000296,0.000265,0.000193,0.00016,0.000126,0.0000851, 0.0000676,0.0000537,0.0000426, 0.0000338,
1871  0.0000268,0.0000213,0.0000166,0.0000133,0.0000106,0.00000837,0.00000662, 0.00000524,0.00000414, 0.00000327,
1872  0.00000258};
1873 
1874  if(fHistoMeasNch) delete fHistoMeasNch;
1875  fHistoMeasNch=new TH1F("hMeaseNch","",81,nchbins);
1876  for(Int_t i=0; i<81; i++){
1877  fHistoMeasNch->SetBinContent(i+1,pch[i]);
1878  fHistoMeasNch->SetBinError(i+1,0.);
1879  }
1880 }
1881 
1882 //__________________________________________________________________________________________________
1883 Bool_t AliCFTaskVertexingHFCutVarFDSub::ProcessDs(Int_t recoAnalysisCuts) const{
1884  // processes output of Ds is selected
1885  Bool_t keep=kFALSE;
1886  if(recoAnalysisCuts > 0){
1887  Int_t isKKpi=recoAnalysisCuts&1;
1888  Int_t ispiKK=recoAnalysisCuts&2;
1889  Int_t isPhiKKpi=recoAnalysisCuts&4;
1890  Int_t isPhipiKK=recoAnalysisCuts&8;
1891  Int_t isK0starKKpi=recoAnalysisCuts&16;
1892  Int_t isK0starpiKK=recoAnalysisCuts&32;
1893  if(fDsOption==1){
1894  if(isKKpi && isPhiKKpi) keep=kTRUE;
1895  if(ispiKK && isPhipiKK) keep=kTRUE;
1896  }
1897  else if(fDsOption==2){
1898  if(isKKpi && isK0starKKpi) keep=kTRUE;
1899  if(ispiKK && isK0starpiKK) keep=kTRUE;
1900  }
1901  else if(fDsOption==3)keep=kTRUE;
1902  }
1903  return keep;
1904 }
1905 //__________________________________________________________________________________________________
1906 Bool_t AliCFTaskVertexingHFCutVarFDSub::ProcessLctoV0Bachelor(Int_t recoAnalysisCuts) const{
1907  // processes output of Lc->V0+bnachelor is selected
1908  Bool_t keep=kFALSE;
1909  if(recoAnalysisCuts > 0){
1910 
1911  Int_t isK0Sp = recoAnalysisCuts&1;
1912  Int_t isLambdaBarpi = recoAnalysisCuts&2;
1913  Int_t isLambdapi = recoAnalysisCuts&4;
1914 
1915  if(fLctoV0bachelorOption==1){
1916  if(isK0Sp) keep=kTRUE;
1917  }
1918  else if(fLctoV0bachelorOption==2){
1919  if(isLambdaBarpi) keep=kTRUE;
1920  }
1921  else if(fLctoV0bachelorOption==4){
1922  if(isLambdapi) keep=kTRUE;
1923  }
1924  else if(fLctoV0bachelorOption==7) {
1925  if (isK0Sp || isLambdaBarpi || isLambdapi) keep=kTRUE;
1926  }
1927  }
1928  return keep;
1929 }
1930 
1931 //____________________________________________________________________________
1933  // Get Estimator Histogram from period event->GetRunNumber();
1934  //
1935  // If you select SPD tracklets in |eta|<1 you should use type == 1
1936  //
1937 
1938  Int_t runNo = event->GetRunNumber();
1939  Int_t period = -1; // pp: 0-LHC10b, 1-LHC10c, 2-LHC10d, 3-LHC10e
1940  // pPb: 0-LHC13b, 1-LHC13c
1941 
1942  if (fIsPPbData) { // setting run numbers for LHC13 if pPb
1943  if (runNo>195343 && runNo<195484) period = 0;
1944  if (runNo>195528 && runNo<195678) period = 1;
1945  if (period<0 || period>1) return 0;
1946  } else { //else assume pp 2010
1947  if(runNo>114930 && runNo<117223) period = 0;
1948  if(runNo>119158 && runNo<120830) period = 1;
1949  if(runNo>122373 && runNo<126438) period = 2;
1950  if(runNo>127711 && runNo<130841) period = 3;
1951  if(period<0 || period>3) return 0;
1952  }
1953 
1954  return fMultEstimatorAvg[period];
1955 }
Int_t fNvar
flag to use directly the ratio of the distributions (fHistoMCNch) instead of computing it ...
void SetCentralityValue(Float_t centValue)
Bool_t fAcceptanceUnf
flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty ...
virtual AliESDtrackCuts * GetTrackCutsV0daughters() const
Definition: AliRDHFCuts.h:247
void SetFillFromGenerated(Bool_t flag)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Bool_t fRejectIfNoQuark
selection flag for fakes tracks
Int_t fCountRecoAcc
Reco particle found that satisfy cuts.
virtual AliESDtrackCuts * GetTrackCutsSoftPi() const
Definition: AliRDHFCuts.h:246
void SetUseMCVertex()
Definition: AliRDHFCuts.h:336
Bool_t fFillFromGenerated
decay channel to configure the task
Int_t MCcquarkCounting(AliAODMCParticle *mcPart) const
UShort_t fOriginDselection
flag to indicate whether data container should be filled with generated values also for reconstructed...
Bool_t fUseFlatPtWeight
weight used to fill the container
Class for HF corrections as a function of many variables and steps For D* and other cascades...
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Bool_t HasSelectionBit(Int_t i) const
Class for HF corrections as a function of many variables and step.
Bool_t fIsPPData
flag to use the z-vtx corrected (if not use uncorrected) multiplicity estimator
AliHFsubtractBFDcuts * fObjSpr
cut on momentum conservation
Bool_t FillRecoContainer(Double_t *containerInput)
Double_t fWeight
flag to decide whether to use pt-weights != 1 when filling the container or not
Double_t GetMotherPtFromRecoDecay(AliAODRecoDecayHF *charmCandidate, TClonesArray *mcArray)
Int_t fConfiguration
Ds decay option (generation level)
THnSparseF * GetSparseMC() const
void SetNVar(Int_t nVar)
Int_t fCountRecoITSClusters
Reco particle found that satisfy cuts in requested acceptance.
Bool_t fIsPPbData
flag for pp data (not checking centrality)
Double_t dNdptFit(Float_t pt, Double_t *par)
Class for storing and handling D0 meson candidates properties // for estimating the feed-down fractio...
void SetRejectCandidateIfNotFromQuark(Bool_t opt)
virtual Bool_t SetLabelArray()
void FillSparses(AliAODRecoDecayHF2Prong *dzeroPart, Int_t isSelected, Double_t pt=-1, Double_t massD0=-1, Double_t massD0bar=-1, Double_t weight=1., TClonesArray *mcArray=0x0, AliAODEvent *aodEvent=0x0)
Bool_t fCentralitySelection
flag to decide wheter to keep D0 only (0), D0bar only (1), or both D0 and D0bar (2) ...
UInt_t fPDGcode
flag to use selection bit
Bool_t fUseMCVertex
flag to remove events not geenrated with PYTHIA
Int_t GetNProngs() const
TH1F * fHistoMCNch
histogram with measured Nch distribution (pp 7 TeV)
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
Double_t GetMotherPtWeightFromHistogram(Float_t motherPt)
void SetFillMC(Bool_t fillMC=kTRUE)
Int_t fCountMC
list of profile histos for z-vtx correction
AliCFTaskVertexingHFCutVarFDSub()
multiplicity estimators
TH1F * fHistoMeasNch
user-defined histogram to calculate the Mother Pt weights
TH1F * fHistoPtWeight
user-defined function to be used to calculate weights
Class for cuts on AOD reconstructed D+->Kpipi.
TF1 * fFuncWeight
configuration (slow / fast) of the CF –> different variables will be allocated (all / reduced number)...
TH1F * fhBptCutVar
Generator level histogram D0 pt, Nprongs of the decay, Mother pt.
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
Int_t fCountReco
Reco particle found that satisfy kTPCrefit and kITSrefit.
void FillGenStep(AliAODMCParticle *dzeroMC, Double_t pt=-1, Double_t weight=1., TClonesArray *mcArray=0x0)
Bool_t ProcessDs(Int_t returnCodeDs) const
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:51
THnSparseF * GetSparseMCgen() const
Bool_t fUseAdditionalCuts
flag for pPb data (used for multiplicity corrections)
Bool_t fUseMultRatioAsWeight
flag to decide whether to use Ncharged weights != 1 when filling the container or not ...
Int_t fGenLctoV0bachelorOption
Lc->V0+bachelor decay option (selection level)
TH1F * fHistoMotherPtWeight
user-defined histogram to calculate the Pt weights
Bool_t fUseTrackletsWeight
flag to decide whether to use Ncharged weights != 1 when filling the container or not ...
Double_t DodzFit(Float_t z, Double_t *par)
AliAODVertex * GetOwnPrimaryVtx() const
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:245
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:242
Int_t fLctoV0bachelorOption
resonant deacy channel to be used if the CF should be run on resonant channels only ...
void SetFakeSelection(Int_t fakeSel)
Bool_t fUseSelectionBit
Lc->V0+bachelor decay option (generation level)
Bool_t fZvtxCorrectedNtrkEstimator
refrence multiplcity (period b)
Int_t fCountRefit
Reco particle found that satisfy vertex constrained.
Double_t fRefMult
TProfile with mult vas. Z per period.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:52
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
void SetRecoPrimVertex(Double_t zPrimVertex)
Double_t GetZWeight(Float_t z, Int_t runnumber)
TList * fQAHists
List with B hadron decays (unique entries)
void SetMCCandidateParam(Int_t label)
TH1I * fHistEventsProcessed
pointer to the CF manager
Int_t fCountRecoPPR
Reco particle found that satisfy cuts in n. of ITS clusters.
Bool_t CheckMCPartFamily(AliAODMCParticle *, TClonesArray *) const
Bool_t fUseCutsForTMVA
flag to use additional cuts needed for Lc –> K0S + p, TMVA
virtual Bool_t SetRecoCandidateParam(AliAODRecoDecayHF *)
static Double_t GetCorrectedNtracklets(TProfile *estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult)
Int_t CheckReflexion(Char_t isSign)
Bool_t IsEventSelected(AliVEvent *event)
Bool_t fUseMotherPtWeight
flag to decide whether to use pt-weights != 1 when filling the container or not
Bool_t fUseZWeight
flag to decide to use a flat pt shape
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:204
virtual void PrintAll() const
AliCFTaskVertexingHFCutVarFDSub & operator=(const AliCFTaskVertexingHFCutVarFDSub &c)
Bool_t fUseNchWeight
flag to decide whether to use z-vtx weights != 1 when filling the container or not ...
Bool_t RecoAcceptStep(AliESDtrackCuts **trackCuts) const
TList * fListProfiles
response matrix for unfolding
THnSparseF * fTHnAnalysis
object for cut variation study
static Int_t GetGeneratedPhysicalPrimariesInEtaRange(TClonesArray *arrayMC, Double_t mineta, Double_t maxeta)
Bool_t IsSelected(TObject *obj)
Definition: AliRDHFCuts.h:273
TProfile * fMultEstimatorAvg[4]
Definition of the multiplicity estimator: kNtrk10=0, kNtrk10to16=1, kVZERO=2.
Bool_t MCRefitStep(AliAODEvent *aodEvent, AliESDtrackCuts **trackCuts) const
Int_t fFakeSelection
flag to switch off the centrality selection
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:253
UInt_t fResonantDecay
histogram with Nch distribution from MC production
Float_t fCutOnMomConservation
flag to define which task to use for Lc –> K0S+p
AliRDHFCuts * fCuts
flag for unfolding before or after cuts.
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:192
Class to compute variables for correction framework // for 3-body decays of D mesons (D+...
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Definition: AliRDHFCuts.h:290
TProfile * GetEstimatorHistogram(const AliVEvent *event)
void SetConfiguration(Int_t configuration)
void SetMultiplicity(Double_t multiplicity)
Int_t fGenDsOption
Ds decay option (selection level)
void SetMCPrimaryVertex(Double_t zMCVertex)
Int_t fCountRecoPID
Reco particle found that satisfy cuts in PPR.
Int_t fDsOption
flag to use MC vertex (useful when runnign in pp)
void UserCreateOutputObjects()
ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects.
Bool_t ProcessLctoV0Bachelor(Int_t returnCodeDs) const
TString fPartName
number of variables for the container
Class for HF corrections as a function of many variables and step.
Int_t fCountVertex
MC particle found that satisfy acceptance cuts.