AliPhysics  608b256 (608b256)
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  fRejectISR(kFALSE),
33  fHistOrigin(0)
34 {
35  // Constructor.
36 }
37 
43  fSpecialPDG(0),
44  fRejectedOrigin(AliAnalysisTaskDmesonJets::kUnknownQuark | AliAnalysisTaskDmesonJets::kFromBottom),
45  fAcceptedDecay(AliAnalysisTaskDmesonJets::kAnyDecay),
46  fRejectISR(kFALSE),
47  fHistOrigin(0)
48 {
49  // Constructor.
50 }
51 
52 
55 {
56  SetSpecialPDG(421);
58  SetRejectDfromB(kTRUE);
60  SetKeepOnlyDfromB(kFALSE);
61 }
62 
65 {
66  SetSpecialPDG(413);
68  SetRejectDfromB(kTRUE);
70  SetKeepOnlyDfromB(kFALSE);
71 }
72 
80 Bool_t AliHFAODMCParticleContainer::AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
81 {
82  // Return true if vp is accepted.
83 
84  if (IsSpecialPDGDaughter(vp)) {
85  rejectionReason |= kHFCut;
86  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
87  }
88 
89  if (IsSpecialPDG(vp)) {
90  // Special PDG particle, skip regular MC particle cuts and apply kinematic cuts.
91  // For the future, may want to implement special kinematic cuts for D mesons
93  GetMomentumFromParticle(mom, vp);
94  return ApplyKinematicCuts(mom, rejectionReason);
95  }
96  else {
97  return AliMCParticleContainer::AcceptMCParticle(vp, rejectionReason);
98  }
99 }
100 
109 {
110  // Return true if vp is accepted.
111 
112  AliAODMCParticle* vp = GetMCParticle(i);
113 
114  if (IsSpecialPDGDaughter(vp)) {
115  rejectionReason = kHFCut;
116  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
117  }
118 
119  if (IsSpecialPDG(vp, fHistOrigin)) {
120  // Special PDG particle, skip regular MC particle cuts and apply particle cuts.
121  // For the future, may want to implement special kinematic cuts for D mesons
122  AliTLorentzVector mom;
123  GetMomentum(mom, i);
124  return ApplyKinematicCuts(mom, rejectionReason);
125  }
126  else {
127  return AliMCParticleContainer::AcceptMCParticle(i, rejectionReason);
128  }
129 }
130 
136 {
137  if (fSpecialPDG == 0) return kFALSE;
138 
139  const AliAODMCParticle* pm = part;
140  Int_t imo = -1;
141  while (pm != 0) {
142  imo = pm->GetMother();
143  if (imo < 0) break;
144  pm = static_cast<const AliAODMCParticle*>(fClArray->At(imo));
145  if (IsSpecialPDG(pm)) {
146  AliDebug(2, Form("Rejecting particle (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f) daughter of %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
147  part->PdgCode(), part->Pt(), part->Eta(), part->Phi(), imo, pm->PdgCode(), pm->Pt(), pm->Eta(), pm->Phi()));
148  return kTRUE;
149  }
150  }
151  return kFALSE;
152 }
153 
158 Bool_t AliHFAODMCParticleContainer::IsSpecialPDG(const AliAODMCParticle* part, TH1* histOrigin) const
159 {
160  if (fSpecialPDG == 0) return kFALSE;
161 
162  Int_t partPdgCode = TMath::Abs(part->PdgCode());
163 
164  if (partPdgCode != fSpecialPDG) return kFALSE;
165 
166  if (!part->IsPrimary()) return kFALSE;
167 
168  if (fRejectISR) {
169  // proton has PDG code 2212
170  std::set<UInt_t> pdgSet = {2212};
172  if (origin) return kFALSE;
173  }
174 
176 
177  if (histOrigin) {
178  UInt_t rs = origin.first;
179  UShort_t p = 0;
180  while (rs >>= 1) { p++; }
181  histOrigin->Fill(p);
182  }
183 
184  if ((origin.first & fRejectedOrigin) != 0) return kFALSE;
185 
187 
188  if (fAcceptedDecay && (decayChannel & fAcceptedDecay) == 0) return kFALSE;
189 
190  AliDebug(2, Form("Including particle %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
191  part->Label(), partPdgCode, part->Pt(), part->Eta(), part->Phi()));
192 
193  // Special PDG particle
194  return kTRUE;
195 }
196 
201 {
202  for (auto part : accepted()) {
203  if (IsSpecialPDG(part)) return kTRUE;
204  }
205  return kFALSE;
206 }
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
Bool_t fRejectISR
Reject initial state radiation.
virtual Bool_t AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
static std::pair< AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle * > IsPromptCharm(const AliAODMCParticle *part, TClonesArray *mcArray)
Bool_t IsSpecialPDGDaughter(const AliAODMCParticle *part) const
virtual Bool_t AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
UInt_t fAcceptedDecay
Bit mask with D meson decays that are accepted.
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
static AliAODMCParticle * FindParticleOrigin(const AliAODMCParticle *part, TClonesArray *mcArray, EFindParticleOriginMode_t mode, const std::set< UInt_t > &pdgSet)
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)
virtual Bool_t GetMomentumFromParticle(TLorentzVector &mom, const AliVParticle *part, Double_t mass) const
Bool_t IsSpecialPDG(const AliAODMCParticle *part, TH1 *histOrigin=0) const
unsigned short UShort_t
Definition: External.C:28
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.
TClonesArray * fClArray
! Pointer to array in input event
bool Bool_t
Definition: External.C:53
Container for MC-true particles within the EMCAL framework.
const AliMCParticleIterableContainer accepted() const
Definition: External.C:196
TH1 * fHistOrigin
! Book-keeping histogram with origin of special PDG particles