AliPhysics  ff1d528 (ff1d528)
 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  fHistOrigin(0)
33 {
34  // Constructor.
35 }
36 
42  fSpecialPDG(0),
43  fRejectedOrigin(AliAnalysisTaskDmesonJets::kUnknownQuark | AliAnalysisTaskDmesonJets::kFromBottom),
44  fAcceptedDecay(AliAnalysisTaskDmesonJets::kAnyDecay),
45  fHistOrigin(0)
46 {
47  // Constructor.
48 }
49 
50 
53 {
54  SetSpecialPDG(421);
56  SetRejectDfromB(kTRUE);
58  SetKeepOnlyDfromB(kFALSE);
59 }
60 
63 {
64  SetSpecialPDG(413);
66  SetRejectDfromB(kTRUE);
68  SetKeepOnlyDfromB(kFALSE);
69 }
70 
78 Bool_t AliHFAODMCParticleContainer::AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
79 {
80  // Return true if vp is accepted.
81 
82  if (IsSpecialPDGDaughter(vp)) {
83  rejectionReason |= kHFCut;
84  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
85  }
86 
87  if (IsSpecialPDG(vp)) {
88  // Special PDG particle, skip regular MC particle cuts and apply kinematic cuts.
89  // For the future, may want to implement special kinematic cuts for D mesons
91  GetMomentumFromParticle(mom, vp);
92  return ApplyKinematicCuts(mom, rejectionReason);
93  }
94  else {
95  return AliMCParticleContainer::AcceptMCParticle(vp, rejectionReason);
96  }
97 }
98 
107 {
108  // Return true if vp is accepted.
109 
110  AliAODMCParticle* vp = GetMCParticle(i);
111 
112  if (IsSpecialPDGDaughter(vp)) {
113  rejectionReason = kHFCut;
114  return kFALSE; // daughter of a special PDG particle, reject it without any other check.
115  }
116 
117  if (IsSpecialPDG(vp, fHistOrigin)) {
118  // Special PDG particle, skip regular MC particle cuts and apply particle cuts.
119  // For the future, may want to implement special kinematic cuts for D mesons
120  AliTLorentzVector mom;
121  GetMomentum(mom, i);
122  return ApplyKinematicCuts(mom, rejectionReason);
123  }
124  else {
125  return AliMCParticleContainer::AcceptMCParticle(i, rejectionReason);
126  }
127 }
128 
134 {
135  if (fSpecialPDG == 0) return kFALSE;
136 
137  const AliAODMCParticle* pm = part;
138  Int_t imo = -1;
139  while (pm != 0) {
140  imo = pm->GetMother();
141  if (imo < 0) break;
142  pm = static_cast<const AliAODMCParticle*>(fClArray->At(imo));
143  if (IsSpecialPDG(pm)) {
144  AliDebug(2, Form("Rejecting particle (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f) daughter of %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
145  part->PdgCode(), part->Pt(), part->Eta(), part->Phi(), imo, pm->PdgCode(), pm->Pt(), pm->Eta(), pm->Phi()));
146  return kTRUE;
147  }
148  }
149  return kFALSE;
150 }
151 
156 Bool_t AliHFAODMCParticleContainer::IsSpecialPDG(const AliAODMCParticle* part, TH1* histOrigin) const
157 {
158  if (fSpecialPDG == 0) return kFALSE;
159 
160  Int_t partPdgCode = TMath::Abs(part->PdgCode());
161 
162  if (partPdgCode != fSpecialPDG) return kFALSE;
163 
164  if (!part->IsPrimary()) return kFALSE;
165 
166  auto origin = AliAnalysisTaskDmesonJets::AnalysisEngine::CheckOrigin(part, fClArray);
167 
168  if (histOrigin) {
169  UInt_t rs = origin.first;
170  UShort_t p = 0;
171  while (rs >>= 1) { p++; }
172  histOrigin->Fill(p);
173  }
174 
175  if ((origin.first & fRejectedOrigin) != 0) return kFALSE;
176 
178 
179  if (fAcceptedDecay && (decayChannel & fAcceptedDecay) == 0) return kFALSE;
180 
181  AliDebug(2, Form("Including particle %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
182  part->Label(), partPdgCode, part->Pt(), part->Eta(), part->Phi()));
183 
184  // Special PDG particle
185  return kTRUE;
186 }
187 
192 {
193  for (auto part : accepted()) {
194  if (IsSpecialPDG(part)) return kTRUE;
195  }
196  return kFALSE;
197 }
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 AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
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
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.
static std::pair< AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle * > CheckOrigin(const AliAODMCParticle *part, TClonesArray *mcArray, Bool_t firstParton=kFALSE)
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
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.
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