AliPhysics  9fe175b (9fe175b)
 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::AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
77 {
78  // Return true if vp is accepted.
79 
80  if (IsSpecialPDGDaughter(vp)) {
81  rejectionReason = kHFCut;
82  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
83  }
84 
86  GetMomentumFromParticle(mom, vp);
87 
88  Bool_t r = kFALSE;
89 
90  if (IsSpecialPDG(vp)) {
91  // Special PDG particle, skip regular MC particle cuts and apply particle cuts.
92  r = ApplyParticleCuts(vp, rejectionReason);
93  if (!r) return kFALSE;
94  // For the future, may want to implement special kinematic cuts for D mesons
95  return ApplyKinematicCuts(mom, rejectionReason);
96  }
97  else {
98  r = ApplyMCParticleCuts(vp, rejectionReason);
99  if (!r) return kFALSE;
100  return ApplyKinematicCuts(mom, rejectionReason);
101  }
102 }
103 
111 Bool_t AliHFAODMCParticleContainer::AcceptMCParticle(Int_t i, UInt_t &rejectionReason) const
112 {
113  // Return true if vp is accepted.
114 
115  AliAODMCParticle* vp = GetMCParticle(i);
116 
117  if (IsSpecialPDGDaughter(vp)) {
118  rejectionReason = kHFCut;
119  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
120  }
121 
122  AliTLorentzVector mom;
123  GetMomentum(mom, i);
124 
125  Bool_t r = kFALSE;
126 
127  if (IsSpecialPDG(vp)) {
128  // Special PDG particle, skip regular MC particle cuts and apply particle cuts.
129  r = ApplyParticleCuts(vp, rejectionReason);
130  if (!r) return kFALSE;
131  // For the future, may want to implement special kinematic cuts for D mesons
132  return ApplyKinematicCuts(mom, rejectionReason);
133  }
134  else {
135  r = ApplyMCParticleCuts(vp, rejectionReason);
136  if (!r) return kFALSE;
137  return ApplyKinematicCuts(mom, rejectionReason);
138  }
139 }
140 
145 Bool_t AliHFAODMCParticleContainer::IsSpecialPDGDaughter(const AliAODMCParticle* part) const
146 {
147  if (fSpecialPDG == 0) return kFALSE;
148 
149  const AliAODMCParticle* pm = part;
150  Int_t imo = -1;
151  while (pm != 0) {
152  imo = pm->GetMother();
153  if (imo < 0) break;
154  pm = static_cast<const AliAODMCParticle*>(fClArray->At(imo));
155  if (IsSpecialPDG(pm)) {
156  AliDebug(2, Form("Rejecting particle (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f) daughter of %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
157  part->PdgCode(), part->Pt(), part->Eta(), part->Phi(), imo, pm->PdgCode(), pm->Pt(), pm->Eta(), pm->Phi()));
158  return kTRUE;
159  }
160  }
161  return kFALSE;
162 }
163 
168 Bool_t AliHFAODMCParticleContainer::IsSpecialPDG(const AliAODMCParticle* part) const
169 {
170  if (fSpecialPDG == 0) return kFALSE;
171 
172  Int_t partPdgCode = TMath::Abs(part->PdgCode());
173 
174  if (partPdgCode != fSpecialPDG) return kFALSE;
175 
176  if (!part->IsPrimary()) return kFALSE;
177 
179 
180  if ((origin & fRejectedOrigin) != 0) return kFALSE;
181 
183 
184  if ((decayChannel & fAcceptedDecay) == 0) return kFALSE;
185 
186  AliDebug(2, Form("Including particle %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
187  part->Label(), partPdgCode, part->Pt(), part->Eta(), part->Phi()));
188 
189  // Special PDG particle
190  return kTRUE;
191 }
192 
197 {
198  for (auto part : accepted()) {
199  if (IsSpecialPDG(part)) return kTRUE;
200  }
201  return kFALSE;
202 }
AliHFAODMCParticleContainer()
This is the default constructor, used for ROOT I/O purposes.
Analysis task for D meson jets.
virtual AliAODMCParticle * GetMCParticle(Int_t i=-1) const
virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
virtual Bool_t ApplyParticleCuts(const AliVParticle *vp, UInt_t &rejectionReason) const
virtual Bool_t ApplyMCParticleCuts(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
virtual Bool_t AcceptMCParticle(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.
Bool_t IsSpecialPDG(const AliAODMCParticle *part) const
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
virtual Bool_t GetMomentumFromParticle(TLorentzVector &mom, const AliVParticle *part, Double_t mass) const
virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector &mom, UInt_t &rejectionReason) const
void SelectCharmtoD0toKpi()
Automatically sets parameters to select only the decay chain c->D0->Kpi.
Container for MC-true particles within the EMCAL framework.
const AliMCParticleIterableContainer accepted() const
static EMesonOrigin_t CheckOrigin(const AliAODMCParticle *part, TClonesArray *mcArray)