AliPhysics  6cf2591 (6cf2591)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEDmesonsFilterCJ.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 // Task for selecting D mesons to be used as an input for D-Jet correlations
18 //
19 //-----------------------------------------------------------------------
20 // Authors:
21 // C. Bianchin (Utrecht University) chiara.bianchin@cern.ch
22 // A. Grelli (Utrecht University) a.grelli@uu.nl
23 // X. Zhang (LBNL) XMZhang@lbl.gov
24 // S. Aiola (Yale University) salvatore.aiola@cern.ch
25 // S. Antônio (University of São Paulo / Utrecht University) antonio.silva@cern.ch
26 //-----------------------------------------------------------------------
27 
28 #include <TDatabasePDG.h>
29 #include <TParticle.h>
30 #include <TVector3.h>
31 #include <TROOT.h>
32 #include <TH3F.h>
33 
34 #include "AliLog.h"
36 #include "AliRDHFCutsD0toKpi.h"
37 #include "AliAODMCHeader.h"
38 #include "AliAODHandler.h"
39 #include "AliAnalysisManager.h"
40 #include "AliLog.h"
41 #include "AliAODVertex.h"
42 #include "AliAODRecoCascadeHF.h"
44 #include "AliESDtrack.h"
45 #include "AliAODMCParticle.h"
46 #include "AliEmcalParticle.h"
47 #include "AliParticleContainer.h"
48 #include "AliAnalysisDataSlot.h"
49 #include "AliAnalysisDataContainer.h"
50 #include "AliStack.h"
51 #include "AliAnalysisVertexingHF.h"
52 
54 
56 
57 //_______________________________________________________________________________
60  fUseMCInfo(kFALSE),
61  fUseReco(kTRUE),
62  fCandidateType(0),
63  fCandidateName(""),
64  fPDGmother(0),
65  fNProngs(0),
66  fBranchName(""),
67  fCuts(0),
68  fMinMass(0.),
69  fMaxMass(0.),
70  fInhibitTask(kFALSE),
71  fCombineDmesons(kFALSE),
72  fMultCand(kFALSE),
73  fAnalyseCand(0),
74  fRejectQuarkNotFound(kTRUE),
75  fRejectDfromB(kTRUE),
76  fKeepOnlyDfromB(kFALSE),
77  fAodEvent(0),
78  fArrayDStartoD0pi(0),
79  fMCarray(0),
80  fCandidateArray(0),
81  fSideBandArray(0),
82  fCombinedDmesons(0),
83  fCombinedDmesonsBkg(0),
84  fMCCombinedDmesons(0),
85  fNCand(0),
86  fNSBCand(0),
87  fHistStat(0),
88  fHistNSBCandEv(0),
89  fHistNCandEv(0),
90  fHistImpParS(0),
91  fHistImpParB(0),
92  fHistPtPion(0),
93  fHistInvMassPtD(0),
94  fHistInvMassS(0),
95  fHistInvMassB(0),
96  fHistAlphaDDS(0),
97  fHistAlphaDpisS(0),
98  fHistAlphaDpiS(0),
99  fHistAlphaDKS(0),
100  fHistAlphaDDB(0),
101  fHistAlphaDpisB(0),
102  fHistAlphaDpiB(0),
103  fHistAlphaDKB(0),
104  fHistDeltaRDDS(0),
105  fHistDeltaRDpisS(0),
106  fHistDeltaRDpiS(0),
107  fHistDeltaRDKS(0),
108  fHistDeltaRDDB(0),
109  fHistDeltaRDpisB(0),
110  fHistDeltaRDpiB(0),
111  fHistDeltaRDKB(0),
112  fHistAlphaDpiR(0),
113  fHistAlphaDKR(0),
114  fHistDeltaRDpiR(0),
115  fHistDeltaRDKR(0)
116 {
117  //
118  // Default constructor
119  //
120 
121  for (Int_t i=4; i--;) fPDGdaughters[i] = 0;
122  for (Int_t i=30; i--;) fSigmaD0[i] = 0.;
123 
124  fNeedEmcalGeom = kFALSE;
125 }
126 
127 //_______________________________________________________________________________
129  AliAnalysisTaskEmcal(name, kTRUE),
130  fUseMCInfo(kFALSE),
131  fUseReco(kTRUE),
132  fCandidateType(candtype),
133  fCandidateName(""),
134  fPDGmother(0),
135  fNProngs(0),
136  fBranchName(""),
137  fCuts(cuts),
138  fMinMass(0.),
139  fMaxMass(0.),
140  fInhibitTask(kFALSE),
141  fCombineDmesons(kFALSE),
142  fMultCand(kFALSE),
143  fAnalyseCand(0),
144  fRejectQuarkNotFound(kTRUE),
145  fRejectDfromB(kTRUE),
146  fKeepOnlyDfromB(kFALSE),
147  fAodEvent(0),
148  fArrayDStartoD0pi(0),
149  fMCarray(0),
150  fCandidateArray(0),
151  fSideBandArray(0),
152  fCombinedDmesons(0),
153  fCombinedDmesonsBkg(0),
154  fMCCombinedDmesons(0),
155  fNCand(0),
156  fNSBCand(0),
157  fHistStat(0),
158  fHistNSBCandEv(0),
159  fHistNCandEv(0),
160  fHistImpParS(0),
161  fHistImpParB(0),
162  fHistPtPion(0),
163  fHistInvMassPtD(0),
164  fHistInvMassS(0),
165  fHistInvMassB(0),
166  fHistAlphaDDS(0),
167  fHistAlphaDpisS(0),
168  fHistAlphaDpiS(0),
169  fHistAlphaDKS(0),
170  fHistAlphaDDB(0),
171  fHistAlphaDpisB(0),
172  fHistAlphaDpiB(0),
173  fHistAlphaDKB(0),
174  fHistDeltaRDDS(0),
175  fHistDeltaRDpisS(0),
176  fHistDeltaRDpiS(0),
177  fHistDeltaRDKS(0),
178  fHistDeltaRDDB(0),
179  fHistDeltaRDpisB(0),
180  fHistDeltaRDpiB(0),
181  fHistDeltaRDKB(0),
182  fHistAlphaDpiR(0),
183  fHistAlphaDKR(0),
184  fHistDeltaRDpiR(0),
185  fHistDeltaRDKR(0)
186 {
187  //
188  // Constructor. Initialization of Inputs and Outputs
189  //
190 
191  Info("AliAnalysisTaskSEDmesonsFilterCJ","Calling Constructor");
192 
193  fNeedEmcalGeom = kFALSE;
194 
195  for (Int_t i=4; i--;) fPDGdaughters[i] = 0;
196  for (Int_t i=30; i--;) fSigmaD0[i] = 0.;
197 
198  const Int_t nptbins = fCuts->GetNPtBins();
199  Float_t defaultSigmaD013[13] = { 0.012, 0.012, 0.012, 0.015, 0.015, 0.018, 0.018, 0.020, 0.020, 0.030, 0.030, 0.037, 0.040 };
200 
201  switch (fCandidateType) {
202  case 0 :
203  fCandidateName = "D0";
204  fPDGmother = 421;
205  fNProngs = 2;
206  fPDGdaughters[0] = 211; // pi
207  fPDGdaughters[1] = 321; // K
208  fPDGdaughters[2] = 0; // empty
209  fPDGdaughters[3] = 0; // empty
210  fBranchName = "D0toKpi";
211  break;
212  case 1 :
213  fCandidateName = "DStar";
214  fPDGmother = 413;
215  fNProngs = 3;
216  fPDGdaughters[1] = 211; // pi soft
217  fPDGdaughters[0] = 421; // D0
218  fPDGdaughters[2] = 211; // pi fromD0
219  fPDGdaughters[3] = 321; // K from D0
220  fBranchName = "Dstar";
221 
222  if (nptbins<=13) {
223  for (Int_t ipt=0; ipt<nptbins;ipt++) fSigmaD0[ipt] = defaultSigmaD013[ipt];
224  }
225  else {
226  AliFatal(Form("Default sigma D0 not enough for %d pt bins, use SetSigmaD0ForDStar to set them",nptbins));
227  }
228  break;
229  default :
230  Warning("AliAnalysisTaskSEDmesonsFilterCJ", "%d not accepted!!", fCandidateType);
231  break;
232  }
233 
236 
237  DefineOutput(1, TList::Class()); // histos
238  DefineOutput(2, AliRDHFCuts::Class()); // my cuts
239  DefineOutput(3, TClonesArray::Class()); //array of candidates
240  DefineOutput(4, TClonesArray::Class()); //array of SB candidates
241  DefineOutput(5, TClonesArray::Class()); //array of candidates and event tracks
242  DefineOutput(6, TClonesArray::Class()); //array of SB candidates and event tracks
243  DefineOutput(7, TClonesArray::Class()); //array of MC D and event MC particles
244 }
245 
246 //_______________________________________________________________________________
248 {
249  //
250  // Destructor
251  //
252 
253  Info("~AliAnalysisTaskSEDmesonsFilterCJ","Calling Destructor");
254 
255  if (fCuts) {
256  delete fCuts;
257  fCuts = 0;
258  }
259 
260  if (fCandidateArray) {
261  delete fCandidateArray;
262  fCandidateArray = 0;
263  }
264 
265  if (fSideBandArray) {
266  delete fSideBandArray;
267  fSideBandArray = 0;
268  }
269 
270  if (fCombinedDmesons) {
271  delete fCombinedDmesons;
272  fCombinedDmesons = 0;
273  delete fMCCombinedDmesons;
274  fMCCombinedDmesons = 0;
275  }
276 
277  if (fCombinedDmesonsBkg) {
278  delete fCombinedDmesonsBkg;
280  }
281 }
282 
283 //_______________________________________________________________________________
285 {
286  //
287  // Initialization
288  //
289 
290  Info("AnalysisTaskSEDmesonsForJetCorrelations::Init()", "Entering method");
291 
292  switch (fCandidateType) {
293  case 0:
294  {
295  AliRDHFCutsD0toKpi* copyfCutsDzero = new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
296  copyfCutsDzero->SetName("AnalysisCutsDzero");
297  PostData(2, copyfCutsDzero); // Post the data
298  } break;
299  case 1:
300  {
301  AliRDHFCutsDStartoKpipi* copyfCutsDstar = new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
302  copyfCutsDstar->SetName("AnalysisCutsDStar");
303  PostData(2, copyfCutsDstar); // Post the cuts
304  } break;
305  default:
306  return;
307  }
308 
309  return;
310 }
311 
312 //_______________________________________________________________________________
314 {
315  //
316  // Create output objects
317  //
318 
319  Info("UserCreateOutputObjects","CreateOutputObjects of task %s", GetName());
320 
322 
323  DefineHistoForAnalysis(); // define histograms
324 
325  if (fUseReco) {
326  if (fCandidateType == kD0toKpi){
327  fCandidateArray = new TClonesArray("AliAODRecoDecayHF2Prong",10);
328  fSideBandArray = new TClonesArray("AliAODRecoDecayHF2Prong",10);
329  }
330  else if (fCandidateType == kDstartoKpipi) {
331  fCandidateArray = new TClonesArray("AliAODRecoCascadeHF",10);
332  fSideBandArray = new TClonesArray("AliAODRecoCascadeHF",10);
333  }
334  else {
335  AliWarning(Form("Candidate type %d not recognized!", fCandidateType));
336  return;
337  }
338  }
339  else {
340  fCandidateArray = new TClonesArray("AliAODMCParticle",10);
341  fSideBandArray = new TClonesArray("TObject",0); // not used
342  }
343 
344  if (fCombineDmesons) {
345  fCombinedDmesons = new TClonesArray("AliEmcalParticle",50);
346  fCombinedDmesonsBkg = new TClonesArray("AliEmcalParticle",50);
347  fMCCombinedDmesons = new TClonesArray("AliAODMCParticle",50);
348  }
349  else {
350  fCombinedDmesons = new TClonesArray("TObject",0); // not used
351  fCombinedDmesonsBkg = new TClonesArray("TObject",0); // not used
352  fMCCombinedDmesons = new TClonesArray("TObject",0); // not used
353  }
354 
355  fCandidateArray->SetOwner();
356  fCandidateArray->SetName(GetOutputSlot(3)->GetContainer()->GetName());
357 
358  //this is used for the DStar side bands and MC!
359  fSideBandArray->SetOwner();
360  fSideBandArray->SetName(GetOutputSlot(4)->GetContainer()->GetName());
361 
362  fCombinedDmesons->SetOwner();
363  fCombinedDmesons->SetName(GetOutputSlot(5)->GetContainer()->GetName());
364 
365  fCombinedDmesonsBkg->SetOwner();
366  fCombinedDmesonsBkg->SetName(GetOutputSlot(6)->GetContainer()->GetName());
367 
368  fMCCombinedDmesons->SetOwner();
369  fMCCombinedDmesons->SetName(GetOutputSlot(7)->GetContainer()->GetName());
370 
371  PostData(1, fOutput);
372  PostData(3, fCandidateArray);
373  PostData(4, fSideBandArray);
374  PostData(5, fCombinedDmesons);
375  PostData(6, fCombinedDmesonsBkg);
376  PostData(7, fMCCombinedDmesons);
377 
378  Info("UserCreateOutputObjects","Data posted for task %s", GetName());
379 }
380 
381 //_______________________________________________________________________________
383 {
384  //
385  // To be executed only once, for the first event
386  //
387 
388  AliDebug(2, "Entering ExecOnce()");
389 
390  if (fInhibitTask) return;
391 
392  // Load the event
393  fAodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
394 
395  if (fAodEvent) {
396  fArrayDStartoD0pi = dynamic_cast<TClonesArray*>(fAodEvent->GetList()->FindObject(fBranchName.Data()));
397  }
398  else {
399  if (AODEvent() && IsStandardAOD()) {
400 
401  // In case there is an AOD handler writing a standard AOD, use the AOD
402  // event in memory rather than the input (ESD) event.
403  fAodEvent = dynamic_cast<AliAODEvent*>(AODEvent());
404 
405  // in this case the branches in the deltaAOD (AliAOD.VertexingHF.root)
406  // have to taken from the AOD event hold by the AliAODExtension
407  AliAODHandler *aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
408  if(aodHandler->GetExtensions()) {
409  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
410  AliAODEvent *aodFromExt = ext->GetAOD();
411  fArrayDStartoD0pi = (TClonesArray*)aodFromExt->GetList()->FindObject(fBranchName.Data());
412  }
413  else {
414  AliError(Form("This task need an AOD event! Task '%s' will be disabled!", GetName()));
415  fInhibitTask = kTRUE;
416  return;
417  }
418  }
419  }
420 
421  if (fArrayDStartoD0pi) {
422  TString objname(fArrayDStartoD0pi->GetClass()->GetName());
423  TClass cls(objname);
424  if (!cls.InheritsFrom("AliAODRecoDecayHF2Prong")) {
425  AliError(Form("%s: Objects of type %s in %s are not inherited from AliAODRecoDecayHF2Prong! Task will be disabled!",
426  GetName(), cls.GetName(), fArrayDStartoD0pi->GetName()));
427  fInhibitTask = kTRUE;
428  fArrayDStartoD0pi = 0;
429  return;
430  }
431  }
432  else {
433  AliError(Form("Could not find array %s, skipping the event. Task '%s' will be disabled!", fBranchName.Data(), GetName()));
434  fInhibitTask = kTRUE;
435  return;
436  }
437 
438  if (fUseMCInfo) {
439  fMCarray = dynamic_cast<TClonesArray*>(fAodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
440  if (!fMCarray) {
441  AliError(Form("MC particles not found! Task '%s' will be disabled!", GetName()));
442  fInhibitTask = kTRUE;
443  return;
444  }
445  }
446 
447  if (fCombineDmesons) {
451  }
452 
454 }
455 
456 //_______________________________________________________________________________
458 {
459  //
460  // Analysis execution
461  //
462 
463  if (fInhibitTask) return kFALSE;
464 
465  Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
466  if (matchingAODdeltaAODlevel<=0) {
467  // AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
468  return kFALSE;
469  }
470 
471  AliDebug(2, "Entering Run()");
472 
473  //clear the TClonesArray from the previous event
474  fCandidateArray->Clear();
475  fSideBandArray->Clear();
476  fCombinedDmesons->Clear();
477  fCombinedDmesonsBkg->Clear();
478  AliDebug(2, "TClonesArray cleared");
479 
480  fHistStat->Fill(0);
481 
482  // fix for temporary bug in ESDfilter
483  // the AODs with null vertex pointer didn't pass the PhysSel
484  if (!fAodEvent->GetPrimaryVertex() || TMath::Abs(fAodEvent->GetMagneticField()) < 0.001) return kFALSE;
485 
486  //Event selection
487  Bool_t iseventselected = fCuts->IsEventSelected(fAodEvent);
488  if (!iseventselected) return kFALSE;
489  fHistStat->Fill(1);
490 
491  AliDebug(2, "Event selected");
492 
493  const Int_t nD = fArrayDStartoD0pi->GetEntriesFast();
494  AliDebug(2, Form("Found %d vertices", nD));
495  if (!fUseMCInfo) fHistStat->Fill(2, nD);
496 
497  Int_t pdgMeson = 413;
498  if (fCandidateType == kD0toKpi) pdgMeson = 421;
499 
500  fNCand = 0;
501  fNSBCand = 0;
502 
503  //Fill the vertex info of the candidates
505 
506  for (Int_t icharm = 0; icharm < nD; icharm++) { //loop over D candidates
507  Int_t isSelected = 0;
508 
509  AliAODRecoDecayHF2Prong* charmCand = static_cast<AliAODRecoDecayHF2Prong*>(fArrayDStartoD0pi->At(icharm)); // D candidates
510  if (!charmCand) continue;
511  if(!(vHF->FillRecoCand(fAodEvent,charmCand))) continue;
512 
513  Int_t nprongs = charmCand->GetNProngs();
514  AliDebug(2, Form("Candidate is %d, and nprongs = %d", fCandidateType, nprongs));
515 
516  AliAODRecoCascadeHF* dstar = 0;
517 
518  if (fCandidateType == kDstartoKpipi) {
519  dstar = dynamic_cast<AliAODRecoCascadeHF*>(charmCand);
520  if (!dstar) {
521  Error("AliAnalysisTaskSEDmesonsFilterCJ::UserExec","Candidate type is D* but object type is wrong (should be AliAODRecoCascadeHF)");
522  continue;
523  }
524  }
525 
526  // region of interest + cuts
527  if (!fCuts->IsInFiducialAcceptance(charmCand->Pt(), charmCand->Y(pdgMeson))) continue;
528 
530  FillDstarSideBands(dstar);
531  }
532 
533  //candidate selected by cuts and PID
534  isSelected = fCuts->IsSelected(charmCand, AliRDHFCuts::kAll, fAodEvent); //selected
535 
536  if (!isSelected) continue;
537 
538  if (fCandidateType == kDstartoKpipi) {
539  ProcessDstar(dstar, isSelected);
540  }
541  else {
542  ProcessD0(charmCand, isSelected);
543  }
544  } // end of D cand loop
545 
546  delete vHF;
547 
548  AliDebug(2, "Loop done");
549 
550  if (fCombineDmesons) {
551  if (fCombinedDmesons->GetEntriesFast() > 0) {
553  }
554 
555  if (fMCCombinedDmesons->GetEntriesFast() > 0) {
557  }
558 
559  if (fCombinedDmesonsBkg->GetEntriesFast() > 0) {
561  }
562  }
563 
564  fHistNCandEv->Fill(fCandidateArray->GetEntriesFast());
566  Int_t nsbcand = fSideBandArray->GetEntriesFast();
567  fHistStat->Fill(4, nsbcand);
568  fHistNSBCandEv->Fill(nsbcand);
569  }
570 
571  PostData(1, fOutput);
572  PostData(3, fCandidateArray);
573  PostData(4, fSideBandArray);
574  PostData(5, fCombinedDmesons);
575  PostData(6, fCombinedDmesonsBkg);
576  PostData(7, fMCCombinedDmesons);
577 
578  AliDebug(2, "Exiting method");
579 
580  return kTRUE;
581 }
582 
583 //_______________________________________________________________________________
585 {
586  // Process the D0 candidate.
587 
588  // For MC analysis look for the AOD MC particle associated with the charm candidate
589  AliAODMCParticle* charmPart = 0;
590  if (fUseMCInfo) {
591  Int_t mcLabel = charmCand->MatchToMC(421, fMCarray, fNProngs, fPDGdaughters);
592 
593  if (mcLabel >= 0) {
594  charmPart = static_cast<AliAODMCParticle*>(fMCarray->At(mcLabel));
595  }
596  }
597 
598  if (charmPart) {
599 
600  Int_t origin = CheckOrigin(charmPart, fMCarray);
601  if (origin < 0) return;
602 
603  if (fRejectQuarkNotFound && origin == kQuarkNotFound) {
604  fHistStat->Fill(6);
605  return;
606  }
607  if (fRejectDfromB && origin == kFromBottom) {
608  fHistStat->Fill(7);
609  return;
610  }
611  if (fKeepOnlyDfromB && origin != kFromBottom) {
612  fHistStat->Fill(8);
613  return;
614  }
615 
616  fHistStat->Fill(2);
617  }
618  else {
619  fHistStat->Fill(5);
620  }
621 
622  // For MC background fill fSideBandArray
623  if (fUseMCInfo && !charmPart) {
624  if (fUseReco) {
625  if(!fMultCand) new ((*fSideBandArray)[fNSBCand]) AliAODRecoDecayHF2Prong(*charmCand);
626  else if(fNSBCand==fAnalyseCand) new ((*fSideBandArray)[0]) AliAODRecoDecayHF2Prong(*charmCand);
627 
628  if (fCombineDmesons) {
629  if(!fMultCand) new ((*fCombinedDmesonsBkg)[fNSBCand]) AliEmcalParticle(charmCand);
630  else if(fNSBCand==fAnalyseCand) new ((*fCombinedDmesonsBkg)[0]) AliEmcalParticle(charmCand);
631  }
632 
633  fHistImpParB->Fill(charmCand->Getd0Prong(0), charmCand->PtProng(0));
634  fHistImpParB->Fill(charmCand->Getd0Prong(1), charmCand->PtProng(1));
635  fHistInvMassB->Fill(charmCand->InvMassD0());
636  fHistInvMassB->Fill(charmCand->InvMassD0bar());
637 
638  fNSBCand++;
639  }
640  }
641  // For data or MC signal fill fCandidateArray
642  else {
643  // For data or MC with the requirement fUseReco fill with candidates
644  if (fUseReco) {
645  if(!fMultCand) new ((*fCandidateArray)[fNCand]) AliAODRecoDecayHF2Prong(*charmCand);
646  else if(fNCand==fAnalyseCand) new ((*fCandidateArray)[0]) AliAODRecoDecayHF2Prong(*charmCand);
647 
648  if (fCombineDmesons) {
649  if(!fMultCand) new ((*fCombinedDmesons)[fNCand]) AliEmcalParticle(charmCand);
650  else if(fNCand==fAnalyseCand)
651  {
652  new ((*fCombinedDmesons)[0]) AliEmcalParticle(charmCand);
653  if(charmPart) new ((*fMCCombinedDmesons)[0]) AliAODMCParticle(*charmPart);
654  }
655  }
656 
657  fHistImpParS->Fill(charmCand->Getd0Prong(0), charmCand->PtProng(0));
658  fHistImpParS->Fill(charmCand->Getd0Prong(1), charmCand->PtProng(1));
659  fHistInvMassS->Fill(charmCand->InvMassD0());
660  fHistInvMassS->Fill(charmCand->InvMassD0bar());
661  }
662  // For MC with requirement particle level fill with AliAODMCParticle
663  else {
664  if(!fMultCand) new ((*fCandidateArray)[fNCand]) AliAODMCParticle(*charmPart);
665  else if(fNCand==fAnalyseCand) new ((*fCandidateArray)[0]) AliAODMCParticle(*charmPart);
666  }
667  fHistStat->Fill(3);
668  fNCand++;
669  }
670 
671  // Now filling some more histograms
672 
673  // mass vs pt
674  if (isSelected == 1 || isSelected == 3) fHistInvMassPtD->Fill(charmCand->InvMassD0(), charmCand->Pt());
675  if (isSelected >= 2) fHistInvMassPtD->Fill(charmCand->InvMassD0bar(), charmCand->Pt());
676 
677  if (fUseMCInfo) { //fill histograms of kinematics, using MC truth
678  Int_t isD0 = 0;
679  if (charmPart) {
680  Int_t pdgCode = charmPart->GetPdgCode();
681 
682  if (pdgCode == 421) {
683  isD0 = 1;
684  }
685  else if (pdgCode == -421) {
686  isD0 = -1;
687  }
688  else {
689  AliDebug(2, "Not a D0/D0bar meson!");
690  return;
691  }
692  }
693 
694  FillD0MCTruthKinHistos(charmCand, isSelected, isD0);
695  }
696 }
697 
698 //_______________________________________________________________________________
700 {
701  // Process the D* candidate.
702 
703  AliDebug(2, "Entering method");
704 
705  // For MC analysis look for the AOD MC particle associated with the charm candidate
706  AliAODMCParticle* charmPart = 0;
707  if (fUseMCInfo) {
708  //D* and D0 prongs needed to MatchToMC method
709  Int_t pdgDgDStartoD0pi[2] = { 421, 211 }; // D0,pi
710  Int_t pdgDgD0toKpi[2] = { 321, 211 }; // K, pi
711 
712  Int_t mcLabel = dstar->MatchToMC(413, 421, pdgDgDStartoD0pi, pdgDgD0toKpi, fMCarray);
713 
714  if (mcLabel >= 0) {
715  charmPart = static_cast<AliAODMCParticle*>(fMCarray->At(mcLabel));
716  }
717  }
718 
719  if (charmPart) {
720 
721  Int_t origin = CheckOrigin(charmPart, fMCarray);
722  if (origin < 0) return;
723 
724  if (fRejectQuarkNotFound && origin == kQuarkNotFound) {
725  fHistStat->Fill(6);
726  return;
727  }
728  if (fRejectDfromB && origin == kFromBottom) {
729  fHistStat->Fill(7);
730  return;
731  }
732  if (fKeepOnlyDfromB && origin != kFromBottom) {
733  fHistStat->Fill(8);
734  return;
735  }
736 
737  fHistStat->Fill(2);
738  }
739  else {
740  fHistStat->Fill(5);
741  }
742 
743  AliAODRecoDecayHF2Prong* D0fromDstar = dstar->Get2Prong();
744 
745  // For MC background fill fSideBandArray
746  if (fUseMCInfo && !charmPart) {
747  if (fUseReco) {
748  if(!fMultCand) new ((*fSideBandArray)[fNSBCand]) AliAODRecoCascadeHF(*dstar);
749  else if(fNSBCand==fAnalyseCand) new ((*fSideBandArray)[0]) AliAODRecoCascadeHF(*dstar);
750 
751  if (fCombineDmesons) {
752  if(!fMultCand) new ((*fCombinedDmesonsBkg)[fNSBCand]) AliEmcalParticle(dstar);
753  else if(fNSBCand==fAnalyseCand) new ((*fCombinedDmesonsBkg)[0]) AliEmcalParticle(dstar);
754  }
755 
756  fHistInvMassB->Fill(dstar->DeltaInvMass());
757  fHistImpParB->Fill(dstar->Getd0Prong(0), dstar->PtProng(0)); //bachelor
758  fHistImpParB->Fill(D0fromDstar->Getd0Prong(0), D0fromDstar->PtProng(0));
759  fHistImpParB->Fill(D0fromDstar->Getd0Prong(1), D0fromDstar->PtProng(1));
760 
761  fNSBCand++;
762  }
763  }
764  // For data and MC signal fill fCandidateArray
765  else {
766  // For data or MC signal with the requirement fUseReco fill with candidates
767  if (fUseReco) {
768  if(!fMultCand) new ((*fCandidateArray)[fNCand]) AliAODRecoCascadeHF(*dstar);
769  else if(fNCand==fAnalyseCand) new ((*fCandidateArray)[0]) AliAODRecoCascadeHF(*dstar);
770 
771  if (fCombineDmesons) {
772  if(!fMultCand) new ((*fCombinedDmesons)[fNCand]) AliEmcalParticle(dstar);
773  else if(fNCand==fAnalyseCand)
774  {
775  new ((*fCombinedDmesons)[0]) AliEmcalParticle(dstar);
776  if(charmPart) new ((*fMCCombinedDmesons)[0]) AliAODMCParticle(*charmPart);
777  }
778  }
779  }
780  // For MC signal with requirement particle level fill with AliAODMCParticle
781  else {
782  if(!fMultCand) new ((*fCandidateArray)[fNCand]) AliAODMCParticle(*charmPart);
783  else if(fNCand==fAnalyseCand) new ((*fCandidateArray)[0]) AliAODMCParticle(*charmPart);
784  }
785  fNCand++;
786 
787  fHistInvMassS->Fill(dstar->DeltaInvMass());
788  fHistImpParS->Fill(dstar->Getd0Prong(0), dstar->PtProng(0)); //bachelor
789  fHistImpParS->Fill(D0fromDstar->Getd0Prong(0), D0fromDstar->PtProng(0));
790  fHistImpParS->Fill(D0fromDstar->Getd0Prong(1), D0fromDstar->PtProng(1));
791  fHistStat->Fill(3);
792  }
793 
794  // Now filling some more histograms.
795 
796  // select D* in the D0 window.
797  // In the cut object window is loose to allow for side bands
798 
799  // retrieve the corresponding pt bin for the candidate
800  // and set the expected D0 width (x3)
801 
802  Double_t mPDGD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
803  Double_t mPDGDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
804  Double_t invMassPDG = mPDGDstar - mPDGD0;
805 
806  Double_t ptD = dstar->Pt();
807  Int_t ptDbin = fCuts->PtBin(ptD);
808  if (ptDbin < 0 || ptDbin >= fCuts->GetNPtBins()) {
809  AliError(Form("Pt %.3f out of bounds", ptD));
810  return;
811  }
812 
813  AliDebug(1, Form("Pt bin %d and sigma D0 %.4f", ptDbin, fSigmaD0[ptDbin]));
814  //consider the D* candidates only if the mass of the D0 is in 3 sigma wrt the PDG value
815  if ((dstar->InvMassD0()>=(mPDGD0-3.*fSigmaD0[ptDbin])) && (dstar->InvMassD0()<=(mPDGD0+3.*fSigmaD0[ptDbin]))) {
816  AliDebug(2, "D0 mass within 3 sigma");
817 
818  // D* delta mass
819  AliDebug(2, "Filling invariant mass vs pt histogram");
820  fHistInvMassPtD->Fill(dstar->DeltaInvMass(), ptD); // 2 D slice for pt bins
821 
822  // Soft pion pt for good candidates
823  Double_t invmassDelta = dstar->DeltaInvMass();
824  if (TMath::Abs(invmassDelta - invMassPDG) < 0.0021) {
825  AliDebug(2, "Filling pion pt histogram");
826  //softpion from D* decay
827  AliAODTrack *softPionTrack = static_cast<AliAODTrack*>(dstar->GetBachelor());
828  if (softPionTrack) fHistPtPion->Fill(softPionTrack->Pt());
829  }
830  }
831 
832  if (fUseMCInfo) { //fill histograms of kinematics, using MC truth
833  Int_t isDstar = charmPart == NULL ? 0 : 1;
834  FillDStarMCTruthKinHistos(dstar, isDstar, isSelected);
835  }
836 
837  AliDebug(2, "Exiting method");
838 }
839 
840 //_______________________________________________________________________________
842 {
843  // Fill some histogram with kinematic information of the D0 candidate.
844 
845  Double_t ptD = charmCand->Pt();
846  Double_t aD = charmCand->Phi();
847  Double_t adaugh[2] = {charmCand->PhiProng(0), charmCand->PhiProng(1)};
848  AliAODTrack* p0 = static_cast<AliAODTrack*>(charmCand->GetDaughter(0));
849  AliAODTrack* p1 = static_cast<AliAODTrack*>(charmCand->GetDaughter(1));
850  Float_t dR0 = DeltaR(charmCand, p0);
851  Float_t dR1 = DeltaR(charmCand, p1);
852 
853  if (isD0 == 0) { //background
854  if (isSelected == 1 || isSelected == 3) { // selected as D0
855  fHistAlphaDKB->Fill(aD-adaugh[0],ptD);
856  fHistAlphaDpiB->Fill(aD-adaugh[1],ptD);
857 
858  fHistDeltaRDKB->Fill(dR0,ptD);
859  fHistDeltaRDpiB->Fill(dR1,ptD);
860  }
861  if (isSelected >= 2) { //selected as D0bar
862  fHistAlphaDpiB->Fill(aD-adaugh[0],ptD);
863  fHistAlphaDKB->Fill(aD-adaugh[1],ptD);
864 
865  fHistDeltaRDpiB->Fill(dR0,ptD);
866  fHistDeltaRDKB->Fill(dR1,ptD);
867  }
868  }
869  else if (isD0 == 1) { //D0
870  fHistAlphaDKS->Fill(aD-adaugh[0],ptD);
871  fHistAlphaDpiS->Fill(aD-adaugh[1],ptD);
872 
873  fHistDeltaRDKS->Fill(dR0,ptD);
874  fHistDeltaRDpiS->Fill(dR1,ptD);
875 
876  if (isSelected == 3) { // selected as both D0bar/D0
877  fHistAlphaDpiR->Fill(aD-adaugh[0],ptD);
878  fHistAlphaDKR->Fill(aD-adaugh[1],ptD);
879 
880  fHistDeltaRDpiR->Fill(dR0,ptD);
881  fHistDeltaRDKR->Fill(dR1,ptD);
882  }
883  }
884  else if (isD0 == -1) { //D0bar
885  fHistAlphaDKS->Fill(aD-adaugh[1],ptD);
886  fHistAlphaDpiS->Fill(aD-adaugh[0],ptD);
887 
888  fHistDeltaRDKS->Fill(dR1,ptD);
889  fHistDeltaRDpiS->Fill(dR0,ptD);
890 
891  if (isSelected == 3) { // selected as both D0bar/D0
892  fHistAlphaDpiR->Fill(aD-adaugh[1],ptD);
893  fHistAlphaDKR->Fill(aD-adaugh[0],ptD);
894 
895  fHistDeltaRDpiR->Fill(dR1, ptD);
896  fHistDeltaRDKR->Fill(dR0, ptD);
897  }
898  }
899 }
900 
901 //_______________________________________________________________________________
903 {
904  // Fill some histogram with kinematic information of the D0 candidate.
905 
906  AliAODTrack *softPionTrack = static_cast<AliAODTrack*>(dstar->GetBachelor());
907  Double_t ptD = dstar->Pt();
908  Double_t aD = dstar->Phi();
909  Double_t apis= softPionTrack->Phi();
910 
911  AliAODRecoDecayHF2Prong* D0fromDstar = dstar->Get2Prong();
912  Double_t aD0 = D0fromDstar->Phi();
913  Int_t isD0 = D0fromDstar->Charge()>0 ? kTRUE : kFALSE;
914  Double_t aK = isD0 ? D0fromDstar->PhiProng(0) : D0fromDstar->PhiProng(1);
915  Double_t api = isD0 ? D0fromDstar->PhiProng(1) : D0fromDstar->PhiProng(0);
916  Double_t dRDD0 = DeltaR(dstar,D0fromDstar);
917  Double_t dRDpis = DeltaR(dstar,softPionTrack);
918  Double_t dRDpi = DeltaR(dstar, isD0 ? static_cast<AliVParticle*>(D0fromDstar->GetDaughter(1)) : static_cast<AliVParticle*>(D0fromDstar->GetDaughter(0)));
919  Double_t dRDK = DeltaR(dstar, isD0 ? static_cast<AliVParticle*>(D0fromDstar->GetDaughter(0)) : static_cast<AliVParticle*>(D0fromDstar->GetDaughter(1)));
920 
921  if (isDstar) {
922  fHistAlphaDDS ->Fill(aD-aD0, ptD);
923  fHistAlphaDpisS->Fill(aD-apis, ptD);
924  fHistAlphaDpiS ->Fill(aD-api, ptD);
925  fHistAlphaDKS ->Fill(aD-aK, ptD);
926 
927  fHistDeltaRDDS ->Fill(dRDD0, ptD);
928  fHistDeltaRDpisS->Fill(dRDpis, ptD);
929  fHistDeltaRDpiS ->Fill(dRDpi, ptD);
930  fHistDeltaRDKS ->Fill(dRDK, ptD);
931  }
932  else {
933  fHistAlphaDDB ->Fill(aD-aD0, ptD);
934  fHistAlphaDpisB->Fill(aD-apis, ptD);
935  fHistAlphaDpiB ->Fill(aD-api, ptD);
936  fHistAlphaDKB ->Fill(aD-aK, ptD);
937 
938  fHistDeltaRDDB ->Fill(dRDD0, ptD);
939  fHistDeltaRDpisB->Fill(dRDpis, ptD);
940  fHistDeltaRDpiB ->Fill(dRDpi, ptD);
941  fHistDeltaRDKB ->Fill(dRDK, ptD);
942  }
943 }
944 
945 //_______________________________________________________________________________
947 {
948  // Fills the array of Dstar side band candidates.
949 
950  //select by track cuts the side band candidates (don't want mass cut)
951  Int_t isSelected = fCuts->IsSelected(dstar, AliRDHFCuts::kTracks, fAodEvent);
952  if (!isSelected) return;
953 
954  //add a reasonable cut on the invariant mass (e.g. (+-2\sigma, +-10 \sigma), with \sigma = fSigmaD0[bin])
955  Int_t bin = fCuts->PtBin(dstar->Pt());
956  if (bin < 0 || bin >= fCuts->GetNPtBins()) {
957  AliError(Form("Pt %.3f out of bounds", dstar->Pt()));
958  return;
959  }
960 
961  const Double_t mPDGD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
962 
963  //if data and Dstar from D0 side band
964  if (((dstar->InvMassD0() < (mPDGD0-3.*fSigmaD0[bin])) && (dstar->InvMassD0() > (mPDGD0-10.*fSigmaD0[bin]))) /*left side band*/ ||
965  ((dstar->InvMassD0() > (mPDGD0+3.*fSigmaD0[bin])) && (dstar->InvMassD0() < (mPDGD0+10.*fSigmaD0[bin]))) /*right side band*/) {
966 
967  if(!fMultCand) new ((*fSideBandArray)[fNSBCand]) AliAODRecoCascadeHF(*dstar);
968  else if(fNSBCand==fAnalyseCand) new ((*fSideBandArray)[0]) AliAODRecoCascadeHF(*dstar);
969  fNSBCand++;
970  }
971 }
972 
973 //_______________________________________________________________________________
975 {
976  // Set the mass limits using the PDG code and the given range.
977 
978  Float_t mass = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg))->Mass();
979 
980  // compute the Delta mass for the D*
981  if (fCandidateType==kDstartoKpipi) mass -= TDatabasePDG::Instance()->GetParticle(421)->Mass();
982 
983  fMinMass = mass - range;
984  fMaxMass = mass + range;
985 
986  AliInfo(Form("Setting mass limits to %f, %f", fMinMass, fMaxMass));
987  if ((fMinMass<0.) || (fMaxMass<=0.) || (fMaxMass<fMinMass)) {
988  AliError(Form("Wrong mass limits! Task '%s' will be disabled!", GetName()));
989  fInhibitTask = kTRUE;
990  }
991 }
992 
993 //_______________________________________________________________________________
995 {
996  // Set the mass limits.
997 
998  if (uplimit>lowlimit) {
999  fMinMass = lowlimit;
1000  fMaxMass = uplimit;
1001  }
1002  else {
1003  printf("Error! Lower limit larger than upper limit!\n");
1004  fMinMass = uplimit - uplimit*0.2;
1005  fMaxMass = uplimit;
1006  }
1007 }
1008 
1009 //_______________________________________________________________________________
1011 {
1012  // Set the D0 width for the D* analysis.
1013 
1014  if (nptbins > 30) {
1015  AliWarning("Maximum number of bins allowed is 30!");
1016  return kFALSE;
1017  }
1018 
1019  if (!width) return kFALSE;
1020  for (Int_t ipt=0; ipt < nptbins; ipt++) fSigmaD0[ipt] = width[ipt];
1021 
1022  return kTRUE;
1023 }
1024 
1025 //_______________________________________________________________________________
1027 {
1028  // Allocate the histograms for the analysis.
1029 
1030  // Statistics
1031  fHistStat = new TH1I("fHistStat", "Statistics", 9, -0.5, 8.5);
1032  fHistStat->GetXaxis()->SetBinLabel(1, "N ev anal");
1033  fHistStat->GetXaxis()->SetBinLabel(2, "N ev sel");
1034  if (fUseMCInfo) {
1035  if (fUseReco) {
1036  fHistStat->GetXaxis()->SetBinLabel(3, "N D");
1037  }
1038  else {
1039  fHistStat->GetXaxis()->SetBinLabel(3, "N Gen D");
1040  }
1041  }
1042  else {
1043  fHistStat->GetXaxis()->SetBinLabel(3, "N Cand");
1044  }
1045  fHistStat->GetXaxis()->SetBinLabel(4, "N cand sel cuts");
1046  if (fCandidateType == kDstartoKpipi) {
1047  fHistStat->GetXaxis()->SetBinLabel(5, "N side band cand");
1048  }
1049  if (fUseMCInfo) {
1050  fHistStat->GetXaxis()->SetBinLabel(6, "N Background");
1051  fHistStat->GetXaxis()->SetBinLabel(7, "N rej no quark");
1052  fHistStat->GetXaxis()->SetBinLabel(8, "N rej from B");
1053  fHistStat->GetXaxis()->SetBinLabel(9, "N rej from D");
1054  }
1055 
1056  fHistStat->SetNdivisions(1);
1057  fOutput->Add(fHistStat);
1058 
1059  fHistNCandEv = new TH1F("fHistNCandEv", "Number of candidates per event (after cuts);# cand/ev", 100, 0., 100.);
1060  fOutput->Add(fHistNCandEv);
1061 
1062  if ((fCandidateType == kDstartoKpipi) || fUseMCInfo) {
1063  fHistNSBCandEv = new TH1F("hnSBCandEv", "Number of side bands candidates per event (after cuts);# cand/ev", 100, 0.,100.);
1064  fOutput->Add(fHistNSBCandEv);
1065  }
1066 
1067  if (fCandidateType == kDstartoKpipi) {
1068  fHistPtPion = new TH1F("fHistPtPion", "Primary pions candidates pt", 500, 0., 10.);
1069  fHistPtPion->SetStats(kTRUE);
1070  fHistPtPion->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1071  fHistPtPion->GetYaxis()->SetTitle("entries");
1072  fOutput->Add(fHistPtPion);
1073  }
1074 
1075  // Invariant mass related histograms
1076  const Int_t nbinsmass = 200;
1077  const Int_t ptbinsD = 100;
1078  Float_t ptmin =0.;
1079  Float_t ptmax =50.;
1080  fHistInvMassPtD = new TH2F("fHistInvMassPtD", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass, ptbinsD, ptmin, ptmax);
1081  fHistInvMassPtD->SetStats(kTRUE);
1082  fHistInvMassPtD->GetXaxis()->SetTitle("mass (GeV/c)");
1083  fHistInvMassPtD->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1084  fOutput->Add(fHistInvMassPtD);
1085 
1086  fHistImpParS = new TH2F("fHistImpParS", "Impact parameter of daughter tracks; Getd0Prong();#it{p}^{daugh}_{T} (GeV/c)",200, -0.1,0.1,ptbinsD, ptmin, ptmax); //same range of pt of the D, but pt daughter used
1087  fOutput->Add(fHistImpParS);
1088 
1089  fHistInvMassS = new TH1F("fHistInvMassS", "D invariant mass distribution (filled with fCandidateArray)", nbinsmass, fMinMass, fMaxMass);
1090  fHistInvMassS->SetStats(kTRUE);
1091  fHistInvMassS->GetXaxis()->SetTitle("mass (GeV/c)");
1092  fHistInvMassS->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1093  fOutput->Add(fHistInvMassS);
1094 
1095  const Int_t nbinsalpha = 200;
1096  Float_t minalpha = -TMath::Pi();
1097  Float_t maxalpha = TMath::Pi();
1098  const Int_t nbinsdeltaR = 200;
1099  Float_t mindeltaR = 0.;
1100  Float_t maxdeltaR = 10.;
1101 
1102  if (fUseMCInfo) {
1103  fHistImpParB = new TH2F("fHistImpParB", "Impact parameter of daughter tracks (Background); Getd0Prong();#it{p}^{daugh}_{T} (GeV/c)",200, -0.1,0.1,ptbinsD, ptmin, ptmax); //same range of pt of the D, but pt daughter used
1104  fOutput->Add(fHistImpParB);
1105 
1106  fHistInvMassB = new TH1F("fHistInvMassB", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass);
1107  fHistInvMassB->SetStats(kTRUE);
1108  fHistInvMassB->GetXaxis()->SetTitle("mass (GeV/c)");
1109  fHistInvMassB->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1110  fOutput->Add(fHistInvMassB);
1111 
1112  if (fCandidateType == kDstartoKpipi) {
1113 
1114  fHistAlphaDDS = new TH2F("fHistAlphaDDS","Angle D^{*}-D^{0} (Signal);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1115  fHistAlphaDpisS = new TH2F("fHistAlphaDpisS","Angle D^{*}-#pi_{soft} (Signal);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1116  fHistAlphaDpiS = new TH2F("fHistAlphaDpiS","Angle D^{*}-#pi (Signal);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1117  fHistAlphaDKS = new TH2F("fHistAlphaDKS","Angle D^{*}-K (Signal);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1118 
1119  fHistAlphaDDB = new TH2F("fHistAlphaDDB","Angle D^{*}-D^{0} (Background);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1120  fHistAlphaDpisB = new TH2F("fHistAlphaDpisB","Angle D^{*}-#pi_{soft} (Background);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1121  fHistAlphaDpiB = new TH2F("fHistAlphaDpiB","Angle D^{*}-#pi (Background);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1122  fHistAlphaDKB = new TH2F("fHistAlphaDKB","Angle D^{*}-K (Background);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1123 
1124  fHistDeltaRDDS = new TH2F("fHistDeltaRDDS","Angle D^{*}-D^{0} (Signal);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1125  fHistDeltaRDpisS = new TH2F("fHistDeltaRDpisS","Angle D^{*}-#pi_{soft} (Signal);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1126  fHistDeltaRDpiS = new TH2F("fHistDeltaRDpiS","Angle D^{*}-#pi (Signal);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1127  fHistDeltaRDKS = new TH2F("fHistDeltaRDKS","Angle D^{*}-K (Signal);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1128 
1129  fHistDeltaRDDB = new TH2F("fHistDeltaRDDB","Angle D^{*}-D^{0} (Background);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1130  fHistDeltaRDpisB = new TH2F("fHistDeltaRDpisB","Angle D^{*}-#pi_{soft} (Background);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1131  fHistDeltaRDpiB = new TH2F("fHistDeltaRDpiB","Angle D^{*}-#pi (Background);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1132  fHistDeltaRDKB = new TH2F("fHistDeltaRDKB","Angle D^{*}-K (Background);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1133 
1134  fOutput->Add(fHistAlphaDDS);
1135  fOutput->Add(fHistAlphaDpisS);
1136  fOutput->Add(fHistAlphaDpiS);
1137  fOutput->Add(fHistAlphaDKS);
1138  fOutput->Add(fHistAlphaDDB);
1139  fOutput->Add(fHistAlphaDpisB);
1140  fOutput->Add(fHistAlphaDpiB);
1141  fOutput->Add(fHistAlphaDKB);
1142 
1143  fOutput->Add(fHistDeltaRDDS);
1144  fOutput->Add(fHistDeltaRDpisS);
1145  fOutput->Add(fHistDeltaRDpiS);
1146  fOutput->Add(fHistDeltaRDKS);
1147  fOutput->Add(fHistDeltaRDDB);
1148  fOutput->Add(fHistDeltaRDpisB);
1149  fOutput->Add(fHistDeltaRDpiB);
1150  fOutput->Add(fHistDeltaRDKB);
1151  }
1152  else if (fCandidateType == kD0toKpi) {
1153 
1154  fHistAlphaDpiS = new TH2F("fHistAlphaDpiS","Angle D^{0}-#pi (Signal);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1155  fHistAlphaDKS = new TH2F("fHistAlphaDKS","Angle D^{0}-K (Signal);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1156  fHistAlphaDpiR = new TH2F("fHistAlphaDpiR","Angle D^{0}-#pi (Reflections);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1157  fHistAlphaDKR = new TH2F("fHistAlphaDKR","Angle D^{0}-K (Reflections);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1158 
1159  fHistAlphaDpiB = new TH2F("fHistAlphaDpiB","Angle D^{0}-#pi (Background);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1160  fHistAlphaDKB = new TH2F("fHistAlphaDKB","Angle D^{0}-K (Background);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
1161 
1162  fHistDeltaRDpiS = new TH2F("fHistDeltaRDpiS","Angle D^{0}-#pi (Signal);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1163  fHistDeltaRDKS = new TH2F("fHistDeltaRDKS","Angle D^{0}-K (Signal);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1164  fHistDeltaRDpiR = new TH2F("fHistDeltaRDpiR","Angle D^{0}-#pi (Reflections);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1165  fHistDeltaRDKR = new TH2F("fHistDeltaRDKR","Angle D^{0}-K (Reflections);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1166 
1167  fHistDeltaRDpiB = new TH2F("fHistDeltaRDpiB","Angle D^{0}-#pi (Background);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1168  fHistDeltaRDKB = new TH2F("fHistDeltaRDKB","Angle D^{0}-K (Background);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
1169 
1170  fOutput->Add(fHistAlphaDpiS);
1171  fOutput->Add(fHistAlphaDKS);
1172  fOutput->Add(fHistAlphaDpiR);
1173  fOutput->Add(fHistAlphaDKR);
1174  fOutput->Add(fHistAlphaDpiB);
1175  fOutput->Add(fHistAlphaDKB);
1176 
1177  fOutput->Add(fHistDeltaRDpiS);
1178  fOutput->Add(fHistDeltaRDKS);
1179  fOutput->Add(fHistDeltaRDpiR);
1180  fOutput->Add(fHistDeltaRDKR);
1181  fOutput->Add(fHistDeltaRDpiB);
1182  fOutput->Add(fHistDeltaRDKB);
1183  }
1184  }
1185 
1186  return kTRUE;
1187 }
1188 
1189 //_______________________________________________________________________________
1190 Float_t AliAnalysisTaskSEDmesonsFilterCJ::DeltaR(AliVParticle *p1, AliVParticle *p2) const
1191 {
1192  // Calculate DeltaR between p1 and p2: DeltaR=sqrt(Delataphi^2+DeltaEta^2)
1193 
1194  if (!p1 || !p2) return -1;
1195 
1196  Double_t phi1 = p1->Phi();
1197  Double_t eta1 = p1->Eta();
1198  Double_t phi2 = p2->Phi();
1199  Double_t eta2 = p2->Eta();
1200 
1201  Double_t dPhi = phi1 - phi2;
1202  if(dPhi < -(TMath::Pi())/2) dPhi = dPhi + TMath::TwoPi();
1203  if(dPhi > (3*(TMath::Pi()))/2) dPhi = dPhi - TMath::TwoPi();
1204 
1205  Double_t dEta = eta1 - eta2;
1206 
1207  Double_t deltaR = TMath::Sqrt(dEta*dEta + dPhi*dPhi);
1208 
1209  return deltaR;
1210 }
1211 
1212 //_______________________________________________________________________________
1214 {
1215  //
1216  // Add event tracks to a collection that already contains the D candidates, excluding the daughters of the D candidates
1217  //
1218 
1219  if (!tracks) return;
1220 
1221  TObjArray allDaughters(10);
1222  allDaughters.SetOwner(kFALSE);
1223 
1224  TIter next(coll);
1225  AliEmcalParticle* emcpart = 0;
1226  while ((emcpart = static_cast<AliEmcalParticle*>(next()))) {
1227  AliAODRecoDecay* reco = dynamic_cast<AliAODRecoDecay*>(emcpart->GetTrack());
1228  AliDebug(2, Form("Found a D meson candidtate with pT = %.3f, eta = %.3f, phi = %.3f", reco->Pt(), reco->Eta(), reco->Phi()));
1229  if (reco) AddDaughters(reco, allDaughters);
1230  }
1231 
1232  tracks->ResetCurrentID();
1233  AliVTrack* track = 0;
1234  Int_t n = coll->GetEntriesFast();
1235  while ((track = static_cast<AliVTrack*>(tracks->GetNextAcceptParticle()))) {
1236  if (allDaughters.Remove(track) == 0) {
1237  new ((*coll)[n]) AliEmcalParticle(track);
1238  n++;
1239  AliDebug(2, Form("Track %d (pT = %.3f, eta = %.3f, phi = %.3f) is included", tracks->GetCurrentID(), track->Pt(), track->Eta(), track->Phi()));
1240  }
1241  else {
1242  AliDebug(2, Form("Track %d (pT = %.3f, eta = %.3f, phi = %.3f) is excluded", tracks->GetCurrentID(), track->Pt(), track->Eta(), track->Phi()));
1243  }
1244  }
1245 }
1246 
1247 //_______________________________________________________________________________
1249 {
1250  // Add all the dauthers of cand in an array. Follows all the decay cascades.
1251 
1252  Int_t n = cand->GetNDaughters();
1253 
1254  //Printf("AddDaughters: the number of dauhters is %d", n);
1255 
1256  Int_t ntot = 0;
1257  Double_t pt = 0;
1258  for (Int_t i = 0; i < n; i++) {
1259  AliVTrack* track = dynamic_cast<AliVTrack*>(cand->GetDaughter(i));
1260  if (!track) continue;
1261 
1262  AliAODRecoDecay* cand2 = dynamic_cast<AliAODRecoDecay*>(track);
1263 
1264  if (cand2) {
1265  //Printf("Daughter pT = %.3f --> ", track->Pt());
1266  pt += AddDaughters(cand2, daughters);
1267  }
1268  else {
1269  if (!track->InheritsFrom("AliAODTrack")) {
1270  Printf("Warning: One of the daughters is not of type 'AliAODTrack' nor 'AliAODRecoDecay'.");
1271  continue;
1272  }
1273  //Printf("Daughter pT = %.3f", track->Pt());
1274  daughters.AddLast(track);
1275  pt += track->Pt();
1276  ntot++;
1277  }
1278  }
1279 
1280  //Printf("Total pt of the daughters = %.3f", pt);
1281 
1282  return pt;
1283 }
1284 //_______________________________________________________________________________
1286 {
1287  //
1288  // Add event tracks to a collection that already contains the D candidates, excluding the daughters of the D candidates
1289  //
1290 
1291  if (!mctracks) return;
1292 
1293  TObjArray allMCDaughters(10);
1294  allMCDaughters.SetOwner(kFALSE);
1295 
1296  AliAODMCParticle* mcD = (AliAODMCParticle*)coll->At(0);
1297 
1298  AddMCDaughters(mcD,allMCDaughters,fMCarray);
1299 
1300  mctracks->ResetCurrentID();
1301  AliAODMCParticle* mcpart = 0;
1302  Int_t n = coll->GetEntriesFast();
1303  while ((mcpart = static_cast<AliAODMCParticle*>(mctracks->GetNextAcceptParticle()))) {
1304  if(TMath::Abs(mcpart->Charge())==0) continue;
1305  if (allMCDaughters.Remove(mcpart) == 0) {
1306  new ((*coll)[n]) AliAODMCParticle(*mcpart);
1307  n++;
1308  AliDebug(2, Form("Track %d (pT = %.3f, eta = %.3f, phi = %.3f) is included", mctracks->GetCurrentID(), mcpart->Pt(), mcpart->Eta(), mcpart->Phi()));
1309  }
1310  else {
1311  AliDebug(2, Form("Track %d (pT = %.3f, eta = %.3f, phi = %.3f) is excluded", mctracks->GetCurrentID(), mcpart->Pt(), mcpart->Eta(), mcpart->Phi()));
1312  }
1313  }
1314 }
1315 
1316 //_______________________________________________________________________________
1317 Double_t AliAnalysisTaskSEDmesonsFilterCJ::AddMCDaughters(AliAODMCParticle* mcDmeson, TObjArray& mcdaughters, TClonesArray* mcArray)
1318 {
1319  // Add all the dauthers of cand in an array. Follows all the decay cascades.
1320 
1321  Int_t n = mcDmeson->GetNDaughters();
1322 
1323  //Printf("AddDaughters: the number of dauhters is %d", n);
1324  Double_t pt = 0;
1325 
1326  for (Int_t i = 0; i < n; i++) {
1327  AliAODMCParticle* DDaughter = static_cast<AliAODMCParticle*>(mcArray->At(mcDmeson->GetDaughter(i)));
1328  if (!DDaughter) continue;
1329 
1330  if (DDaughter->GetNDaughters()>0) {
1331  //Printf("Daughter pT = %.3f --> ", track->Pt());
1332  pt += AddMCDaughters(DDaughter, mcdaughters, mcArray);
1333  }
1334  else {
1335  //Printf("Daughter pT = %.3f", track->Pt());
1336  mcdaughters.AddLast(DDaughter);
1337  pt += DDaughter->Pt();
1338  }
1339  }
1340 
1341  //Printf("Total pt of the daughters = %.3f", pt);
1342 
1343  return pt;
1344 }
1345 //_________________________________________________________________________________________________
1346 Int_t AliAnalysisTaskSEDmesonsFilterCJ::CheckOrigin(AliAODRecoDecay* cand, TClonesArray* mcArray)
1347 {
1348  // Checks whether the mother of the D meson candidate comes from a charm or a bottom quark.
1349 
1350  if (!mcArray) return -1;
1351 
1352  Int_t labDau0 = static_cast<AliVTrack*>(cand->GetDaughter(0))->GetLabel();
1353  if (labDau0 < 0) return -1;
1354 
1355  AliAODMCParticle* part = static_cast<AliAODMCParticle*>(mcArray->At(labDau0));
1356  return CheckOrigin(part, mcArray);
1357 }
1358 
1359 //_________________________________________________________________________________________________
1360 Int_t AliAnalysisTaskSEDmesonsFilterCJ::CheckOrigin(AliAODRecoDecay* cand, AliStack* stack)
1361 {
1362  // Checks whether the mother of the D meson candidate comes from a charm or a bottom quark.
1363 
1364  if (!stack) return -1;
1365 
1366  Int_t labDau0 = static_cast<AliVTrack*>(cand->GetDaughter(0))->GetLabel();
1367  if (labDau0 < 0) return -1;
1368 
1369  return CheckOrigin(labDau0, stack);
1370 }
1371 
1372 //_________________________________________________________________________________________________
1373 Int_t AliAnalysisTaskSEDmesonsFilterCJ::CheckOrigin(AliAODMCParticle* part, TClonesArray* mcArray)
1374 {
1375  // Checks whether the mother of the particle comes from a charm or a bottom quark.
1376 
1377  if (!part) return -1;
1378  if (!mcArray) return -1;
1379 
1380  Int_t pdgGranma = 0;
1381  Int_t mother = part->GetMother();
1382  Int_t istep = 0;
1383  Int_t abspdgGranma = 0;
1384  Bool_t isFromB = kFALSE;
1385  Bool_t isQuarkFound = kFALSE;
1386 
1387  while (mother >= 0) {
1388  istep++;
1389  AliAODMCParticle* mcGranma = static_cast<AliAODMCParticle*>(mcArray->At(mother));
1390  if (mcGranma >= 0) {
1391  pdgGranma = mcGranma->GetPdgCode();
1392  abspdgGranma = TMath::Abs(pdgGranma);
1393  if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
1394  isFromB = kTRUE;
1395  }
1396 
1397  if (abspdgGranma == 4 || abspdgGranma == 5) isQuarkFound = kTRUE;
1398  mother = mcGranma->GetMother();
1399  }
1400  else {
1401  ::Error("AliAnalysisTaskSEDmesonsFilterCJ::CheckOrigin", "Could not retrieve mother particle %d!", mother);
1402  break;
1403  }
1404  }
1405 
1406  if (isQuarkFound) {
1407  if (isFromB) {
1408  return kFromBottom;
1409  }
1410  else {
1411  return kFromCharm;
1412  }
1413  }
1414  else {
1415  return kQuarkNotFound;
1416  }
1417 }
1418 
1419 //_________________________________________________________________________________________________
1421 {
1422  // Checks whether the mother of the particle comes from a charm or a bottom quark.
1423 
1424  if (!stack) return -1;
1425 
1426  TParticle* part = stack->Particle(ipart);
1427  if (!part) return -1;
1428 
1429  Int_t pdgGranma = 0;
1430  Int_t mother = part->GetFirstMother();
1431  Int_t istep = 0;
1432  Int_t abspdgGranma = 0;
1433  Bool_t isFromB = kFALSE;
1434  Bool_t isQuarkFound = kFALSE;
1435 
1436  while (mother >= 0) {
1437  istep++;
1438  TParticle* mcGranma = stack->Particle(mother);
1439  if (mcGranma >= 0) {
1440  pdgGranma = mcGranma->GetPdgCode();
1441  abspdgGranma = TMath::Abs(pdgGranma);
1442  if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
1443  isFromB = kTRUE;
1444  }
1445 
1446  if (abspdgGranma == 4 || abspdgGranma == 5) isQuarkFound = kTRUE;
1447  mother = mcGranma->GetFirstMother();
1448  }
1449  else {
1450  ::Error("AliAnalysisTaskSEDmesonsFilterCJ::CheckOrigin", "Could not retrieve mother particle %d!", mother);
1451  break;
1452  }
1453  }
1454 
1455  if (isQuarkFound) {
1456  if (isFromB) {
1457  return kFromBottom;
1458  }
1459  else {
1460  return kFromCharm;
1461  }
1462  }
1463  else {
1464  return kQuarkNotFound;
1465  }
1466 }
1467 
1468 //_________________________________________________________________________________________________
1469 Int_t AliAnalysisTaskSEDmesonsFilterCJ::CheckDecayChannel(AliAODMCParticle* part, TClonesArray* mcArray)
1470 {
1471  // Determine the decay channel
1472 
1473  if (!part) return -1;
1474  if (!mcArray) return -1;
1475 
1477 
1478  Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1479 
1480  if (part->GetNDaughters() == 2) {
1481 
1482  AliAODMCParticle* d1 = static_cast<AliAODMCParticle*>(mcArray->At(part->GetDaughter(0)));
1483  AliAODMCParticle* d2 = static_cast<AliAODMCParticle*>(mcArray->At(part->GetDaughter(1)));
1484 
1485  if (!d1 || !d2) {
1486  return decay;
1487  }
1488 
1489  Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1490  Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1491 
1492  if (absPdgPart == 421) { // D0 -> K pi
1493 
1494  if ((absPdg1 == 211 && absPdg2 == 321) || // pi K
1495  (absPdg1 == 321 && absPdg2 == 211)) { // K pi
1496  decay = kDecayD0toKpi;
1497  }
1498  }
1499 
1500  if (absPdgPart == 413) { // D* -> D0 pi
1501 
1502  if (absPdg1 == 421 && absPdg2 == 211) { // D0 pi
1503  Int_t D0decay = CheckDecayChannel(d1, mcArray);
1504  if (D0decay == kDecayD0toKpi) {
1505  decay = kDecayDStartoKpipi;
1506  }
1507  }
1508 
1509  if (absPdg1 == 211 && absPdg2 == 421) { // pi D0
1510  Int_t D0decay = CheckDecayChannel(d2, mcArray);
1511  if (D0decay == kDecayD0toKpi) {
1512  decay = kDecayDStartoKpipi;
1513  }
1514  }
1515  }
1516  }
1517 
1518  return decay;
1519 }
1520 
1521 //_________________________________________________________________________________________________
1523 {
1524  // Determine the decay channel
1525 
1526  if (!stack) return -1;
1527 
1528  TParticle* part = stack->Particle(ipart);
1529 
1530  if (!part) return -1;
1531 
1533 
1534  if (part->GetNDaughters() == 2) {
1535 
1536  Int_t id1 = part->GetDaughter(0);
1537  Int_t id2 = part->GetDaughter(1);
1538 
1539  TParticle* d1 = stack->Particle(id1);
1540  TParticle* d2 = stack->Particle(id2);
1541 
1542  if (!d1 || !d2) {
1543  return decay;
1544  }
1545 
1546  Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1547  Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1548 
1549 
1550  if (part->GetPdgCode() == 421) { // D0 -> K pi
1551 
1552  if ((absPdg1 == 211 && absPdg2 == 321) || // pi K
1553  (absPdg1 == 321 && absPdg2 == 211)) { // K pi
1554  decay = kDecayD0toKpi;
1555  }
1556  }
1557 
1558  if (part->GetPdgCode() == 413) { // D* -> D0 pi
1559 
1560  if (absPdg1 == 421 && absPdg2 == 211) { // D0 pi
1561  Int_t D0decay = CheckDecayChannel(id1, stack);
1562  if (D0decay == kDecayD0toKpi) {
1563  decay = kDecayDStartoKpipi;
1564  }
1565  }
1566 
1567  if (absPdg1 == 211 && absPdg2 == 421) { // pi D0
1568  Int_t D0decay = CheckDecayChannel(id2, stack);
1569  if (D0decay == kDecayD0toKpi) {
1570  decay = kDecayDStartoKpipi;
1571  }
1572  }
1573  }
1574  }
1575 
1576  return decay;
1577 
1578 }
void ProcessDstar(AliAODRecoCascadeHF *dstar, Int_t isSelected)
Int_t pdg
static Int_t CheckOrigin(AliAODRecoDecay *cand, TClonesArray *mcArray)
virtual AliVParticle * GetNextAcceptParticle()
double Double_t
Definition: External.C:58
Definition: External.C:236
TClonesArray * fCombinedDmesonsBkg
contains candidates selected by AliRDHFCuts and the rest of the event tracks
Double_t DeltaInvMass() const
void ProcessD0(AliAODRecoDecayHF2Prong *charmCand, Int_t isSelected)
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
Base task in the EMCAL framework.
Double_t mass
static Int_t CheckMatchingAODdeltaAODevents()
void FillDStarMCTruthKinHistos(AliAODRecoCascadeHF *dstar, Int_t, Int_t isDstar)
void FillD0MCTruthKinHistos(AliAODRecoDecayHF2Prong *charmCand, Int_t isSelected, Int_t isD0)
static Double_t AddDaughters(AliAODRecoDecay *cand, TObjArray &daughters)
void AddEventTracks(TClonesArray *coll, AliParticleContainer *tracks)
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
AliVTrack * GetTrack() const
static Double_t AddMCDaughters(AliAODMCParticle *mcDmeson, TObjArray &mcdaughters, TClonesArray *mcArray)
Container for particles within the EMCAL framework.
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Int_t fNCand
contains MC D0 and MC event particles
void FillDstarSideBands(AliAODRecoCascadeHF *dstar)
TClonesArray * fSideBandArray
contains candidates selected by AliRDHFCuts
int Int_t
Definition: External.C:63
Definition: External.C:204
static Int_t CheckDecayChannel(AliAODMCParticle *part, TClonesArray *mcArray)
float Float_t
Definition: External.C:68
const Double_t ptmax
AliAODTrack * GetBachelor() const
TClonesArray * fMCCombinedDmesons
contains bkg candidates selected by AliRDHFCuts and the rest of the event tracks
const Double_t ptmin
Bool_t SetD0WidthForDStar(Int_t nptbins, Float_t *width)
ClassImp(AliAnalysisTaskSEDmesonsFilterCJ) AliAnalysisTaskSEDmesonsFilterCJ
Bool_t IsEventSelected(AliVEvent *event)
decay
Definition: HFPtSpectrum.C:41
AliEmcalList * fOutput
!output list
Int_t fNSBCand
number of selected D candidates already added to fCandidateArray
Bool_t IsSelected(TObject *obj)
Definition: AliRDHFCuts.h:277
Double_t InvMassD0() const
TH1 * fHistStat
number of selected side-band D candidates already added to fSideBandArray
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:235
Float_t DeltaR(AliVParticle *p1, AliVParticle *p2) const
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
bool Bool_t
Definition: External.C:53
AliAODRecoDecayHF2Prong * Get2Prong() const
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Definition: AliRDHFCuts.h:297
Int_t PtBin(Double_t pt) const
void AddMCEventTracks(TClonesArray *coll, AliParticleContainer *mctracks)
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
Int_t nptbins
TClonesArray * fCombinedDmesons
contains candidates selected by AliRDHFCuts::IsSelected(kTracks), to be used for side bands (DStar ca...