AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliHFAODMCParticleContainer.cxx
Go to the documentation of this file.
1 /*************************************************************************
2 * Copyright(c) 1998-2016, 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 #include <TClonesArray.h>
17 #include <AliAODMCParticle.h>
18 #include <AliLog.h>
19 
21 
25 
29  fSpecialPDG(0),
30  fRejectedOrigin(0),
31  fAcceptedDecay(0)
32 {
33  // Constructor.
34 }
35 
41  fSpecialPDG(0),
42  fRejectedOrigin(AliAnalysisTaskDmesonJets::kUnknownQuark | AliAnalysisTaskDmesonJets::kFromBottom),
43  fAcceptedDecay(AliAnalysisTaskDmesonJets::kAnyDecay)
44 {
45  // Constructor.
46 }
47 
48 
51 {
52  SetSpecialPDG(421);
54  SetRejectDfromB(kTRUE);
56  SetKeepOnlyDfromB(kFALSE);
57 }
58 
61 {
62  SetSpecialPDG(413);
64  SetRejectDfromB(kTRUE);
66  SetKeepOnlyDfromB(kFALSE);
67 }
68 
76 Bool_t AliHFAODMCParticleContainer::ApplyMCParticleCuts(const AliAODMCParticle* part, UInt_t &rejectionReason) const
77 {
78  Int_t partPdgCode = TMath::Abs(part->PdgCode());
79 
80  Bool_t isSpecialPdg = (fSpecialPDG != 0 && partPdgCode == fSpecialPDG && part->IsPrimary());
81 
82  if (isSpecialPdg) {
84 
85  if ((origin & fRejectedOrigin) != 0) isSpecialPdg = kFALSE;
86 
88 
89  if ((decayChannel & fAcceptedDecay) == 0) isSpecialPdg = kFALSE;
90 
91  AliDebug(2, Form("Including particle %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
92  part->Label(), partPdgCode, part->Pt(), part->Eta(), part->Phi()));
93 
94  // Special PDG particle, skip regular MC particle cuts and apply particle cuts.
95  return ApplyParticleCuts(part, rejectionReason);
96  }
97 
98  if (IsSpecialPDGDaughter(part)) {
99  rejectionReason = kHFCut;
100  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
101  }
102 
103  // Not a special PDG particle, and not a daughter of a special PDG particle. Apply regular MC particle cuts.
104  return AliMCParticleContainer::ApplyMCParticleCuts(part, rejectionReason);
105 }
106 
111 Bool_t AliHFAODMCParticleContainer::IsSpecialPDGDaughter(const AliAODMCParticle* part) const
112 {
113  if (fSpecialPDG == 0) return kTRUE;
114 
115  const AliAODMCParticle* pm = part;
116  Int_t imo = -1;
117  while (pm != 0) {
118  imo = pm->GetMother();
119  if (imo < 0) break;
120  pm = static_cast<const AliAODMCParticle*>(fClArray->At(imo));
121  if (TMath::Abs(pm->GetPdgCode()) == fSpecialPDG && pm->IsPrimary()) {
122  AliDebug(2, Form("Rejecting particle (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f) daughter of %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
123  part->PdgCode(), part->Pt(), part->Eta(), part->Phi(), imo, pm->PdgCode(), pm->Pt(), pm->Eta(), pm->Phi()));
124  return kTRUE;
125  }
126  }
127  return kFALSE;
128 }
129 
134 {
135  for (auto part : accepted()) {
136  if (TMath::Abs(part->GetPdgCode()) == fSpecialPDG) return kTRUE;
137  }
138  return kFALSE;
139 }
AliHFAODMCParticleContainer()
This is the default constructor, used for ROOT I/O purposes.
Analysis task for D meson jets.
virtual Bool_t ApplyParticleCuts(const AliVParticle *vp, UInt_t &rejectionReason) const
virtual Bool_t ApplyMCParticleCuts(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
Bool_t IsSpecialPDGDaughter(const AliAODMCParticle *part) const
UInt_t fAcceptedDecay
Bit mask with D meson decays that are accepted.
Int_t fSpecialPDG
include particles with this PDG code even if they are not primary particles (and exclude their daught...
void SelectCharmtoDStartoKpipi()
Automatically sets parameters to select only the decay chain c->D*->Kpipi.
UInt_t fRejectedOrigin
Bit mask with D meson origins that are rejected.
Select MC particles based on specific prescriptions of HF analysis.
static EMesonDecayChannel_t CheckDecayChannel(const AliAODMCParticle *part, TClonesArray *mcArray)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void SelectCharmtoD0toKpi()
Automatically sets parameters to select only the decay chain c->D0->Kpi.
virtual Bool_t ApplyMCParticleCuts(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
Container for MC-true particles within the EMCAL framework.
const AliMCParticleIterableContainer accepted() const
static EMesonOrigin_t CheckOrigin(const AliAODMCParticle *part, TClonesArray *mcArray)