AliPhysics  b43479f (b43479f)
 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 
73 {
74  UInt_t rejectionReason = 0;
75  return AliMCParticleContainer::AcceptMCParticle(vp, rejectionReason);
76 }
77 
86 {
87  // Determine whether the MC particle is accepted.
88  UInt_t rejectionReason = 0;
89 
90  AliAODMCParticle* part = static_cast<AliAODMCParticle*>(fClArray->At(i));
91 
92  Int_t partPdgCode = TMath::Abs(part->PdgCode());
93 
94  Bool_t isSpecialPdg = (fSpecialPDG != 0 && partPdgCode == fSpecialPDG && part->IsPrimary());
95 
96  if (isSpecialPdg) {
98 
99  if ((origin & fRejectedOrigin) != 0) isSpecialPdg = kFALSE;
100 
102 
103  if ((decayChannel & fAcceptedDecay) == 0) isSpecialPdg = kFALSE;
104 
105  AliDebug(2, Form("Including particle %d (PDG = %d, pT = %.3f, eta = %.3f, phi = %.3f)",
106  part->Label(), partPdgCode, part->Pt(), part->Eta(), part->Phi()));
107 
108  // Special PDG particle. Apply generator cut and kinematic cuts.
109 
110  if (fGeneratorIndex >= 0 && fGeneratorIndex != part->GetGeneratorIndex()) {
111  rejectionReason |= kMCGeneratorCut;
112  return kFALSE;
113  }
114 
115  AliTLorentzVector mom;
116  GetMomentum(mom, i);
117  return ApplyKinematicCuts(mom, rejectionReason);
118  }
119 
120  if (IsSpecialPDGDaughter(part)) {
121  rejectionReason = kHFCut;
122  return kFALSE; // daughter of a special PDG particle, reject it.
123  }
124 
125  // Not a special PDG particle, and not a daughter of a special PDG particle. Apply regular cuts.
126  return AliMCParticleContainer::AcceptMCParticle(i, rejectionReason);
127 }
128 
133 Bool_t AliHFAODMCParticleContainer::IsSpecialPDGDaughter(AliAODMCParticle* part) const
134 {
135  if (fSpecialPDG == 0) return kTRUE;
136 
137  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<AliAODMCParticle*>(fClArray->At(imo));
143  if (TMath::Abs(pm->GetPdgCode()) == fSpecialPDG && pm->IsPrimary()) {
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 
AliHFAODMCParticleContainer()
This is the default constructor, used for ROOT I/O purposes.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Analysis task for D meson jets.
Bool_t IsSpecialPDGDaughter(AliAODMCParticle *part) const
static EMesonOrigin_t CheckOrigin(AliAODMCParticle *part, TClonesArray *mcArray)
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...
static EMesonDecayChannel_t CheckDecayChannel(AliAODMCParticle *part, TClonesArray *mcArray)
void SelectCharmtoDStartoKpipi()
Automatically sets parameters to select only the decay chain c->D*->Kpipi.
Bool_t AcceptMCParticle(AliAODMCParticle *vp)
UInt_t fRejectedOrigin
Bit mask with D meson origins that are rejected.
Select MC particles based on specific prescriptions of HF analysis.
void SelectCharmtoD0toKpi()
Automatically sets parameters to select only the decay chain c->D0->Kpi.
Container for MC-true particles within the EMCAL framework.