ATLAS Offline Software
Loading...
Searching...
No Matches
MCTruthPartClassifier Namespace Reference

Classes

struct  ParticleDef
 Human-readable names for the values of ParticleType, ParticleOrigin and ParticleOutCome. More...

Enumerations

enum  ParticleType : unsigned int {
  Unknown = 0 , UnknownElectron = 1 , IsoElectron = 2 , NonIsoElectron = 3 ,
  BkgElectron = 4 , UnknownMuon = 5 , IsoMuon = 6 , NonIsoMuon = 7 ,
  BkgMuon = 8 , UnknownTau = 9 , IsoTau = 10 , NonIsoTau = 11 ,
  BkgTau = 12 , UnknownPhoton = 13 , IsoPhoton = 14 , NonIsoPhoton = 15 ,
  BkgPhoton = 16 , Hadron = 17 , Neutrino = 18 , NuclFrag = 19 ,
  NonPrimary = 20 , GenParticle = 21 , SUSYParticle = 22 , OtherBSMParticle = 39 ,
  BBbarMesonPart = 23 , BottomMesonPart = 24 , CCbarMesonPart = 25 , CharmedMesonPart = 26 ,
  BottomBaryonPart = 27 , CharmedBaryonPart = 28 , StrangeBaryonPart = 29 , LightBaryonPart = 30 ,
  StrangeMesonPart = 31 , LightMesonPart = 32 , BJet = 33 , CJet = 34 ,
  LJet = 35 , GJet = 36 , TauJet = 37 , UnknownJet = 38
}
 Type of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the first member of the returned pair). More...
enum  ParticleOrigin : unsigned int {
  NonDefined = 0 , SingleElec = 1 , SingleMuon = 2 , SinglePhot = 3 ,
  SingleTau = 4 , PhotonConv = 5 , DalitzDec = 6 , ElMagProc = 7 ,
  Mu = 8 , TauLep = 9 , top = 10 , QuarkWeakDec = 11 ,
  WBoson = 12 , ZBoson = 13 , Higgs = 14 , HiggsMSSM = 15 ,
  HeavyBoson = 16 , WBosonLRSM = 17 , NuREle = 18 , NuRMu = 19 ,
  NuRTau = 20 , LQ = 21 , SUSY = 22 , OtherBSM = 46 ,
  LightMeson = 23 , StrangeMeson = 24 , CharmedMeson = 25 , BottomMeson = 26 ,
  CCbarMeson = 27 , JPsi = 28 , BBbarMeson = 29 , LightBaryon = 30 ,
  StrangeBaryon = 31 , CharmedBaryon = 32 , BottomBaryon = 33 , PionDecay = 34 ,
  KaonDecay = 35 , BremPhot = 36 , PromptPhot = 37 , UndrPhot = 38 ,
  ISRPhot = 39 , FSRPhot = 40 , NucReact = 41 , PiZero = 42 ,
  DiBoson = 43 , ZorHeavyBoson = 44 , MultiBoson = 47 , QCD = 45
}
 Origin of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the second member of the returned pair). More...
enum  ParticleOutCome : unsigned int {
  NonDefinedOutCome = 0 , UnknownOutCome = 1 , UnConverted = 2 , Converted = 3 ,
  NonInteract = 4 , NuclInteraction = 5 , ElectrMagInter = 6 , DecaytoElectron = 7 ,
  DecaytoMuon = 8 , OneProng = 9 , ThreeProng = 10 , FiveProng = 11
}
 Outcome of a (simulated) truth particle: what happened to it after being produced, determined from its decay or end vertex (second member of IMCTruthClassifier::Info). More...
enum  MCTC_bits : unsigned int {
  HadTau =0 , Tau , hadron , frombsm ,
  uncat , isbsm , isgeant , stable ,
  totalBits
}
 Bit positions in the classification word returned by defOrigOfParticle(). More...

Functions

static ParticleOrigin defOrigOfElectron (const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
static ParticleOrigin defOrigOfMuon (const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
static ParticleOrigin defOrigOfTau (const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, int ancestorPDGin, ParticleOutCome &outCome)
static ParticleOrigin defOrigOfPhoton (const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
static ParticleOrigin defOrigOfNeutrino (const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
std::pair< ParticleType, ParticleOrigin > classifyTruthParticle (const xAOD::TruthParticleContainer &truthParticleContainer, const xAOD::TruthParticle *const thePart, ParticleOutCome &outCome)
 Classify thePart (not nullptr), using truthParticleContainer to look up its ancestors.
ParticleOrigin convHadronTypeToOrig (ParticleType pType, int motherPDG)
 Convert a hadron ParticleType to a ParticleOrigin (JPsi if a c-cbar meson has a J/psi mother).
ParticleOrigin defHadronType (int pdg)
 Classify a hadron by PDG ID into a ParticleOrigin (NonDefined if none applies).
ParticleType defTypeOfHadron (int pdg)
 Classify a hadron by PDG ID into a ParticleType (Unknown if none applies).
ParticleType defTypeOfElectron (ParticleOrigin EleOrig, bool isPrompt)
 Classify an electron (Unknown/Iso/NonIso/Bkg) from its origin; prompt electrons are always Iso.
ParticleType defTypeOfMuon (ParticleOrigin MuOrig, bool isPrompt)
 Classify a muon (Unknown/Iso/NonIso/Bkg) from its origin; prompt muons are always Iso.
ParticleType defTypeOfTau (ParticleOrigin TauOrig)
 Classify a tau (Unknown/Iso/NonIso/Bkg) from its origin.
ParticleType defTypeOfPhoton (ParticleOrigin PhotOrig)
 Classify a photon (Unknown/Iso/NonIso/Bkg) from its origin.
template<class T>
ParticleOrigin defJetOrig (const T &allJetMothers)
 Determine a jet's origin from its mother particles (Higgs/BSM mothers return immediately; otherwise the last matching top, Z or W mother wins, with W not overriding top, and QCD only if none of them was found).
template<class T>
std::tuple< unsigned int, T > defOrigOfParticle (T thePart)
 Classify a particle into a bit-word (see MCTC_bits).
int isPrompt (const unsigned int classify, bool allow_prompt_tau_decays=true)
 Tell whether a particle is prompt, from the word returned by defOrigOfParticle().
template<class T>
ParticleOutCome defOutComeOfElectron (T thePart)
 Determine the outcome of a simulated electron from its end vertex (NonInteract, ElectrMagInter, NuclInteraction or UnknownOutCome).
template<class T>
ParticleOutCome defOutComeOfMuon (T thePart)
 Determine the outcome of a simulated muon from its end vertex (NonInteract, DecaytoElectron, NuclInteraction or UnknownOutCome).
template<class T>
ParticleOutCome defOutComeOfTau (T thePart)
 Determine the outcome of a simulated tau from its decay products (NonInteract, NuclInteraction, DecaytoElectron/Muon, One/Three/FiveProng or UnknownOutCome).
template<class T>
ParticleOutCome defOutComeOfPhoton (T thePart)
 Determine the outcome of a simulated photon from its end vertex (UnConverted, Converted, NuclInteraction or UnknownOutCome).

Enumeration Type Documentation

◆ MCTC_bits

enum MCTruthPartClassifier::MCTC_bits : unsigned int

Bit positions in the classification word returned by defOrigOfParticle().

The word is an unsigned int whose bit i is set when the property i below holds (e.g. test it with std::bitset<MCTC_bits::totalBits>(word).test(MCTC_bits::hadron)). The numeric values are 1 << position: HadTau = 1, Tau = 2, hadron = 4, frombsm = 8, uncat = 16, isbsm = 32, isgeant = 64, stable = 128. The word is stored by the egamma, MCTC decoration and derivation code, so the positions must not be changed. The ancestry bits (HadTau, Tau, hadron, frombsm) are only filled for a physical particle with a production vertex that is not a simulation (Geant) particle; otherwise only uncat is set, together with the particle-level bits stable, isgeant and isbsm.

Enumerator
HadTau 

Descends from a hadron and from a tau: a hadronic tau decay product (hadron && Tau).

Tau 

A tau is among the ancestors, or the parents of an ancestor, that were walked on the way up (product of a tau decay).

hadron 

The particle is a hadron (not a beam particle) or descends from one (non-prompt); unset for prompt particles.

frombsm 

A BSM particle is among the ancestors walked, or the particle is itself BSM.

uncat 

Uncategorised: the particle is not physical (neither stable nor decayed), has no production vertex or is a simulation particle; the ancestry bits are then not set.

isbsm 

The particle itself is a BSM particle.

isgeant 

The particle is produced by the detector simulation (e.g. Geant4), not by the generator.

stable 

The particle is physical: stable or decayed (MC::isPhysical), not an intermediate or documentation entry. Despite the name this includes decayed particles.

totalBits 

Number of bits (not a property).

Definition at line 167 of file TruthClassifiers.h.

167 : unsigned int {
168 HadTau=0,
169 Tau,
170 hadron,
171 frombsm,
172 uncat,
173 isbsm,
174 isgeant,
175 stable,
176 totalBits
177 };
@ frombsm
A BSM particle is among the ancestors walked, or the particle is itself BSM.
@ isbsm
The particle itself is a BSM particle.
@ HadTau
Descends from a hadron and from a tau: a hadronic tau decay product (hadron && Tau).
@ hadron
The particle is a hadron (not a beam particle) or descends from one (non-prompt); unset for prompt pa...
@ totalBits
Number of bits (not a property).
@ stable
The particle is physical: stable or decayed (MC::isPhysical), not an intermediate or documentation en...
@ uncat
Uncategorised: the particle is not physical (neither stable nor decayed), has no production vertex or...
@ isgeant
The particle is produced by the detector simulation (e.g. Geant4), not by the generator.

◆ ParticleOrigin

Origin of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the second member of the returned pair).

For leptons and photons it names the process or the particle whose decay produced them, found by walking up the history to the first ancestor that is not a copy of the same particle (and skipping through intermediate W, tau and muon decays). Where an origin is a hadron class (LightMeson ... BBbarMeson), it is the class of that ancestor. Sherpa and MadGraph records, which lack explicit intermediate bosons, are recognised from the multiplicity of the hard-process vertex.

Enumerator
NonDefined 

Origin could not be determined (no production vertex, no ancestor, or particle not classified).

SingleElec 

Single-electron particle gun: production vertex with no mother and one outgoing particle.

SingleMuon 

Single-muon particle gun.

SinglePhot 

Single-photon particle gun.

SingleTau 

Single-tau particle gun.

PhotonConv 

Photon conversion (gamma -> e+ e-, or gamma -> mu+ mu- for muons).

DalitzDec 

Dalitz decay of a pi0 (pi0 -> gamma e+ e-, or pi0 -> e+ e- e+ e-).

ElMagProc 

Electromagnetic or nuclear material process: bremsstrahlung/pair production in the detector, Compton scattering, nuclear photo-fission, hadron-nucleus interaction.

Mu 

Decay (or radiation) of a muon.

TauLep 

Decay (or radiation) of a tau lepton that is not itself prompt.

top 

Decay of a top quark (including through W).

QuarkWeakDec 

Weak decay of a quark: q -> q' l nu with a single other quark in the final state.

WBoson 

W boson decay (including Sherpa W records and W+gamma).

ZBoson 

Z boson (or Z/gamma*) decay (including Sherpa Z records and Z+gamma).

Higgs 

Higgs boson decay (SM Higgs, PDG 25).

HiggsMSSM 

Decay of an extra (MSSM/2HDM) Higgs boson: H (35), A (36) or H+ (37).

HeavyBoson 

Decay of a heavy gauge boson Z', Z'', W'+ (PDG 32, 33, 34), or a KK graviton (5100039) in the photon case.

WBosonLRSM 

Decay of the W_R boson of the left-right symmetric model (Pythia-specific PDG 9900024).

NuREle 

Decay of a right-handed electron neutrino (Pythia-specific PDG 9900012), or of a W_R decaying to it.

NuRMu 

Decay of a right-handed muon neutrino (Pythia-specific PDG 9900014).

NuRTau 

Decay of a right-handed tau neutrino (Pythia-specific PDG 9900016).

LQ 

Leptoquark: the ancestor is a leptoquark, or the decay vertex contains one.

SUSY 

Decay of a SUSY particle.

OtherBSM 

Decay of a non-SUSY BSM particle (added later, hence the out-of-order value).

LightMeson 

Decay of a light (u, d only) meson.

StrangeMeson 

Decay of a meson containing s quark (e.g. kaon).

CharmedMeson 

Decay of an open-charm meson.

BottomMeson 

Decay of an open-bottom meson.

CCbarMeson 

Decay of a hidden-charm meson other than J/psi.

JPsi 

Decay of a J/psi.

BBbarMeson 

Decay of a hidden-bottom meson.

LightBaryon 

Decay of a light (u, d only) baryon.

StrangeBaryon 

Decay of a strange baryon.

CharmedBaryon 

Decay of a charmed baryon.

BottomBaryon 

Decay of a bottom baryon.

PionDecay 

Muon from pi -> mu nu in flight.

KaonDecay 

Muon from K -> mu nu in flight.

BremPhot 

Bremsstrahlung photon: the mother continues as a copy of itself plus this photon.

PromptPhot 

Prompt (direct) photon of the hard process, e.g. Pythia8 gamma+jet.

UndrPhot 

"Underlying" photon: radiated from a quark or gluon in the parton shower/underlying event

ISRPhot 

Initial-state radiation photon (quark/gluon mother whose copy is a Herwig cluster).

FSRPhot 

Final-state radiation photon, e.g. from the leptons of W/Z/H decays or from Photos.

NucReact 

Photon from a nuclear reaction in the material.

PiZero 

Photon from a pi0 decay.

DiBoson 

Two-boson (WW, WZ, ZZ) production recorded without explicit bosons: four leptons/neutrinos in the hard-process vertex.

ZorHeavyBoson 

UNUSED: never returned by the classifier; only compared against in defTypeOfElectron/Muon/Tau.

MultiBoson 

Three or more bosons (VVV, 4-top with leptonic W decays): six or eight leptons/neutrinos in the hard-process vertex.

QCD 

Jet origin: a quark or gluon mother (see defJetOrig); only assigned by the jet classifier, never to leptons or photons.

Definition at line 80 of file TruthClasses.h.

80 : unsigned int {
81 NonDefined = 0,
82
83 SingleElec = 1,
84 SingleMuon = 2,
85 SinglePhot = 3,
86 SingleTau = 4,
87
88 PhotonConv = 5,
89 DalitzDec = 6,
90 ElMagProc = 7,
91 Mu = 8,
92 TauLep = 9,
93 top = 10,
94 QuarkWeakDec = 11,
95 WBoson = 12,
96 ZBoson = 13,
97 Higgs = 14,
98 HiggsMSSM = 15,
99 HeavyBoson = 16,
100 WBosonLRSM = 17,
101 NuREle = 18,
102 NuRMu = 19,
103 NuRTau = 20,
104 LQ = 21,
105
106 SUSY = 22,
107 OtherBSM = 46,
108 LightMeson = 23,
109 StrangeMeson = 24,
110 CharmedMeson = 25,
111 BottomMeson = 26,
112 CCbarMeson = 27,
113 JPsi = 28,
114 BBbarMeson = 29,
115 LightBaryon = 30,
116 StrangeBaryon = 31,
117 CharmedBaryon = 32,
118 BottomBaryon = 33,
119 PionDecay = 34,
120 KaonDecay = 35,
121 BremPhot = 36,
122 PromptPhot = 37,
123 UndrPhot = 38,
124 ISRPhot = 39,
125 FSRPhot = 40,
126 NucReact = 41,
127 PiZero = 42,
128 DiBoson = 43,
129 ZorHeavyBoson = 44,
130 MultiBoson = 47,
131 QCD = 45
132 };
@ BottomMeson
Decay of an open-bottom meson.
@ ElMagProc
Electromagnetic or nuclear material process: bremsstrahlung/pair production in the detector,...
@ LightBaryon
Decay of a light (u, d only) baryon.
@ UndrPhot
"Underlying" photon: radiated from a quark or gluon in the parton shower/underlying event
@ WBosonLRSM
Decay of the W_R boson of the left-right symmetric model (Pythia-specific PDG 9900024).
@ JPsi
Decay of a J/psi.
@ ZBoson
Z boson (or Z/gamma*) decay (including Sherpa Z records and Z+gamma).
@ BBbarMeson
Decay of a hidden-bottom meson.
@ ISRPhot
Initial-state radiation photon (quark/gluon mother whose copy is a Herwig cluster).
@ PromptPhot
Prompt (direct) photon of the hard process, e.g. Pythia8 gamma+jet.
@ BremPhot
Bremsstrahlung photon: the mother continues as a copy of itself plus this photon.
@ StrangeMeson
Decay of a meson containing s quark (e.g. kaon).
@ DiBoson
Two-boson (WW, WZ, ZZ) production recorded without explicit bosons: four leptons/neutrinos in the har...
@ Higgs
Higgs boson decay (SM Higgs, PDG 25).
@ CharmedBaryon
Decay of a charmed baryon.
@ StrangeBaryon
Decay of a strange baryon.
@ LightMeson
Decay of a light (u, d only) meson.
@ HiggsMSSM
Decay of an extra (MSSM/2HDM) Higgs boson: H (35), A (36) or H+ (37).
@ ZorHeavyBoson
UNUSED: never returned by the classifier; only compared against in defTypeOfElectron/Muon/Tau.
@ LQ
Leptoquark: the ancestor is a leptoquark, or the decay vertex contains one.
@ BottomBaryon
Decay of a bottom baryon.
@ PhotonConv
Photon conversion (gamma -> e+ e-, or gamma -> mu+ mu- for muons).
@ NuREle
Decay of a right-handed electron neutrino (Pythia-specific PDG 9900012), or of a W_R decaying to it.
@ TauLep
Decay (or radiation) of a tau lepton that is not itself prompt.
@ NuRMu
Decay of a right-handed muon neutrino (Pythia-specific PDG 9900014).
@ KaonDecay
Muon from K -> mu nu in flight.
@ FSRPhot
Final-state radiation photon, e.g. from the leptons of W/Z/H decays or from Photos.
@ WBoson
W boson decay (including Sherpa W records and W+gamma).
@ Mu
Decay (or radiation) of a muon.
@ OtherBSM
Decay of a non-SUSY BSM particle (added later, hence the out-of-order value).
@ NuRTau
Decay of a right-handed tau neutrino (Pythia-specific PDG 9900016).
@ NonDefined
Origin could not be determined (no production vertex, no ancestor, or particle not classified).
@ PiZero
Photon from a pi0 decay.
@ CharmedMeson
Decay of an open-charm meson.
@ NucReact
Photon from a nuclear reaction in the material.
@ SingleElec
Single-electron particle gun: production vertex with no mother and one outgoing particle.
@ CCbarMeson
Decay of a hidden-charm meson other than J/psi.
@ top
Decay of a top quark (including through W).
@ DalitzDec
Dalitz decay of a pi0 (pi0 -> gamma e+ e-, or pi0 -> e+ e- e+ e-).
@ QuarkWeakDec
Weak decay of a quark: q -> q' l nu with a single other quark in the final state.
@ SingleTau
Single-tau particle gun.
@ HeavyBoson
Decay of a heavy gauge boson Z', Z'', W'+ (PDG 32, 33, 34), or a KK graviton (5100039) in the photon ...
@ SingleMuon
Single-muon particle gun.
@ QCD
Jet origin: a quark or gluon mother (see defJetOrig); only assigned by the jet classifier,...
@ SinglePhot
Single-photon particle gun.
@ PionDecay
Muon from pi -> mu nu in flight.
@ MultiBoson
Three or more bosons (VVV, 4-top with leptonic W decays): six or eight leptons/neutrinos in the hard-...

◆ ParticleOutCome

Outcome of a (simulated) truth particle: what happened to it after being produced, determined from its decay or end vertex (second member of IMCTruthClassifier::Info).

The defOutComeOf<X> functions in TruthClassifiers.h assign it for electrons, muons, taus and photons.

Enumerator
NonDefinedOutCome 

UNUSED: never assigned; the default of IMCTruthClassifier::Info::particleOutCome is UnknownOutCome.

UnknownOutCome 

End vertex exists, but its content matches none of the patterns below.

UnConverted 

Photon without an end vertex: it did not convert.

Converted 

Photon converted: end vertex has exactly one e+ and one e-.

NonInteract 

Particle without an end vertex (survived the detector) – also used for neutrinos.

NuclInteraction 

Interaction with nuclei: the end vertex contains hadrons, nucleons or nuclear fragments.

ElectrMagInter 

Electron that only scattered electromagnetically: its end vertex has one electron and nothing else.

DecaytoElectron 

Muon decayed to e nu_e nu_mu, or tau decayed to e nu nu (with optional photons).

DecaytoMuon 

Tau decayed to mu nu nu (with optional photons).

OneProng 

Tau decayed hadronically with one charged pion or kaon.

ThreeProng 

Tau decayed hadronically with three charged pions or kaons.

FiveProng 

Tau decayed hadronically with five charged pions or kaons.

Definition at line 139 of file TruthClasses.h.

139 : unsigned int {
141 UnknownOutCome = 1,
142 UnConverted = 2,
143 Converted = 3,
144 NonInteract = 4,
145 NuclInteraction = 5,
146 ElectrMagInter = 6,
147 DecaytoElectron = 7,
148 DecaytoMuon = 8,
149 OneProng = 9,
150 ThreeProng = 10,
151 FiveProng = 11
152 };
@ ThreeProng
Tau decayed hadronically with three charged pions or kaons.
@ DecaytoMuon
Tau decayed to mu nu nu (with optional photons).
@ NonInteract
Particle without an end vertex (survived the detector) – also used for neutrinos.
@ NonDefinedOutCome
UNUSED: never assigned; the default of IMCTruthClassifier::Info::particleOutCome is UnknownOutCome.
@ Converted
Photon converted: end vertex has exactly one e+ and one e-.
@ DecaytoElectron
Muon decayed to e nu_e nu_mu, or tau decayed to e nu nu (with optional photons).
@ NuclInteraction
Interaction with nuclei: the end vertex contains hadrons, nucleons or nuclear fragments.
@ FiveProng
Tau decayed hadronically with five charged pions or kaons.
@ UnConverted
Photon without an end vertex: it did not convert.
@ UnknownOutCome
End vertex exists, but its content matches none of the patterns below.
@ ElectrMagInter
Electron that only scattered electromagnetically: its end vertex has one electron and nothing else.
@ OneProng
Tau decayed hadronically with one charged pion or kaon.

◆ ParticleType

Type of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the first member of the returned pair).

Lepton and photon types come in four flavours, decided from the particle's ParticleOrigin (see defTypeOfElectron, defTypeOfMuon, defTypeOfTau, defTypeOfPhoton in TruthClassifiers.h):

  • Unknown<X>: the origin could not be determined (ParticleOrigin::NonDefined);
  • Iso<X>: isolated/prompt, i.e. from the hard process (W, Z, top, Higgs, SUSY, other BSM, ...), or a single particle gun;
  • NonIso<X>: non-isolated, from the decay of a heavy-flavour hadron, a tau or a muon, or from a quark weak decay;
  • Bkg<X>: background, i.e. everything else (conversions, Dalitz decays, material interactions, light hadron decays, ...). Particles for which the classifier does not even try to find an origin get one of the generic types (Hadron ... UnknownJet), or Unknown.
Enumerator
Unknown 

Not classified: not a lepton, photon, neutrino or hadron (e.g. a quark, a gluon, a boson), or no result.

UnknownElectron 

Electron with undefined origin (no production vertex, or origin could not be traced).

IsoElectron 

Isolated (prompt) electron, e.g. from W/Z/H/top/BSM decay, or a single-electron particle gun.

NonIsoElectron 

Non-isolated electron from J/psi, B/D hadron, tau, muon or quark weak decay.

BkgElectron 

Background electron: photon conversion, Dalitz decay, material interaction, light-hadron decay, ...

UnknownMuon 

Muon with undefined origin.

IsoMuon 

Isolated (prompt) muon.

NonIsoMuon 

Non-isolated muon from J/psi, B/D hadron, tau or quark weak decay.

BkgMuon 

Background muon: pion/kaon decay in flight and other remaining cases.

UnknownTau 

Tau with undefined origin.

IsoTau 

Isolated (prompt) tau.

NonIsoTau 

Non-isolated tau from J/psi, B/D hadron or quark weak decay.

BkgTau 

Background tau (remaining cases).

UnknownPhoton 

Photon with undefined origin.

IsoPhoton 

Isolated (prompt) photon: from W/Z/H/BSM decay, a hard-process prompt photon, or a single-photon gun.

NonIsoPhoton 

Non-isolated photon: initial/final-state radiation, or from tau, muon or right-handed neutrino/W_R decay.

BkgPhoton 

Background photon: bremsstrahlung, pi0 decay, hadron decay, nuclear reaction, underlying-event photon, ...

Hadron 

Any hadron (neither the beam nor a nuclear fragment); the origin is not studied further.

Neutrino 

Neutrino (an origin is determined for it, see ParticleOrigin).

NuclFrag 

Nuclear fragment: a nucleus other than a proton, produced in a material interaction.

NonPrimary 

Not a primary particle: a copy produced by the simulation (e.g. Geant4) with no production vertex, or the re-generated copy of its own mother.

GenParticle 

Generator-level intermediate particle (decayed, or otherwise not a final-state candidate) that is not classified further.

SUSYParticle 

Stable SUSY particle (e.g. the LSP).

OtherBSMParticle 

Stable non-SUSY BSM particle (added later, hence the out-of-order value).

BBbarMesonPart 

Hidden-bottom meson (e.g. Upsilon, chi_b).

BottomMesonPart 

Open-bottom meson (B, B_s, B_c).

CCbarMesonPart 

Hidden-charm meson (e.g. J/psi, chi_c).

CharmedMesonPart 

Open-charm meson (D, D_s).

BottomBaryonPart 

Baryon containing a b quark.

CharmedBaryonPart 

Baryon containing a c quark (and no b).

StrangeBaryonPart 

Baryon containing an s quark (and no c, b).

LightBaryonPart 

Baryon made of u and d quarks only.

StrangeMesonPart 

Meson containing an s quark (and no c, b), e.g. a kaon.

LightMesonPart 

Meson made of u and d quarks only, e.g. a pion.

BJet 

Jet containing a b-hadron (jet overload of the classifier; DR-matched or constituent truth particles).

CJet 

Jet with a c-hadron and no b-hadron (jet overload of the classifier).

LJet 

Jet with only light/strange hadrons (jet overload of the classifier).

GJet 

UNUSED: never assigned or checked anywhere in Athena (gluon jet).

TauJet 

UNUSED: never assigned or checked anywhere in Athena (hadronic tau jet).

UnknownJet 

Jet with no classifiable hadron among its constituents (also the initial value of the jet classifier).

Definition at line 26 of file TruthClasses.h.

26 : unsigned int {
27 Unknown = 0,
28 UnknownElectron = 1,
29 IsoElectron = 2,
30 NonIsoElectron = 3,
31 BkgElectron = 4,
32 UnknownMuon = 5,
33 IsoMuon = 6,
34 NonIsoMuon = 7,
35 BkgMuon = 8,
36 UnknownTau = 9,
37 IsoTau = 10,
38 NonIsoTau = 11,
39 BkgTau = 12,
40 UnknownPhoton = 13,
41 IsoPhoton = 14,
42 NonIsoPhoton = 15,
43 BkgPhoton = 16,
44 Hadron = 17,
45 Neutrino = 18,
46 NuclFrag = 19,
47 NonPrimary = 20,
48 GenParticle = 21,
49 SUSYParticle = 22,
50 OtherBSMParticle = 39,
51 BBbarMesonPart = 23,
52 BottomMesonPart = 24,
53 CCbarMesonPart = 25,
54 CharmedMesonPart = 26,
55 BottomBaryonPart = 27,
58 LightBaryonPart = 30,
59 StrangeMesonPart = 31,
60 LightMesonPart = 32,
61 BJet = 33,
62 CJet = 34,
63 LJet = 35,
64 GJet = 36,
65 TauJet = 37,
66 UnknownJet = 38
67 };
@ BkgTau
Background tau (remaining cases).
@ BBbarMesonPart
Hidden-bottom meson (e.g. Upsilon, chi_b).
@ Unknown
Not classified: not a lepton, photon, neutrino or hadron (e.g. a quark, a gluon, a boson),...
@ LJet
Jet with only light/strange hadrons (jet overload of the classifier).
@ Neutrino
Neutrino (an origin is determined for it, see ParticleOrigin).
@ LightMesonPart
Meson made of u and d quarks only, e.g. a pion.
@ GJet
UNUSED: never assigned or checked anywhere in Athena (gluon jet).
@ TauJet
UNUSED: never assigned or checked anywhere in Athena (hadronic tau jet).
@ CharmedMesonPart
Open-charm meson (D, D_s).
@ NonPrimary
Not a primary particle: a copy produced by the simulation (e.g. Geant4) with no production vertex,...
@ IsoPhoton
Isolated (prompt) photon: from W/Z/H/BSM decay, a hard-process prompt photon, or a single-photon gun.
@ StrangeBaryonPart
Baryon containing an s quark (and no c, b).
@ IsoTau
Isolated (prompt) tau.
@ UnknownMuon
Muon with undefined origin.
@ NuclFrag
Nuclear fragment: a nucleus other than a proton, produced in a material interaction.
@ StrangeMesonPart
Meson containing an s quark (and no c, b), e.g. a kaon.
@ CCbarMesonPart
Hidden-charm meson (e.g. J/psi, chi_c).
@ NonIsoPhoton
Non-isolated photon: initial/final-state radiation, or from tau, muon or right-handed neutrino/W_R de...
@ BkgPhoton
Background photon: bremsstrahlung, pi0 decay, hadron decay, nuclear reaction, underlying-event photon...
@ NonIsoMuon
Non-isolated muon from J/psi, B/D hadron, tau or quark weak decay.
@ OtherBSMParticle
Stable non-SUSY BSM particle (added later, hence the out-of-order value).
@ BottomBaryonPart
Baryon containing a b quark.
@ UnknownJet
Jet with no classifiable hadron among its constituents (also the initial value of the jet classifier)...
@ BkgMuon
Background muon: pion/kaon decay in flight and other remaining cases.
@ NonIsoTau
Non-isolated tau from J/psi, B/D hadron or quark weak decay.
@ CharmedBaryonPart
Baryon containing a c quark (and no b).
@ IsoElectron
Isolated (prompt) electron, e.g. from W/Z/H/top/BSM decay, or a single-electron particle gun.
@ IsoMuon
Isolated (prompt) muon.
@ NonIsoElectron
Non-isolated electron from J/psi, B/D hadron, tau, muon or quark weak decay.
@ GenParticle
Generator-level intermediate particle (decayed, or otherwise not a final-state candidate) that is not...
@ UnknownPhoton
Photon with undefined origin.
@ SUSYParticle
Stable SUSY particle (e.g. the LSP).
@ UnknownElectron
Electron with undefined origin (no production vertex, or origin could not be traced).
@ BottomMesonPart
Open-bottom meson (B, B_s, B_c).
@ Hadron
Any hadron (neither the beam nor a nuclear fragment); the origin is not studied further.
@ BkgElectron
Background electron: photon conversion, Dalitz decay, material interaction, light-hadron decay,...
@ BJet
Jet containing a b-hadron (jet overload of the classifier; DR-matched or constituent truth particles)...
@ UnknownTau
Tau with undefined origin.
@ CJet
Jet with a c-hadron and no b-hadron (jet overload of the classifier).
@ LightBaryonPart
Baryon made of u and d quarks only.

Function Documentation

◆ classifyTruthParticle()

std::pair< ParticleType, ParticleOrigin > MCTruthPartClassifier::classifyTruthParticle ( const xAOD::TruthParticleContainer & truthParticleContainer,
const xAOD::TruthParticle *const thePart,
ParticleOutCome & outCome )

Classify thePart (not nullptr), using truthParticleContainer to look up its ancestors.

Fills outCome with what happened to the particle in the simulation.

Definition at line 29 of file MCTruthClassifierGen.cxx.

31 {
32 ParticleType partType = Unknown;
33 ParticleOrigin partOrig = NonDefined;
34
35 if (!MC::isStable(thePart) && !MC::isDecayed(thePart)) {
36 return std::make_pair(GenParticle, partOrig);
37 }
38 const bool isPartHadr = MC::isHadron(thePart) && !MC::isBeam(thePart);
39 if (MC::isDecayed(thePart) && (!MC::isTau(thePart) && !isPartHadr)) return std::make_pair(GenParticle, partOrig);
40
41 // SUSY datasets: tau(status==2)->tau(status==2)
42 if (MC::isDecayed(thePart) && MC::isTau(thePart)) {
43 const xAOD::TruthVertex* endVert = thePart->decayVtx();
44 if (endVert) {
45 if (endVert->nOutgoingParticles() == 1 && MC::isTau(endVert->outgoingParticle(0))) {
46 return std::make_pair(GenParticle, partOrig);
47 }
48 }
49 }
50
51 if (MC::isStable(thePart) && MC::isSUSY(thePart)) return std::make_pair(SUSYParticle, partOrig);
52
53 if (MC::isStable(thePart) && MC::isBSM(thePart)) return std::make_pair(OtherBSMParticle, partOrig);
54
55 if (MC::isDecayed(thePart) &&
56 (!MC::isElectron(thePart) && !MC::isMuon(thePart) &&
57 !MC::isTau(thePart) && !MC::isPhoton(thePart)) &&
58 !isPartHadr)
59 return std::make_pair(GenParticle, partOrig);
60
61 // FIXME vetoing protons here to preserve previous behaviour
62 if (MC::isNucleus(thePart) && std::abs(thePart->pdgId()) != MC::PROTON) return std::make_pair(NuclFrag, partOrig);
63
64 if ( !MC::isSMLepton(thePart) && !MC::isPhoton(thePart) && !isPartHadr) return std::make_pair(partType, partOrig);
65 // don't consider generator particles
66
67 const xAOD::TruthVertex* partProdVtx = thePart->hasProdVtx() ? thePart->prodVtx() : nullptr;
68
70 if (partProdVtx) {
71 for (const auto& temp: partProdVtx->particles_in()) {if (temp) parent = temp;}
72 }
73 const int parentPDG = parent?parent->pdg_id():0;
74
75 if (!partProdVtx && HepMC::is_simulation_particle(thePart)) {
76 return std::make_pair(NonPrimary, partOrig);
77 }
78 if (!partProdVtx && MC::isElectron(thePart)) {
79 // to define electron outcome status
80 bool isPrompt = false; // updated by defOrigOfElectron
81 partOrig = defOrigOfElectron(truthParticleContainer, thePart, isPrompt, outCome);
82 return std::make_pair(UnknownElectron, partOrig);
83 }
84 if (!partProdVtx && MC::isMuon(thePart)) {
85 // to define electron outcome status
86 bool isPrompt = false; // updated by defOrigOfMuon
87 partOrig = defOrigOfMuon(truthParticleContainer, thePart, isPrompt, outCome);
88 return std::make_pair(UnknownMuon, partOrig);
89 }
90 if (!partProdVtx && MC::isTau(thePart)) {
91 // to define electron outcome status
92 partOrig = defOrigOfTau(truthParticleContainer, thePart, parentPDG, outCome);
93 return std::make_pair(UnknownTau, partOrig);
94 }
95 if (!partProdVtx && MC::isPhoton(thePart)) {
96 // to define photon outcome
97 bool isPrompt = false; // updated by defOrigOfPhoton
98 partOrig = defOrigOfPhoton(truthParticleContainer, thePart, isPrompt, outCome);
99 return std::make_pair(UnknownPhoton, partOrig);
100 }
101 if (!partProdVtx && MC::isNeutrino(thePart)) {
102 // to define neutrino outcome
103 outCome = NonInteract;
104 return std::make_pair(Neutrino, partOrig);
105 }
106
107 if (parent && HepMC::is_same_generator_particle(thePart, parent))
108 return std::make_pair(NonPrimary, partOrig);
109
110 if (isPartHadr) return std::make_pair(Hadron, partOrig);
111
112 if (partProdVtx && parentPDG == 0 && partProdVtx->nOutgoingParticles() == 1 &&
113 partProdVtx->nIncomingParticles() == 0) {
114 if (MC::isElectron(thePart)) {
115 outCome = defOutComeOfElectron(thePart);
116 return std::make_pair(IsoElectron, SingleElec);
117 }
118 if (MC::isMuon(thePart)) {
119 outCome = defOutComeOfMuon(thePart);
120 return std::make_pair(IsoMuon, SingleMuon);
121 }
122 if (MC::isTau(thePart)) {
123 outCome = defOutComeOfTau(thePart);
124 return std::make_pair(IsoTau, SingleTau);
125 }
126 if (MC::isPhoton(thePart)) {
127 outCome = defOutComeOfPhoton(thePart);
128 return std::make_pair(IsoPhoton, SinglePhot);
129 }
130 }
131
132 if (parentPDG == thePart->pdg_id() && parent && parent->status() == 3 && MC::isDecayed(thePart)) return std::make_pair(GenParticle, partOrig);
133
134 if (MC::isElectron(thePart)) {
135 bool isPrompt = false; // updated by defOrigOfElectron
136 partOrig = defOrigOfElectron(truthParticleContainer, thePart, isPrompt, outCome);
137 partType = defTypeOfElectron(partOrig, isPrompt);
138 } else if (MC::isMuon(thePart)) {
139 bool isPrompt = false; // updated by defOrigOfMuon
140 partOrig = defOrigOfMuon(truthParticleContainer, thePart, isPrompt, outCome);
141 partType = defTypeOfMuon(partOrig, isPrompt);
142 } else if (MC::isTau(thePart)) {
143 partOrig = defOrigOfTau(truthParticleContainer, thePart, parentPDG, outCome);
144 partType = defTypeOfTau(partOrig);
145 } else if (MC::isPhoton(thePart)) {
146 bool isPrompt = false; // updated by defOrigOfPhoton
147 partOrig = defOrigOfPhoton(truthParticleContainer, thePart, isPrompt, outCome);
148 partType = defTypeOfPhoton(partOrig);
149 } else if (MC::isNeutrino(thePart)) {
150 bool isPrompt = false; // updated by defOrigOfNeutrino
151 partOrig = defOrigOfNeutrino(truthParticleContainer, thePart, isPrompt, outCome);
152 partType = Neutrino;
153 }
154
155 // particleTruthClassifier succeeded
156 return std::make_pair(partType, partOrig);
157}
int pdgId() const
PDG ID code.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
int pdg_id() const
PDG ID code.
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
size_t nIncomingParticles() const
Get the number of incoming particles.
std::vector< const TruthParticle * > particles_in() const
Get the incoming particles.
bool is_same_generator_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same generated particle.
bool is_simulation_particle(const T &p)
Method to establish if a particle was created during the simulation (based on the status value).
ParticleOutCome defOutComeOfElectron(T thePart)
Determine the outcome of a simulated electron from its end vertex (NonInteract, ElectrMagInter,...
ParticleOutCome defOutComeOfPhoton(T thePart)
Determine the outcome of a simulated photon from its end vertex (UnConverted, Converted,...
static ParticleOrigin defOrigOfNeutrino(const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
ParticleType defTypeOfPhoton(ParticleOrigin PhotOrig)
Classify a photon (Unknown/Iso/NonIso/Bkg) from its origin.
ParticleOutCome defOutComeOfTau(T thePart)
Determine the outcome of a simulated tau from its decay products (NonInteract, NuclInteraction,...
ParticleType defTypeOfTau(ParticleOrigin TauOrig)
Classify a tau (Unknown/Iso/NonIso/Bkg) from its origin.
static ParticleOrigin defOrigOfTau(const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, int ancestorPDGin, ParticleOutCome &outCome)
ParticleType defTypeOfMuon(ParticleOrigin MuOrig, bool isPrompt)
Classify a muon (Unknown/Iso/NonIso/Bkg) from its origin; prompt muons are always Iso.
ParticleOrigin
Origin of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the second mem...
static ParticleOrigin defOrigOfMuon(const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
static ParticleOrigin defOrigOfPhoton(const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
int isPrompt(const unsigned int classify, bool allow_prompt_tau_decays=true)
Tell whether a particle is prompt, from the word returned by defOrigOfParticle().
ParticleOutCome defOutComeOfMuon(T thePart)
Determine the outcome of a simulated muon from its end vertex (NonInteract, DecaytoElectron,...
ParticleType defTypeOfElectron(ParticleOrigin EleOrig, bool isPrompt)
Classify an electron (Unknown/Iso/NonIso/Bkg) from its origin; prompt electrons are always Iso.
ParticleType
Type of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the first member...
static ParticleOrigin defOrigOfElectron(const xAOD::TruthParticleContainer &xTruthParticleContainer, const xAOD::TruthParticle *thePart, bool &isPrompt, ParticleOutCome &outCome)
bool isSMLepton(const T &p)
APID: the fourth generation leptons are not standard model leptons.
bool isPhoton(const T &p)
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isMuon(const T &p)
bool isSUSY(const T &p)
bool isDecayed(const T &p)
Identify if the particle decayed.
bool isBeam(const T &p)
Identify if the particle is beam particle.
bool isHadron(const T &p)
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
bool isTau(const T &p)
static const int PROTON
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ convHadronTypeToOrig()

ParticleOrigin MCTruthPartClassifier::convHadronTypeToOrig ( ParticleType pType,
int motherPDG )
inline

Convert a hadron ParticleType to a ParticleOrigin (JPsi if a c-cbar meson has a J/psi mother).

Definition at line 15 of file TruthClassifiers.h.

16{
17 if (pType == CCbarMesonPart && abs(motherPDG) == MC::JPSI) return JPsi;
18 if (pType == BBbarMesonPart) return BBbarMeson;
19 if (pType == BottomMesonPart) return BottomMeson;
20 if (pType == BottomBaryonPart) return BottomBaryon;
21 if (pType == CCbarMesonPart) return CCbarMeson;
22 if (pType == CharmedMesonPart) return CharmedMeson;
23 if (pType == CharmedBaryonPart) return CharmedBaryon;
24 if (pType == StrangeBaryonPart) return StrangeBaryon;
25 if (pType == StrangeMesonPart) return StrangeMeson;
26 if (pType == LightBaryonPart) return LightBaryon;
27 if (pType == LightMesonPart) return LightMeson;
28 return NonDefined;
29}
static const int JPSI

◆ defHadronType()

ParticleOrigin MCTruthPartClassifier::defHadronType ( int pdg)
inline

Classify a hadron by PDG ID into a ParticleOrigin (NonDefined if none applies).

Definition at line 32 of file TruthClassifiers.h.

32 {
33 if (abs(pdg) == MC::JPSI) return JPsi;
34 if (MC::isBBbarMeson(pdg)) return BBbarMeson;
35 if (MC::isCCbarMeson(pdg)) return CCbarMeson;
36 if (MC::isBottomMeson(pdg)) return BottomMeson;
37 if (MC::isCharmMeson(pdg)) return CharmedMeson;
38 if (MC::isBottomBaryon(pdg)) return BottomBaryon;
39 if (MC::isCharmBaryon(pdg)) return CharmedBaryon;
40 if (MC::isStrangeBaryon(pdg)) return StrangeBaryon;
41 if (MC::isLightBaryon(pdg)) return LightBaryon;
42 if (MC::isStrangeMeson(pdg)) return StrangeMeson;
43 if (MC::isLightMeson(pdg)) return LightMeson;
44 return NonDefined;
45}
bool isStrangeBaryon(const T &p)
bool isLightBaryon(const T &p)
bool isLightMeson(const T &p)
bool isStrangeMeson(const T &p)
bool isBottomMeson(const T &p)
bool isCharmBaryon(const T &p)
bool isCCbarMeson(const T &p)
bool isBottomBaryon(const T &p)
bool isCharmMeson(const T &p)
bool isBBbarMeson(const T &p)

◆ defJetOrig()

template<class T>
ParticleOrigin MCTruthPartClassifier::defJetOrig ( const T & allJetMothers)

Determine a jet's origin from its mother particles (Higgs/BSM mothers return immediately; otherwise the last matching top, Z or W mother wins, with W not overriding top, and QCD only if none of them was found).

Definition at line 138 of file TruthClassifiers.h.

138 {
139 ParticleOrigin partOrig = NonDefined;
140 for (const auto& it: allJetMothers) {
141 int pdg = abs(it->pdg_id());
142 if (MC::isTop(pdg)) partOrig = top;
143 if (MC::isZ(pdg)) partOrig = ZBoson;
144 if (MC::isW(pdg) && !(partOrig == top)) partOrig = WBoson;
145 if ((MC::isQuark(pdg) || MC::isGluon(pdg)) && partOrig != top && partOrig != ZBoson && partOrig != WBoson) partOrig = QCD;
146 if (MC::isHiggs(pdg)) return Higgs;
147 if (pdg == 35 || pdg == 36 || pdg == 37) return HiggsMSSM;
148 if (pdg == 32 || pdg == 33 || pdg == 34) return HeavyBoson;
149 if (pdg == 42) return LQ;
150 if (MC::isSUSY(pdg)) return SUSY;
151 if (MC::isBSM(pdg)) return OtherBSM;
152 }
153 return partOrig;
154}
bool isZ(const T &p)
bool isW(const T &p)
bool isTop(const T &p)
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do ...
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
bool isGluon(const T &p)

◆ defOrigOfElectron()

ParticleOrigin MCTruthPartClassifier::defOrigOfElectron ( const xAOD::TruthParticleContainer & xTruthParticleContainer,
const xAOD::TruthParticle * thePart,
bool & isPrompt,
ParticleOutCome & outCome )
static

Definition at line 159 of file MCTruthClassifierGen.cxx.

163{
164 // Executing DefOrigOfElectron
165
166 // Find the first copy of this particle stored in the xAOD::TruthParticleContainer (i.e. the particle prior to any interactions)
167 const xAOD::TruthParticle* thePriPart = MC::findMatching(xTruthParticleContainer, thePart);
168 if (!thePriPart) return NonDefined;
169 if (!MC::isElectron(thePriPart)) return NonDefined;
170
171 //-- to define electron outcome status
172 outCome = defOutComeOfElectron(thePriPart);
173
174 const xAOD::TruthVertex* partProdVtx = thePriPart->hasProdVtx() ? thePriPart->prodVtx() : nullptr;
175 if (!partProdVtx) return NonDefined;
176
177
178 const xAOD::TruthParticle* ancestor = MC::findMother(thePriPart);
179 if (!ancestor) { return NonDefined; } // After this point "ancestor" cannot be nullptr
180
181 // Start of method 1 of protecting against loops
182 bool samePart = MC::TruthLoopDetectionMethod1(partProdVtx, ancestor);
183 // to resolve Sherpa loop
184 // End of method 1 of protecting against loops
185
186 if ((MC::isMuon(ancestor) || MC::isTau(ancestor) || MC::isW(ancestor)) && ancestor->hasProdVtx() && !samePart) {
187 int pPDG(0);
188 const xAOD::TruthParticle* ancestorParent{};
189 do {
190 pPDG = 0; // reset pPDG
191 ancestorParent = MC::findMother(ancestor);
192 // Start of method 2 of protecting against loops
193 // to prevent Sherpa loop
194 if (ancestor == ancestorParent) { break; }
195 if (MC::TruthLoopDetectionMethod2(ancestor,ancestorParent)) {
196 ancestorParent = ancestor;
197 break;
198 }
199 // End of method 2 of protecting against loops
200 // FIXME why are slightly different criteria used in method 1 and method 2???
201 if (ancestorParent) {
202 pPDG = ancestorParent->pdgId(); // Only set pPDG in the case that we aren't in a loop.
203 if (MC::isMuon(pPDG) || MC::isTau(pPDG) || MC::isW(pPDG)) { // There will be another iteration so set ancestor to ancestorParent
204 ancestor = ancestorParent; // ancestorParent is not nullptr here
205 }
206 }
207 } while ((MC::isMuon(pPDG) || MC::isTau(pPDG) || MC::isW(pPDG)));
208
209 if (MC::isMuon(pPDG) || MC::isTau(pPDG) || MC::isW(pPDG) || MC::isZ(pPDG) || MC::isHiggs(pPDG) ||
210 MC::isMSSMHiggs(pPDG) || MC::isHeavyBoson(pPDG) || MC::isTop(pPDG) || // MSSM Higgs bosons, Heavy bosons( Z', Z'', W'+)
211 std::abs(pPDG) == MC::WBOSON_LRSM || MC::isNeutrinoRH(pPDG) || // Left-right symmetric model WBoson || Right-handed neutrino (Pythia-specific)
212 MC::isSUSY(pPDG)) {
213 ancestor = ancestorParent; // ancestorParent is not nullptr here
214 }
215 }
216
217 const int ancestorPDG = ancestor->pdgId();
218 const xAOD::TruthVertex* ancestorProdVtx = ancestor->hasProdVtx() ? ancestor->prodVtx() : nullptr;
219 partProdVtx = ancestor->decayVtx();
220 const int numOfParents = partProdVtx->nIncomingParticles();
221 const int numberOfChildren = partProdVtx->nOutgoingParticles();
222
223 // Determine decay products
224 auto DP = DecayProducts(partProdVtx);
225 const int NumOfPhot = DP.pd(MC::PHOTON);
226 const int NumOfEl = DP.pd(MC::ELECTRON);
227 const int NumOfPos = DP.pd(MC::POSITRON);
228 const int NumOfquark = DP.apd({MC::DQUARK,MC::UQUARK,MC::SQUARK,MC::CQUARK,MC::BQUARK,MC::TQUARK});
229 const int NumOfgluon = DP.apd(MC::GLUON);
230 const int NumOfElNeut = DP.apd(MC::NU_E);
231 const int NumOfLQ = DP.apd(MC::LEPTOQUARK);
232 const int NumOfMuPl = DP.pd(-MC::MUON);
233 const int NumOfMuMin = DP.pd(MC::MUON);
234 const int NumOfMuNeut = DP.apd(MC::NU_MU);
235 const int NumOfTau = DP.apd(MC::TAU);
236 const int NumOfTauNeut = DP.apd(MC::NU_TAU);
237
238 samePart = false;
239 int NumOfNucFr(0);
240 const bool possibleNuclearFragment = (numOfParents == 1 && (MC::isPhoton(ancestorPDG) || MC::isElectron(ancestorPDG) || MC::isMuon(ancestorPDG) || std::abs(ancestorPDG) == MC::PIPLUS));
241 for (const auto& aChild: partProdVtx->particles_out()) {
242 if (!aChild) continue;
243 const int childPDG = aChild->pdgId();
244 if (std::abs(childPDG) == std::abs(ancestorPDG) && HepMC::is_same_generator_particle(aChild, ancestor )) samePart = true;
245 if (possibleNuclearFragment &&
246 (MC::isNucleus(childPDG) || childPDG == 0 || childPDG == MC::PROTON || childPDG == MC::NEUTRON || // FIXME Do we really expect particles with PDG_ID = 0 in the truth record?
247 std::abs(childPDG) == MC::PIPLUS || std::abs(childPDG) == MC::PI0))
248 NumOfNucFr++;
249 }
250 // End of section determining decay products
251
252 if ((MC::isPhoton(ancestorPDG) && numberOfChildren == 2 && NumOfEl == 1 && NumOfPos == 1) || (MC::isPhoton(ancestorPDG) && numberOfChildren == 1 && (NumOfEl == 1 || NumOfPos == 1))) return PhotonConv;
253
254 // e,gamma,pi+Nuclear->NuclearFragments+nuclons+e
255 if ((numOfParents == 1 && (MC::isPhoton(ancestorPDG) || MC::isElectron(ancestorPDG) || MC::isTau(ancestorPDG))) && numberOfChildren > 1 && NumOfNucFr != 0) return ElMagProc;
256
257 if (numOfParents == 1 && std::abs(ancestorPDG) == MC::PIPLUS && numberOfChildren > 2 && NumOfNucFr != 0) return ElMagProc;
258
259 // nuclear photo fission
260 if (MC::isPhoton(ancestorPDG) && numberOfChildren > 4 && NumOfNucFr != 0) return ElMagProc;
261
262 // unknown process el(pos)->el+pos??
263 if (MC::isElectron(ancestorPDG) && numberOfChildren == 2 && NumOfEl == 1 && NumOfPos == 1) return ElMagProc;
264
265 // unknown process el->el+el??
266 if (ancestorPDG == MC::ELECTRON && numberOfChildren == 2 && NumOfEl == 2 && NumOfPos == 0) return ElMagProc;
267
268 // unknown process pos->pos+pos??
269 if (ancestorPDG == MC::POSITRON && numberOfChildren == 2 && NumOfEl == 0 && NumOfPos == 2) return ElMagProc;
270
271 // unknown process pos/el->pos/el??
272 if (MC::isElectron(ancestorPDG) && !MC::isDecayed(ancestor) && ancestorPDG == thePriPart->pdgId() && numberOfChildren == 1 && !samePart) return ElMagProc;
273
274 // pi->pi+e+/e-; mu->mu+e+/e- ;
275 // gamma+ atom->gamma(the same) + e (compton scattering)
276 if (numberOfChildren == 2 && (NumOfEl == 1 || NumOfPos == 1) && !MC::isElectron(ancestorPDG) && samePart) return ElMagProc;
277
278 if ((ancestorPDG == MC::PI0 && numberOfChildren == 3 && NumOfPhot == 1 && NumOfEl == 1 && NumOfPos == 1) ||
279 (ancestorPDG == MC::PI0 && numberOfChildren == 4 && NumOfPhot == 0 && NumOfEl == 2 && NumOfPos == 2))
280 return DalitzDec;
281
282 // Quark weak decay
283 if (MC::isSMQuark(ancestorPDG) && numOfParents == 1 && numberOfChildren == 3 && NumOfquark == 1 && NumOfElNeut == 1) return QuarkWeakDec;
284
285 if (MC::isMuon(ancestorPDG) && NumOfNucFr != 0) return ElMagProc;
286
287 if (MC::isTop(ancestorPDG)) return top;
288
289 if (MC::isW(ancestorPDG) && ancestorProdVtx && ancestorProdVtx->nIncomingParticles() != 0) {
290
291 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
292 const xAOD::TruthParticle* ptrPart{};
293 do {
294 ptrPart = prodVert->incomingParticle(0); // FIXME just taking the first one
295 prodVert = ptrPart->hasProdVtx() ? ptrPart->prodVtx() : nullptr;
296 } while (MC::isW(ptrPart) && prodVert);
297
298 if (prodVert && prodVert->nIncomingParticles() == 1) {
299 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
300 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
301 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
302 }
303 return WBoson;
304 }
305 if (MC::isW(ancestorPDG)) return WBoson;
306 if (MC::isZ(ancestorPDG)) return ZBoson;
307
308 // MadGraphPythia ZWW*->lllnulnu
309 if (numOfParents == 1 && numberOfChildren > 4 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG))) {
310
311 const xAOD::TruthParticle* thePartToCheck = thePriPart;
312 const xAOD::TruthParticle* theParent = thePriPart->hasProdVtx() ? thePriPart->prodVtx()->incomingParticle(0) : nullptr; // FIXME just taking the first one
313 if (theParent && MC::isElectron(theParent) && MC::isDecayed(theParent)) { thePartToCheck = theParent; }
314
315 bool isZboson = false;
316 bool isWboson = false;
317 bool skipnext = false;
318
319 for (unsigned int ipOut = 0; ipOut + 1 < partProdVtx->nOutgoingParticles(); ++ipOut) {
320 const xAOD::TruthParticle* aChild = partProdVtx->outgoingParticle(ipOut);
321 if (!aChild) continue;
322 const xAOD::TruthParticle* theNextChild = nullptr;
323 for (unsigned int ipOut1 = ipOut + 1; ipOut1 < partProdVtx->nOutgoingParticles(); ipOut1++) {
324 theNextChild = partProdVtx->outgoingParticle(ipOut1);
325 if (theNextChild) break;
326 }
327 if (!theNextChild) continue;
328 if (skipnext) {
329 skipnext = false;
330 continue;
331 }
332
333 if (MC::isElectron(aChild) && MC::isElectron(theNextChild)) {
334 // Zboson
335 if (thePartToCheck == aChild || thePartToCheck == theNextChild) {
336 isZboson = true;
337 break;
338 }
339 skipnext = true;
340 } else if (MC::isElectron(aChild) && std::abs(theNextChild->pdgId()) == MC::NU_E) {
341 // WBoson
342 if (thePartToCheck == aChild || thePartToCheck == theNextChild) {
343 isWboson = true;
344 break;
345 }
346 skipnext = true;
347 }
348 }
349 if (isWboson) return WBoson;
350 if (isZboson) return ZBoson;
351 }
352 if (numOfParents == 2) {
353 //--Sherpa Z->ee
354 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && NumOfEl == 1 && NumOfPos == 1) return ZBoson;
355
356 //--Sherpa W->enu ??
357 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && (NumOfEl == 1 || NumOfPos == 1) && NumOfElNeut == 1) return WBoson;
358
359 const int pdg1 = partProdVtx->incomingParticle(0)->pdgId();
360 const int pdg2 = partProdVtx->incomingParticle(1)->pdgId();
361 //--Sherpa ZZ,ZW
362 if ((numberOfChildren - NumOfquark - NumOfgluon) == 4 &&
363 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 4) &&
364 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return DiBoson;
365
366 //--Sherpa VVV -- Note, have to allow for prompt photon radiation or these get lost
367 if ((numberOfChildren - NumOfquark - NumOfgluon - NumOfPhot) == 6 &&
368 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 6) &&
369 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return MultiBoson;
370
371 //--Sherpa tttt with all t->Wb; W->lnu
372 if ((numberOfChildren - NumOfquark - NumOfgluon) == 8 &&
373 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 8) &&
374 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) {
375 // MultiBoson for 4topLep
376 return MultiBoson;
377 }
378
379 //--Sherpa Vgamma ( Z->ee+gamma or W->enu+gamma )
380 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && NumOfEl == 1 && NumOfPos == 1) {
381 // Sherpa ee + gamma
382 return ZBoson;
383 }
384 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && (NumOfEl == 1 || NumOfPos == 1) && NumOfElNeut == 1) {
385 // Sherpa enu + gamma
386 return WBoson;
387 }
388 }
389
390 // New Sherpa Z->ee
391 if (partProdVtx == ancestorProdVtx) {
392 int NumOfEleLoop = 0;
393 int NumOfLepLoop = 0;
394 int NumOfEleNeuLoop = 0;
395 for (const auto *const pout: partProdVtx->particles_out()) {
396 if (!pout) continue;
397 for (const auto *const pin: partProdVtx->particles_in()) {
398 if (!pin) continue;
399 if (!HepMC::is_same_particle(pout,pin)) continue;
400 if (MC::isElectron(pout)) NumOfEleLoop++;
401 if (std::abs(pout->pdgId()) == MC::NU_E) NumOfEleNeuLoop++;
402 if (MC::isSMLepton(pout)) NumOfLepLoop++;
403 break; // break out of inner loop after having found two matching particles
404 }
405 }
406 if (NumOfEleLoop == 2 && NumOfEleNeuLoop == 0) return ZBoson;
407 if (NumOfEleLoop == 1 && NumOfEleNeuLoop == 1) return WBoson;
408 if ((NumOfEleLoop == 4 && NumOfEleNeuLoop == 0) || (NumOfEleLoop == 3 && NumOfEleNeuLoop == 1) ||
409 (NumOfEleLoop == 2 && NumOfEleNeuLoop == 2)) return DiBoson;
410 if (NumOfLepLoop == 4) return DiBoson;
411 }
412
413 //-- McAtNLo
414
415 if (MC::isHiggs(ancestorPDG)) return Higgs;
416
417 if (MC::isMSSMHiggs(ancestorPDG)) return HiggsMSSM; // MSSM Higgs bosons
418
419 if (MC::isHeavyBoson(ancestorPDG)) return HeavyBoson; // Heavy bosons( Z', Z'', W'+)
420
421 if (MC::isMuon(ancestorPDG)) return Mu;
422 if (MC::isTau(ancestorPDG)) {
423 const ParticleOrigin tauOrig = defOrigOfTau(xTruthParticleContainer, ancestor, ancestorPDG, outCome);
424 const ParticleType tautype = defTypeOfTau(tauOrig);
425 return (tautype == IsoTau)?tauOrig:TauLep;
426 }
427
428 if (std::abs(ancestorPDG) == MC::WBOSON_LRSM) return WBosonLRSM; // Left-right symmetric model WBoson (Pythia-specific)
429 if (std::abs(ancestorPDG) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
430 if (std::abs(ancestorPDG) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
431 if (std::abs(ancestorPDG) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
432 if (MC::isLeptoQuark(ancestorPDG) || NumOfLQ != 0) return LQ;
433 if (MC::isSUSY(ancestorPDG)) return SUSY;
434 if (MC::isBSM(ancestorPDG)) return OtherBSM;
435
436 const ParticleType pType = defTypeOfHadron(ancestorPDG);
437 if ((pType == BBbarMesonPart || pType == CCbarMesonPart) && ancestorProdVtx && MC::isHardScatteringVertex(ancestorProdVtx)) isPrompt = true;
438 return convHadronTypeToOrig(pType, ancestorPDG);
439}
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
std::vector< const TruthParticle * > particles_out() const
Get the outgoing particles.
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
ParticleOrigin convHadronTypeToOrig(ParticleType pType, int motherPDG)
Convert a hadron ParticleType to a ParticleOrigin (JPsi if a c-cbar meson has a J/psi mother).
@ SUSY
Decay of a SUSY particle.
ParticleType defTypeOfHadron(int pdg)
Classify a hadron by PDG ID into a ParticleType (Unknown if none applies).
static const int PI0
static const int UQUARK
T findMatching(C TruthContainer, T p)
Function to find in the container the particle that p descends from in the simulation (see HepMC::is_...
bool isNeutrinoRH(const T &p)
PDG rule 12: Occasionally program authors add their own states.
static const int SQUARK
static const int NEUTRON
static const int DQUARK
PDG Rule 1: Particles are given positive numbers, antiparticles negative numbers.
static const int MUON
bool TruthLoopDetectionMethod1(const V &childOrigVtx, const T &parent)
Method 1: true if the parent is among the children produced at the child's production vertex,...
Definition Loops.h:32
bool isHardScatteringVertex(T pVert)
Function to classify the vertex as hard scattering vertex.
static const int CQUARK
static const int PHOTON
static const int RH_NU_TAU
static const int WBOSON_LRSM
static const int TQUARK
static const int TAU
static const int GLUON
static const int ELECTRON
static const int PIPLUS
bool isSMQuark(const T &p)
bool TruthLoopDetectionMethod2(const T1 &child, const T2 &parent)
Method 2: true if the parent's production vertex is the child's decay vertex and the child's producti...
Definition Loops.h:47
static const int POSITRON
static const int NU_MU
bool isMSSMHiggs(const T &p)
APID: Additional Higgs bosons for MSSM (Used in MCTruthClassifier).
T findMother(T thePart)
Function to get a mother of particle. MCTruthClassifier legacy.
static const int NU_E
static const int BQUARK
static const int LEPTOQUARK
static const int NU_TAU
static const int RH_NU_MU
bool isHeavyBoson(const T &p)
APID: Additional "Heavy"/"prime" versions of W and Z bosons (Used in MCTruthClassifier).
bool isLeptoQuark(const T &p)
PDG rule 11c: “One-of-a-kind” exotic particles are assigned numbers in the range 41–80.
static const int RH_NU_E
PDG Rule 12: Occasionally program authors add their own states.

◆ defOrigOfMuon()

ParticleOrigin MCTruthPartClassifier::defOrigOfMuon ( const xAOD::TruthParticleContainer & xTruthParticleContainer,
const xAOD::TruthParticle * thePart,
bool & isPrompt,
ParticleOutCome & outCome )
static

Definition at line 442 of file MCTruthClassifierGen.cxx.

446{
447 // Executing DefOrigOfMuon
448
449 // Find the first copy of this particle stored in the xAOD::TruthParticleContainer (i.e. the particle prior to any interactions)
450 const xAOD::TruthParticle* thePriPart = MC::findMatching(xTruthParticleContainer, thePart);
451 if (!thePriPart) return NonDefined;
452 if (!MC::isMuon(thePriPart)) return NonDefined;
453
454 //-- to define muon outcome status
455 outCome = defOutComeOfMuon(thePriPart);
456
457 const xAOD::TruthVertex* partProdVtx = thePriPart->hasProdVtx() ? thePriPart->prodVtx() : nullptr;
458 if (!partProdVtx) return NonDefined;
459
460
461 const xAOD::TruthParticle* ancestor = MC::findMother(thePriPart);
462 if (!ancestor) { return NonDefined; } // ancestor is not a nullptr beyond this point
463
464 // "method 1" for finding Sherpa loops from defOrigOfElectron not used here. Why?
465
466 if ((MC::isTau(ancestor)|| MC::isW(ancestor)) && ancestor->hasProdVtx()) {
467 int pPDG(0);
468 const xAOD::TruthParticle* ancestorParent{};
469 do {
470 pPDG = 0;
471 ancestorParent = MC::findMother(ancestor);
472 // Start of method 2 of protecting against loops
473 // to prevent Sherpa loop
474 if (ancestor == ancestorParent) { break; }
475 if (MC::TruthLoopDetectionMethod2(ancestor,ancestorParent)) {
476 ancestorParent = ancestor;
477 break;
478 }
479 // End of method 2 of protecting against loops
480
481 if (ancestorParent) {
482 pPDG = ancestorParent->pdgId();// Only set pPDG in the case that we aren't in a loop.
483 if (MC::isMuon(pPDG) || MC::isTau(pPDG) || MC::isW(pPDG)) { // FIXME should this be (MC::isTau(pPDG) || MC::isW(pPDG)) ???
484 // There will be another iteration so set ancestor to ancestorParent
485 ancestor = ancestorParent; // ancestorParent is not nullptr here
486 }
487 }
488 } while ((MC::isMuon(pPDG) || MC::isTau(pPDG) || MC::isW(pPDG))); // FIXME should this be (MC::isTau(pPDG) || MC::isW(pPDG)) ???
489
490 if (MC::isTau(pPDG) || MC::isW(pPDG) || MC::isZ(pPDG) || MC::isHiggs(pPDG) ||
491 MC::isMSSMHiggs(pPDG) || MC::isHeavyBoson(pPDG) || MC::isTop(pPDG) || // MSSM Higgs bosons, Heavy bosons( Z', Z'', W'+)
492 std::abs(pPDG) == MC::WBOSON_LRSM || MC::isNeutrinoRH(pPDG) || // Left-right symmetric model WBoson || Right-handed neutrino (Pythia-specific)
493 MC::isSUSY(pPDG)) {
494 ancestor = ancestorParent; // ancestorParent is not nullptr here
495 }
496 }
497
498 const int ancestorPDG = ancestor->pdgId();
499 const xAOD::TruthVertex* ancestorProdVtx = ancestor->hasProdVtx() ? ancestor->prodVtx() : nullptr;
500 partProdVtx = ancestor->decayVtx();
501 const int numOfParents = partProdVtx->nIncomingParticles();
502 const int numberOfChildren = partProdVtx->nOutgoingParticles();
503
504 // Determine decay products
505 auto DP = DecayProducts(partProdVtx);
506 const int NumOfPhot = DP.pd(MC::PHOTON);
507 const int NumOfEl = DP.pd(MC::ELECTRON);
508 const int NumOfPos = DP.pd(MC::POSITRON);
509 const int NumOfElNeut = DP.apd(MC::NU_E);
510 const int NumOfMuNeut = DP.apd(MC::NU_MU);
511 const int NumOfLQ = DP.apd(MC::LEPTOQUARK);
512 const int NumOfquark = DP.apd({MC::DQUARK,MC::UQUARK,MC::SQUARK,MC::CQUARK,MC::BQUARK,MC::TQUARK});
513 const int NumOfgluon = DP.apd(MC::GLUON);
514 const int NumOfMuPl = DP.pd(-MC::MUON);
515 const int NumOfMuMin = DP.pd(MC::MUON);
516 const int NumOfTau = DP.apd(MC::TAU);
517 const int NumOfTauNeut = DP.apd(MC::NU_TAU);
518 // End of section determining decay products
519
520 if (std::abs(ancestorPDG) == MC::PIPLUS && numberOfChildren == 2 && NumOfMuNeut == 1) return PionDecay;
521 if (std::abs(ancestorPDG) == MC::KPLUS && numberOfChildren == 2 && NumOfMuNeut == 1) return KaonDecay;
522 if (MC::isTau(ancestorPDG)) {
523 const ParticleOrigin tauOrig = defOrigOfTau(xTruthParticleContainer, ancestor, ancestorPDG, outCome);
524 const ParticleType tautype = defTypeOfTau(tauOrig);
525 return (tautype == IsoTau)?tauOrig:TauLep;
526 }
527
528 if (MC::isTop(ancestorPDG)) return top;
529 // Quark weak decay
530 if (MC::isSMQuark(ancestorPDG) && numOfParents == 1 && numberOfChildren == 3 && NumOfquark == 1 && NumOfMuNeut == 1) return QuarkWeakDec;
531
532 if (MC::isW(ancestorPDG) && ancestorProdVtx && ancestorProdVtx->nIncomingParticles() != 0) {
533 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
534 const xAOD::TruthParticle* itrP;
535 do {
536 itrP = prodVert->incomingParticle(0); // FIXME just taking the first one
537 prodVert = itrP->hasProdVtx() ? itrP->prodVtx() : nullptr;
538 } while (MC::isW(itrP) && prodVert);
539
540 if (prodVert && prodVert->nIncomingParticles() == 1) {
541 if (std::abs(itrP->pdgId()) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
542 if (std::abs(itrP->pdgId()) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
543 if (std::abs(itrP->pdgId()) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
544 }
545 return WBoson;
546 }
547 if (MC::isW(ancestorPDG)) return WBoson;
548 if (MC::isZ(ancestorPDG)) return ZBoson;
549 if (MC::isPhoton(ancestorPDG) && numberOfChildren == 2 && NumOfMuMin == 1 && NumOfMuPl == 1) return PhotonConv;
550 //-- Exotics
551
552 // MadGraphPythia ZWW*->lllnulnu
553 if (numOfParents == 1 && numberOfChildren > 4 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG))) {
554 bool isZboson = false;
555 bool isWboson = false;
556 bool skipnext = false;
557 for (unsigned int ipOut = 0; ipOut + 1 < partProdVtx->nOutgoingParticles(); ipOut++) {
558 if (skipnext) {
559 skipnext = false;
560 continue;
561 }
562 const xAOD::TruthParticle* aChild = partProdVtx->outgoingParticle(ipOut);
563 if (!aChild) continue;
564 const xAOD::TruthParticle* theNextChild{};
565 for (unsigned int ipOut1 = ipOut + 1; ipOut1 < partProdVtx->nOutgoingParticles(); ipOut1++) {
566 theNextChild = partProdVtx->outgoingParticle(ipOut1);
567 if (theNextChild) break;
568 }
569 if (!theNextChild) continue;
570 if (MC::isMuon(aChild) && MC::isMuon(theNextChild)) {
571 // Zboson
572 if (thePriPart == aChild || thePriPart == theNextChild) {
573 isZboson = true;
574 break;
575 }
576 skipnext = true;
577 } else if (MC::isMuon(aChild) && std::abs(theNextChild->pdgId()) == MC::NU_MU) {
578 // WBoson
579 if (thePriPart == aChild || thePriPart == theNextChild) {
580 isWboson = true;
581 break;
582 }
583 skipnext = true;
584 }
585 }
586 if (isWboson) return WBoson;
587 if (isZboson) return ZBoson;
588 }
589 if (numOfParents == 2 ) {
590 //--Sherpa Z->mumu
591 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && NumOfMuPl == 1 && NumOfMuMin == 1) return ZBoson;
592
593 //--Sherpa W->munu ??
594 // if(numOfParents==2&&(numberOfChildren-NumOfquark-NumOfgluon)==2&&(NumOfEl==1||NumOfPos==1)&&NumOfElNeut==1) return WBoson;
595 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && (NumOfMuPl == 1 || NumOfMuMin == 1) && NumOfMuNeut == 1) return WBoson;
596
597 const int pdg1 = partProdVtx->incomingParticle(0)->pdgId();
598 const int pdg2 = partProdVtx->incomingParticle(1)->pdgId();
599 //--Sherpa ZZ,ZW
600 if ((numberOfChildren - NumOfquark - NumOfgluon) == 4 &&
601 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 4) &&
602 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return DiBoson;
603
604 //--Sherpa VVV -- Note, have to allow for prompt photon radiation or these get lost
605 if ((numberOfChildren - NumOfquark - NumOfgluon - NumOfPhot) == 6 &&
606 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 6) &&
607 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return MultiBoson;
608
609 //--Sherpa tttt with all t->Wb; W->lnu
610 if ((numberOfChildren - NumOfquark - NumOfgluon) == 8 &&
611 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 8) &&
612 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) {
613 // MultiBoson for 4topLep
614 return MultiBoson;
615 }
616
617 //--Sherpa Vgamma ( Z->ee+gamma or W->enu+gamma )
618 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && NumOfMuPl == 1 && NumOfMuMin == 1) {
619 // Sherpa mumu + gamma
620 return ZBoson;
621 }
622 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && (NumOfMuPl == 1 || NumOfMuMin == 1) && NumOfMuNeut == 1) {
623 // Sherpa munu + gamma
624 return WBoson;
625 }
626
627 }
628
629 //--New Sherpa Z->mumu
630 if (partProdVtx == ancestorProdVtx) {
631 int NumOfMuLoop = 0;
632 int NumOfMuNeuLoop = 0;
633 int NumOfLepLoop = 0;
634 for (const auto & pout: partProdVtx->particles_out()) {
635 if (!pout) continue;
636 for (const auto & pin: partProdVtx->particles_in()) {
637 if (!pin) continue;
638 if (HepMC::is_same_particle(pout,pin)) {
639 if (MC::isMuon(pout)) NumOfMuLoop++;
640 if (std::abs(pout->pdg_id()) == MC::NU_MU) NumOfMuNeuLoop++;
641 if (MC::isSMLepton(pout)) NumOfLepLoop++;
642 break; // break out of inner loop after having found two matching particles
643 }
644 }
645 }
646 if (NumOfMuLoop == 2 && NumOfMuNeuLoop == 0) return ZBoson;
647 if (NumOfMuLoop == 1 && NumOfMuNeuLoop == 1) return WBoson;
648 if ((NumOfMuLoop == 4 && NumOfMuNeuLoop == 0) || (NumOfMuLoop == 3 && NumOfMuNeuLoop == 1) ||
649 (NumOfMuLoop == 2 && NumOfMuNeuLoop == 2)) return DiBoson;
650 if (NumOfLepLoop == 4) return DiBoson;
651 }
652
653 //-- McAtNLo
654
655 if (MC::isHiggs(ancestorPDG)) return Higgs;
656
657 if (MC::isMSSMHiggs(ancestorPDG)) return HiggsMSSM; // MSSM Higgs bosons
658
659 if (MC::isHeavyBoson(ancestorPDG)) return HeavyBoson; // Heavy bosons( Z', Z'', W'+)
660
661 if (std::abs(ancestorPDG) == MC::WBOSON_LRSM) return WBosonLRSM; // Left-right symmetric model WBoson (Pythia-specific)
662 if (std::abs(ancestorPDG) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
663 if (std::abs(ancestorPDG) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
664 if (std::abs(ancestorPDG) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
665 if (MC::isLeptoQuark(ancestorPDG) || NumOfLQ != 0) return LQ;
666 if (MC::isSUSY(ancestorPDG)) return SUSY;
667 if (MC::isBSM(ancestorPDG)) return OtherBSM;
668
669 const ParticleType pType = defTypeOfHadron(ancestorPDG);
670 if ((pType == BBbarMesonPart || pType == CCbarMesonPart) && ancestorProdVtx && MC::isHardScatteringVertex(ancestorProdVtx)) isPrompt = true;
671
672 return convHadronTypeToOrig(pType, ancestorPDG);
673}
static const int KPLUS

◆ defOrigOfNeutrino()

ParticleOrigin MCTruthPartClassifier::defOrigOfNeutrino ( const xAOD::TruthParticleContainer & xTruthParticleContainer,
const xAOD::TruthParticle * thePart,
bool & isPrompt,
ParticleOutCome & outCome )
static

Definition at line 1123 of file MCTruthClassifierGen.cxx.

1127{
1128 // Executing DefOrigOfNeutrino
1129
1130 const int nuFlav = std::abs(thePart->pdgId());
1131 // Find the first copy of this particle stored in the xAOD::TruthParticleContainer (i.e. the particle prior to any interactions)
1132 const xAOD::TruthParticle* thePriPart = MC::findMatching(xTruthParticleContainer, thePart);
1133 if (!thePriPart) return NonDefined;
1134 if (std::abs(thePriPart->pdgId()) != nuFlav) return NonDefined; // FIXME should this be if (!MC::isSMNeutrino(thePriPart) || abs(thePriPart->pdgId()) != nuFlav) return NonDefined; // (Use MC::isNeutrino if 4th generation neutrinos OK)
1135
1136 //-- to define neutrino outcome status
1137 outCome = NonInteract;
1138
1139 const xAOD::TruthVertex* partProdVtx = thePriPart->hasProdVtx() ? thePriPart->prodVtx() : nullptr;
1140 if (!partProdVtx) return NonDefined;
1141
1142
1143 const xAOD::TruthParticle* ancestor = MC::findMother(thePriPart);
1144 if (!ancestor) { return NonDefined; } // ancestor is not a nullptr beyond this point
1145
1146 // Start of method 3 of protecting against loops
1147 // to resolve Sherpa loop
1148 bool samePart = MC::TruthLoopDetectionMethod1(partProdVtx, ancestor);
1149 // End of method 3 of protecting against loops
1150
1151 if ((std::abs(ancestor->pdgId()) == nuFlav || MC::isTau(ancestor) || MC::isW(ancestor)) && ancestor->hasProdVtx() && !samePart) {
1152 int pPDG(0);
1153 const xAOD::TruthParticle* ancestorParent{};
1154 do {
1155 pPDG = 0;
1156 ancestorParent = MC::findMother(ancestor);
1157 // Start of method 2 of protecting against loops
1158 // to prevent Sherpa loop
1159 if (MC::TruthLoopDetectionMethod2(ancestor,ancestorParent)) {
1160 ancestorParent = ancestor;
1161 break;
1162 }
1163 //
1164 if (ancestorParent) {
1165 pPDG = ancestorParent->pdgId(); // FIXME difference in behaviour compared to defOrigOfElectron/Muon pPDG set even if we are in a loop
1166 }
1167 // to prevent Sherpa loop
1168 if (ancestor == ancestorParent) { break; }
1169 // End of method 2 of protecting against Sherpa loops
1170 if (std::abs(pPDG) == nuFlav || MC::isTau(pPDG) || MC::isW(pPDG) ) {
1171 // There will be another iteration so set ancestor to ancestorParent
1172 ancestor = ancestorParent; // ancestorParent is not a nullptr
1173 }
1174
1175 } while ((std::abs(pPDG) == nuFlav || MC::isTau(pPDG) || MC::isW(pPDG)));
1176
1177 if (std::abs(pPDG) == nuFlav || MC::isTau(pPDG) || MC::isW(pPDG) || MC::isZ(pPDG) || MC::isHiggs(pPDG) ||
1178 MC::isMSSMHiggs(pPDG) || MC::isHeavyBoson(pPDG) || MC::isTop(pPDG) || // MSSM Higgs bosons, Heavy bosons( Z', Z'', W'+)
1179 std::abs(pPDG) == MC::WBOSON_LRSM || MC::isNeutrinoRH(pPDG) || // Left-right symmetric model WBoson || Right-handed neutrino (Pythia-specific)
1180 MC::isSUSY(pPDG)) {
1181 ancestor = ancestorParent; // ancestorParent is not nullptr here
1182 }
1183 }
1184 //if ancestor is still nullptr, we have a problem
1185 if (!ancestor) return NonDefined; // FIXME it should not be possible for ancestor to be nullptr at this point???
1186
1187 const int ancestorPDG = ancestor->pdgId();
1188 partProdVtx = ancestor->decayVtx();
1189 const xAOD::TruthVertex* ancestorProdVtx = ancestor->hasProdVtx() ? ancestor->prodVtx() : nullptr;
1190 const int numOfParents = partProdVtx->nIncomingParticles();
1191 const int numberOfChildren = partProdVtx->nOutgoingParticles();
1192
1193 // Determine decay products
1194 auto DP = DecayProducts(partProdVtx);
1195 const int NumOfPhot = DP.pd(MC::PHOTON);
1196 const int NumOfquark = DP.apd({MC::DQUARK,MC::UQUARK,MC::SQUARK,MC::CQUARK,MC::BQUARK,MC::TQUARK});
1197 const int NumOfgluon = DP.apd(MC::GLUON);
1198 const int NumOfLQ = DP.apd(MC::LEPTOQUARK);
1199 const int NumOfElNeut = DP.apd(MC::NU_E);
1200 const int NumOfMuNeut = DP.apd(MC::NU_MU);
1201 const int NumOfTauNeut = DP.apd(MC::NU_TAU);
1202 const int NumOfEl = DP.apd(MC::ELECTRON);
1203 const int NumOfMu = DP.apd(MC::MUON);
1204 const int NumOfTau = DP.apd(MC::TAU);
1205
1206 samePart = false;
1207 for (const auto& aChild: partProdVtx->particles_out()) {
1208 if (!aChild) continue;
1209 if (aChild->pdgId() == ancestorPDG && HepMC::is_same_generator_particle(aChild,ancestor)) {
1210 samePart = true;
1211 break;
1212 }
1213 }
1214 // End of section determining decay products
1215
1216 // Quark weak decay
1217 if (MC::isQuark(ancestorPDG) && numOfParents == 1 && numberOfChildren == 3 && NumOfquark == 1 && (NumOfEl == 1 || NumOfMu == 1 || NumOfTau == 1)) return QuarkWeakDec;
1218 if (MC::isTop(ancestorPDG)) return top;
1219
1220 if (MC::isW(ancestorPDG) && ancestorProdVtx && ancestorProdVtx->nIncomingParticles() != 0) {
1221 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
1222 const xAOD::TruthParticle* ptrPart;
1223 do {
1224 ptrPart = prodVert->incomingParticle(0); // FIXME just taking the first one
1225 prodVert = ptrPart->hasProdVtx() ? ptrPart->prodVtx() : nullptr;
1226 } while (MC::isW(ptrPart) && prodVert);
1227
1228 if (prodVert && prodVert->nIncomingParticles() == 1) {
1229 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
1230 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
1231 if (std::abs(ptrPart->pdgId()) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
1232 }
1233 return WBoson;
1234 }
1235 if (MC::isW(ancestorPDG)) return WBoson;
1236 if (MC::isZ(ancestorPDG)) return ZBoson;
1237
1238 //-- Exotics
1239
1240 // MadGraphPythia ZWW*->lllnulnu or ZWW*->nunulnulnu (don't even know if the latter is generated)
1241 if (numOfParents == 1 && numberOfChildren > 4 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG))) {
1242
1243 const xAOD::TruthParticle* thePartToCheck = thePriPart;
1244 const xAOD::TruthParticle* theParent = thePriPart->hasProdVtx() ? thePriPart->prodVtx()->incomingParticle(0) : nullptr; // FIXME just taking the first one
1245
1246 if (MC::isElectron(theParent) && MC::isDecayed(theParent)) { thePartToCheck = theParent; }
1247 bool isZboson = false;
1248 bool isWboson = false;
1249 bool skipnext = false;
1250
1251 for (unsigned int ipOut = 0; ipOut + 1 < partProdVtx->nOutgoingParticles(); ++ipOut) {
1252 const xAOD::TruthParticle* aChild = partProdVtx->outgoingParticle(ipOut);
1253 if (!aChild) continue;
1254 const xAOD::TruthParticle* theNextChild{};
1255 for (unsigned int ipOut1 = ipOut + 1; ipOut1 < partProdVtx->nOutgoingParticles(); ipOut1++) {
1256 theNextChild = partProdVtx->outgoingParticle(ipOut1);
1257 if (theNextChild) break;
1258 }
1259 if (!theNextChild) continue;
1260
1261 if (skipnext) {
1262 skipnext = false;
1263 continue;
1264 }
1265
1266 const int apdgID1 = std::abs(aChild->pdgId());
1267 const int apdgID2 = std::abs(theNextChild->pdgId());
1268 if (apdgID1 == apdgID2 && MC::isSMNeutrino(apdgID1)) {
1269 // Zboson
1270 if (thePartToCheck == aChild || thePartToCheck == theNextChild) {
1271 isZboson = true;
1272 break;
1273 }
1274 skipnext = true;
1275 } else if ((apdgID1 == MC::ELECTRON && apdgID2 == MC::NU_E) ||
1276 (apdgID1 == MC::NU_E && apdgID2 == MC::ELECTRON) ||
1277 (apdgID1 == MC::MUON && apdgID2 == MC::NU_MU) ||
1278 (apdgID1 == MC::NU_MU && apdgID2 == MC::MUON) ||
1279 (apdgID1 == MC::TAU && apdgID2 == MC::NU_TAU) ||
1280 (apdgID1 == MC::NU_TAU && apdgID2 == MC::TAU)
1281 ) {
1282 // WBoson
1283 if (thePartToCheck == aChild || thePartToCheck == theNextChild) {
1284 isWboson = true;
1285 break;
1286 }
1287 skipnext = true;
1288 }
1289 }
1290 if (isWboson) return WBoson;
1291 if (isZboson) return ZBoson;
1292 }
1293
1294 if (numOfParents == 2) {
1295 //--Sherpa Z->nunu
1296 if ( (numberOfChildren - NumOfquark - NumOfgluon) == 2 && (NumOfElNeut == 2 || NumOfMuNeut == 2 || NumOfTauNeut == 2)) return ZBoson;
1297
1298 //--Sherpa W->enu ??
1299 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && ((NumOfEl == 1 && NumOfElNeut == 1) || (NumOfMu == 1 && NumOfMuNeut == 1) || (NumOfTau == 1 && NumOfTauNeut == 1))) return WBoson;
1300
1301 const int pdg1 = partProdVtx->incomingParticle(0)->pdgId();
1302 const int pdg2 = partProdVtx->incomingParticle(1)->pdgId();
1303 //--Sherpa ZZ,ZW
1304 if ( (numberOfChildren - NumOfquark - NumOfgluon) == 4 && (NumOfEl + NumOfMu + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 4) &&
1305 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return DiBoson;
1306
1307 //--Sherpa VVV -- Note, have to allow for prompt photon radiation or these get lost
1308 if ((numberOfChildren - NumOfquark - NumOfgluon - NumOfPhot) == 6 && (NumOfEl + NumOfMu + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 6) &&
1309 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return MultiBoson;
1310
1311 //--Sherpa Vgamma ( Z->nunu+gamma )
1312 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && (NumOfElNeut == 2 || NumOfMuNeut == 2 || NumOfTauNeut == 2)) {
1313 // Sherpa nunu + gamma
1314 return ZBoson;
1315 }
1316 }
1317
1318 // New Sherpa Z->nunu
1319 if (partProdVtx == ancestorProdVtx) {
1320 int NumOfLepLoop = 0;
1321 int NumOfNeuLoop = 0;
1322 for (const auto *const pout: partProdVtx->particles_out()) {
1323 if (!pout) continue;
1324 for (const auto *const pin: partProdVtx->particles_in()) {
1325 if (!pin) continue;
1326 if (HepMC::is_same_particle(pin,pout)) continue;
1327 const int apdgid = std::abs(pout->pdgId());
1328 if (MC::isSMLepton(apdgid)) {
1329 if (MC::isSMNeutrino(apdgid)) { NumOfNeuLoop++; }
1330 else { NumOfLepLoop++; }
1331 }
1332 break; // break out of inner loop after having found two matching particles
1333 }
1334 }
1335 if (NumOfNeuLoop == 2 && NumOfLepLoop == 0) return ZBoson;
1336 if (NumOfNeuLoop == 1 && NumOfLepLoop == 1) return WBoson;
1337 if (NumOfNeuLoop + NumOfLepLoop == 4) return DiBoson;
1338 }
1339
1340 //-- McAtNLo
1341
1342 if (MC::isHiggs(ancestorPDG)) return Higgs;
1343 if (MC::isMSSMHiggs(ancestorPDG)) return HiggsMSSM; // MSSM Higgs bosons
1344 if (MC::isHeavyBoson(ancestorPDG)) return HeavyBoson; // Heavy bosons( Z', Z'', W'+)
1345
1346 if (MC::isTau(ancestorPDG)) {
1347 const ParticleOrigin tauOrig = defOrigOfTau(xTruthParticleContainer, ancestor, ancestorPDG, outCome);
1348 const ParticleType tautype = defTypeOfTau(tauOrig);
1349 return (tautype == IsoTau)?tauOrig:TauLep;
1350 }
1351
1352 if (std::abs(ancestorPDG) == MC::WBOSON_LRSM) return WBosonLRSM; // Left-right symmetric model WBoson (Pythia-specific)
1353 if (std::abs(ancestorPDG) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
1354 if (std::abs(ancestorPDG) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
1355 if (std::abs(ancestorPDG) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
1356 if (MC::isLeptoQuark(ancestorPDG) || NumOfLQ != 0) return LQ;
1357 if (MC::isSUSY(ancestorPDG)) return SUSY;
1358 if (MC::isBSM(ancestorPDG)) return OtherBSM;
1359
1360 const ParticleType pType = defTypeOfHadron(ancestorPDG);
1361 if ((pType == BBbarMesonPart || pType == CCbarMesonPart) && ancestorProdVtx && MC::isHardScatteringVertex(ancestorProdVtx)) isPrompt = true;
1362
1363 return convHadronTypeToOrig(pType, ancestorPDG);
1364}
bool isSMNeutrino(const T &p)

◆ defOrigOfParticle()

template<class T>
std::tuple< unsigned int, T > MCTruthPartClassifier::defOrigOfParticle ( T thePart)

Classify a particle into a bit-word (see MCTC_bits).

Returns
the word and the parent hadron (nullptr if none)

Definition at line 181 of file TruthClassifiers.h.

181 {
182
183 T parent_hadron_ptr = nullptr;
184
185 bool uncat = 0, fromHad = 0, fromTau = 0;
186 bool isPhysical = MC::isPhysical(thePart);
187 bool isGeant = HepMC::is_simulation_particle(thePart);
188 bool isBSM = MC::isBSM(thePart);
189 bool fromBSM = isBSM; // just to initialise
190
191 auto prodVtx = thePart->production_vertex();
192 if (isPhysical && prodVtx && !isGeant) {
193 fromHad = MC::isFromHadron(thePart, parent_hadron_ptr, fromTau, fromBSM);
194 }
195 else uncat = 1;
196
197 std::bitset<MCTC_bits::totalBits> classifier;
198 classifier[MCTC_bits::stable] = isPhysical;
199 classifier[MCTC_bits::isgeant] = isGeant;
200 classifier[MCTC_bits::isbsm] = isBSM;
201 classifier[MCTC_bits::uncat] = uncat;
202 classifier[MCTC_bits::frombsm] = fromBSM;
203 classifier[MCTC_bits::hadron] = fromHad;
204 classifier[MCTC_bits::Tau] = fromTau;
205 classifier[MCTC_bits::HadTau] = fromHad && fromTau;
206 unsigned int outputvalue = static_cast<unsigned int>(classifier.to_ulong());
207
208 return std::make_tuple(outputvalue,parent_hadron_ptr);
209}
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
Definition AtlasPID.h:907
@ Tau
A tau is among the ancestors, or the parents of an ancestor, that were walked on the way up (product ...
bool isFromHadron(T p, U &hadron, bool &fromTau, bool &fromBSM)
Function to check if the particle is a hadron or descends from one; sets the parent hadron,...
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.

◆ defOrigOfPhoton()

ParticleOrigin MCTruthPartClassifier::defOrigOfPhoton ( const xAOD::TruthParticleContainer & xTruthParticleContainer,
const xAOD::TruthParticle * thePart,
bool & isPrompt,
ParticleOutCome & outCome )
static

Definition at line 864 of file MCTruthClassifierGen.cxx.

868{
869 if (!thePart) return NonDefined; // FIXME Why is this extra protection needed for this function and not the others?
870 // Executing DefOrigOfPhoton
871
872
873 // Find the first copy of this particle stored in the xAOD::TruthParticleContainer (i.e. the particle prior to any interactions)
874 const xAOD::TruthParticle* thePriPart = MC::findMatching(xTruthParticleContainer, thePart);
875 if (!thePriPart) return NonDefined;
876 if (!MC::isPhoton(thePriPart)) return NonDefined;
877
878 const xAOD::TruthVertex* partProdVtx = thePriPart->hasProdVtx() ? thePriPart->prodVtx() : nullptr;
879
880 //-- to define photon outcome status
881 outCome = defOutComeOfPhoton(thePriPart);
882
883 if (!partProdVtx) return NonDefined;
884
885 int numOfParents = partProdVtx->nIncomingParticles();
886
887 const xAOD::TruthParticle* ancestor = MC::findMother(thePriPart);
888 if (!ancestor) { return NonDefined; } // ancestor is not a nullptr beyond this point
889
890 int ancestorPDG = ancestor->pdgId();
891 // "method 1" for finding Sherpa loops from defOrigOfElectron not used here. Why?
892 const xAOD::TruthVertex* ancestorProdVtx = ancestor->hasProdVtx() ? ancestor->prodVtx() : nullptr;
893
894 partProdVtx = ancestor->decayVtx(); // FIXME how often does this line actually change the pointer???
895 numOfParents = partProdVtx->nIncomingParticles();
896
897 const int numberOfChildren = partProdVtx->nOutgoingParticles();
898
899 // Determine decay products
900 auto DP = DecayProducts(partProdVtx);
901 const int NumOfEl = DP.pd(MC::ELECTRON);
902 const int NumOfPos = DP.pd(MC::POSITRON);
903 const int NumOfMu = DP.apd(MC::MUON);
904 const int NumOfTau = DP.apd(MC::TAU);
905 const int NumOfLQ = DP.apd(MC::LEPTOQUARK);
906 const int NumOfLep = NumOfEl + NumOfPos + NumOfMu + NumOfTau;
907 const int NumOfNeut = DP.apd({MC::NU_E,MC::NU_MU,MC::NU_TAU});
908 const int NumOfPht = DP.pd(MC::PHOTON);
909
910 int childPDG(0);
911 int NumOfPartons(0);
912 int NumOfNucFr(0);
913 const bool possibleNuclearFragment = (numOfParents == 1 && (MC::isPhoton(ancestorPDG) || MC::isElectron(ancestorPDG) || std::abs(ancestorPDG) == MC::PIPLUS));
914 const xAOD::TruthParticle* child{};
915 for (const auto& pout: partProdVtx->particles_out()) {
916 if (!pout) continue;
917 childPDG = pout->pdg_id();
918 if (possibleNuclearFragment &&
919 (MC::isNucleus(childPDG) || childPDG == 0 || childPDG == MC::PROTON || childPDG == MC::NEUTRON)) { // FIXME Do we really expect particles with PDG_ID = 0 in the truth record?
920 NumOfNucFr++;
921 }
922 if (std::abs(childPDG) < MC::ELECTRON ||
923 (std::abs(childPDG) > MC::NU_TAU && std::abs(childPDG) < 43 && !MC::isPhoton(childPDG))) {
924 // FIXME Too loose? This definition picks up 4th generation quarks and leptons as well as all gauge bosons and leptoquarks.
925 // Suggest MC::isSMQuark(childPDG) || (MC::isBoson(childPDG) && !MC::isPhoton(childPDG))
926 // or maybe even MC::isSMQuark(childPDG) || MC::isGluon(childPDG)
927 // AKA const int NumOfPartons = DP.apd({MC::DQUARK,MC::UQUARK,MC::SQUARK,MC::CQUARK,MC::BQUARK,MC::TQUARK,MC::GLUON});
928 NumOfPartons++;
929 }
930 if (childPDG == ancestorPDG) {
931 child = pout;
932 }
933 }
934 // End of section determining decay products
935
936 bool foundISR = false;
937 bool foundFSR = false;
938 if (numOfParents == 1 && numberOfChildren == 2 && child && HepMC::is_same_generator_particle(child, ancestor)) return BremPhot;
939 if (numOfParents == 1 && numberOfChildren == 2 && MC::isElectron(ancestorPDG) && NumOfPht == 2) return ElMagProc;
940
941 // decay of W,Z and Higgs to lepton with FSR generated by Pythia
942 if (numOfParents == 1 && numberOfChildren == 2 && (MC::isElectron(ancestorPDG) || MC::isMuon(ancestorPDG) || MC::isTau(ancestorPDG)) &&
943 !(child && HepMC::is_same_generator_particle(child, ancestor)) && ancestorProdVtx &&
944 ancestorProdVtx->nIncomingParticles() == 1) {
945 int itr = 0;
946 int PartPDG = 0;
947 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
948 const xAOD::TruthVertex* Vert{};
949 do {
950 Vert = prodVert;
951 for (const auto & pin: Vert->particles_in()) {
952 if (!pin) continue;
953 PartPDG = std::abs(pin->pdgId());
954 prodVert = pin->prodVtx();
955 if (MC::isZ(PartPDG) || MC::isW(PartPDG) || MC::isHiggs(PartPDG)) foundFSR = true;
956 }
957 itr++;
958 if (itr > 100) { // FIXME Improve loop detection here?
959 // DefOrigOfPhoton:: infinite while
960 break;
961 }
962 } while (prodVert && std::abs(ancestorPDG) == PartPDG);
963
964 if (foundFSR) return FSRPhot;
965 }
966
967 // Nucl reaction
968 // gamma+Nuclear=>gamma+Nucl.Fr+Nuclons+pions
969 // e+Nuclear=>e+gamma+Nucl.Fr+Nuclons+pions
970 // pi+Nuclear=>gamma+Nucl.Fr+Nuclons+pions
971
972 if ((numOfParents == 1 && (MC::isPhoton(ancestorPDG) || MC::isElectron(ancestorPDG)) && numberOfChildren > 2 && NumOfNucFr != 0) ||
973 (numOfParents == 1 && std::abs(ancestorPDG) == MC::PIPLUS && numberOfChildren > 10 && NumOfNucFr != 0) ||
974 (numOfParents == 1 && MC::isPhoton(ancestorPDG) && numberOfChildren > 10 && MC::isStable(ancestor)) ||
975 (numOfParents == 1 && MC::isNucleus(ancestorPDG) && std::abs(ancestorPDG) != MC::PROTON)) // FIXME vetoing protons here to preserve previous behaviour
976 return NucReact;
977
978 if (MC::isMuon(ancestorPDG) && NumOfMu == 0) return Mu;
979 if (MC::isTau(ancestorPDG) && NumOfTau == 0) return TauLep;
980
981 if (numOfParents == 1 && ancestor->status() == 3) return (foundISR)? ISRPhot:UndrPhot; // FIXME foundISR is always false at this point
982
983 //-- to find initial and final state raiation and underline photons
984 //-- SUSY
985 if (numOfParents == 1 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG)) &&
986 (numberOfChildren != NumOfPht + NumOfPartons || !MC::Pythia8::isConditionA(ancestor))) {
987 for (const auto& pout: partProdVtx->particles_out()) {
988 if (!pout) continue;
989 if (ancestorPDG != pout->pdgId()) continue;
990 const xAOD::TruthVertex* Vrtx = pout->decayVtx();
991 if (!Vrtx) continue;
992 if (Vrtx->nOutgoingParticles() != 1 && Vrtx->nIncomingParticles() == 1) continue;
993 if (!Vrtx->outgoingParticle(0)) continue;
994 if (Vrtx->outgoingParticle(0)->pdgId() == 91) foundISR = true; // Herwig "cluster"
995 }
996 return (foundISR)?ISRPhot:UndrPhot;
997 }
998
999 //-- to find final state radiation
1000 //-- Exotics
1001
1002 // FSR from Photos
1003 //-- Exotics- CompHep
1004 if (numOfParents == 2 && ((MC::isElectron(ancestorPDG) && NumOfEl == 1 && NumOfPos == 1) || (MC::isMuon(ancestorPDG) && NumOfMu == 2) || (MC::isTau(ancestorPDG) && NumOfTau == 2))) {
1005 if (std::abs(partProdVtx->incomingParticle(0)->pdgId()) == std::abs(partProdVtx->incomingParticle(1)->pdgId())) return FSRPhot;
1006 }
1007
1008 if (numOfParents == 2 && NumOfLep == 1 && NumOfNeut == 1 && (MC::isElectron(ancestorPDG) || std::abs(ancestorPDG) == MC::NU_E)) return FSRPhot;
1009
1010 //-- Exotics - CompHep
1011 if (MC::isElectron(ancestorPDG) && numOfParents == 1 && numberOfChildren == 2 && (NumOfEl == 1 || NumOfPos == 1) && NumOfPht == 1 &&
1012 !( child && HepMC::is_same_generator_particle(child, ancestor)) && !HepMC::is_simulation_particle(child) && !HepMC::is_simulation_particle(ancestor))
1013 return FSRPhot;
1014
1015 // FSR from Photos
1016 if (MC::isZ(ancestorPDG) && ((NumOfEl + NumOfPos == 2 || NumOfEl + NumOfPos == 4) || (NumOfMu == 2 || NumOfMu == 4) || (NumOfTau == 2 || NumOfTau == 4)) && NumOfPht > 0) return FSRPhot;
1017
1018 if (NumOfPht > 0 && (std::abs(ancestorPDG) == MC::WBOSON_LRSM || MC::isNeutrinoRH(ancestorPDG))) return FSRPhot; // Left-right symmetric model WBoson || Right-handed neutrinos (Pythia-specific)
1019
1020 if (numOfParents == 2 && NumOfLQ == 1) return FSRPhot;
1021
1022 //--- other process
1023
1024 if (MC::isZ(ancestorPDG)) return ZBoson;
1025 if (MC::isW(ancestorPDG)) {
1026
1027 if (NumOfLep == 1 && NumOfNeut == 1 && numberOfChildren == NumOfLep + NumOfNeut + NumOfPht) return FSRPhot;
1028
1029 if (ancestorProdVtx && ancestorProdVtx->nIncomingParticles() != 0) {
1030 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
1031 const xAOD::TruthParticle* itrP;
1032 do {
1033 itrP = prodVert->incomingParticle(0); // FIXME just taking the first one
1034 prodVert = itrP->hasProdVtx() ? itrP->prodVtx() : nullptr;
1035 } while (MC::isW(itrP) && prodVert);
1036
1037 if (prodVert && prodVert->nIncomingParticles() == 1 ) {
1038 if ( MC::isTau(itrP)) return TauLep;
1039 if ( MC::isMuon(itrP)) return Mu;
1040 if ( std::abs(itrP->pdgId()) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
1041 if ( std::abs(itrP->pdgId()) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
1042 if ( std::abs(itrP->pdgId()) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
1043 }
1044 } else
1045 return WBoson;
1046 }
1047
1048 // MadGraphPythia ZWW*->lllnulnu
1049 if (numOfParents == 1 && numberOfChildren > 4 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG))) {
1050 bool isZboson = false;
1051 bool isWboson = false;
1052 bool skipnext = false;
1053 for (unsigned int ipOut = 0; ipOut + 1 < partProdVtx->nOutgoingParticles(); ipOut++) {
1054 if (skipnext) {
1055 skipnext = false;
1056 continue;
1057 }
1058 const xAOD::TruthParticle* aChild = partProdVtx->outgoingParticle(ipOut);
1059 if (!aChild) continue;
1060 const xAOD::TruthParticle* theNextChild{};
1061 for (unsigned int ipOut1 = ipOut + 1; ipOut1 < partProdVtx->nOutgoingParticles(); ipOut1++) {
1062 theNextChild = partProdVtx->outgoingParticle(ipOut1);
1063 if (theNextChild) break;
1064 }
1065 if (!theNextChild) continue;
1066 if (MC::isTau(aChild) && MC::isTau(theNextChild)) {
1067 // Zboson
1068 if (thePriPart == aChild || thePriPart == theNextChild) {
1069 isZboson = true;
1070 break;
1071 }
1072 skipnext = true;
1073 } else if (MC::isTau(aChild) && std::abs(theNextChild->pdgId()) == MC::NU_TAU) {
1074 // WBoson
1075 if (thePriPart == aChild || thePriPart == theNextChild) {
1076 isWboson = true;
1077 break;
1078 }
1079 skipnext = true;
1080 }
1081 }
1082 if (isWboson) return WBoson;
1083 if (isZboson) return ZBoson;
1084 }
1085
1086 //--Sherpa ZZ,ZW+FSR
1087 if (numOfParents == 4 && (numberOfChildren - NumOfPht) == 4 && (NumOfLep + NumOfNeut == 4)) {
1088 if (MC::isSMLepton(partProdVtx->incomingParticle(0))&&MC::isSMLepton(partProdVtx->incomingParticle(1))
1089 && MC::isSMLepton(partProdVtx->incomingParticle(2))&&MC::isSMLepton(partProdVtx->incomingParticle(3)))
1090 return FSRPhot;
1091 }
1092
1093 //--New Sherpa single photon
1094 if (partProdVtx == ancestorProdVtx) {
1095 for (const auto *const pout: partProdVtx->particles_out()) {
1096 if (!pout) continue;
1097 for (const auto *const pin: partProdVtx->particles_in()) {
1098 if (!pin) continue;
1099 if (!HepMC::is_same_particle(pout,pin)) continue;
1100 if (MC::isPhoton(pout)) return SinglePhot;
1101 break; // break out of inner loop after having found two matching particles
1102 }
1103 }
1104 }
1105
1106 if (MC::isHiggs(ancestorPDG)) return Higgs;
1107 if (std::abs(ancestorPDG) == MC::PI0) return PiZero;
1108 if (MC::isMSSMHiggs(ancestorPDG)) return HiggsMSSM; // MSSM Higgs bosons
1109 if (MC::isHeavyBoson(ancestorPDG) || std::abs(ancestorPDG) == 5100039 ) return HeavyBoson; // Heavy Bosons (Z' Z'' W'+) + KK excited graviton
1110
1111 if (MC::isSUSY(ancestorPDG)) return SUSY;
1112 if (MC::isBSM(ancestorPDG)) return OtherBSM;
1113
1114 // Pythia8 gamma+jet samples
1115 if (MC::Pythia8::isConditionA(ancestor) && MC::isStable(thePriPart) && NumOfPht == 1 && numberOfChildren == (NumOfPht + NumOfPartons)) return PromptPhot;
1116
1117 const ParticleType pType = defTypeOfHadron(ancestorPDG);
1118 if ((pType == BBbarMesonPart || pType == CCbarMesonPart) && ancestorProdVtx && MC::isHardScatteringVertex(ancestorProdVtx)) isPrompt = true;
1119 return convHadronTypeToOrig(pType, ancestorPDG);
1120}
int status() const
Status code.
bool isConditionA(const T &p)
Match selected Pythia status codes for hardest-subprocess and later-stage particles: 21: incoming par...

◆ defOrigOfTau()

ParticleOrigin MCTruthPartClassifier::defOrigOfTau ( const xAOD::TruthParticleContainer & xTruthParticleContainer,
const xAOD::TruthParticle * thePart,
int ancestorPDGin,
ParticleOutCome & outCome )
static

Definition at line 676 of file MCTruthClassifierGen.cxx.

680{
681 // Executing DefOrigOfTau
682
683 // Find the first copy of this particle stored in the xAOD::TruthParticleContainer (i.e. the particle prior to any interactions)
684 const xAOD::TruthParticle* thePriPart = MC::findMatching(xTruthParticleContainer, thePart);
685 if (!thePriPart) return NonDefined;
686 if (!MC::isTau(thePriPart)) return NonDefined;
687
688 //-- to define tau outcome status
689 if (MC::isPhysical(thePriPart)) outCome = defOutComeOfTau(thePriPart); // FIXME why do we need the additional check on MC::isPhysical here c.f. defOrigOfElectron and defOrigOfMuon?
690
691 const xAOD::TruthVertex* partProdVtx = thePriPart->hasProdVtx() ? thePriPart->prodVtx() : nullptr;
692 if (!partProdVtx) return NonDefined;
693
694
695 const xAOD::TruthParticle* ancestor = MC::findMother(thePriPart);
696 if (!ancestor) { return NonDefined; } // ancestor is not a nullptr beyond this point
697
698 // "method 1" for finding Sherpa loops from defOrigOfElectron not used here. Why?
699
700 // Difference from defOrigOfElectron and defOrigOfMuon - no loop through ancestor particles
701
702 if (MC::isW(ancestorPDGin) && ancestor->hasProdVtx()) { // FIXME ancestorPDGin here could in principle be inconsistent with ancestorProdVtx
703 const xAOD::TruthParticle* ancestorParent = MC::findMother(ancestor);
704 if (ancestorParent && MC::isTop(ancestorParent->pdgId())) {
705 ancestor = ancestorParent; //...so ancestor cannot be nullptr
706 }
707 }
708
709 const int ancestorPDG = ancestor->pdgId();
710 const xAOD::TruthVertex* ancestorProdVtx = ancestor->hasProdVtx() ? ancestor->prodVtx() : nullptr;
711 partProdVtx = ancestor->decayVtx();
712 if (!partProdVtx) return NonDefined; // FIXME not sure this could ever be true?
713 const int numOfParents = partProdVtx->nIncomingParticles();
714
715 // Determine decay products
716 auto DP = DecayProducts(partProdVtx);
717 const int numberOfChildren = DP.size();
718 const int NumOfPhot = DP.pd(MC::PHOTON);
719 const int NumOfEl = DP.pd(MC::ELECTRON);
720 const int NumOfPos = DP.pd(MC::POSITRON);
721 const int NumOfElNeut = DP.apd(MC::NU_E);
722 const int NumOfMuNeut = DP.apd(MC::NU_MU);
723 /* const int NumOfLQ = DP.apd(MC::LEPTOQUARK); */ // FIXME Leptoquarks not an option?
724 const int NumOfquark = DP.apd({MC::DQUARK,MC::UQUARK,MC::SQUARK,MC::CQUARK,MC::BQUARK,MC::TQUARK});
725 const int NumOfgluon = DP.apd(MC::GLUON);
726 const int NumOfMuPl = DP.pd(-MC::MUON);
727 const int NumOfMuMin = DP.pd(MC::MUON);
728 const int NumOfTau = DP.apd(MC::TAU);
729 const int NumOfTauNeut = DP.apd(MC::NU_TAU);
730 // End of section determining decay products
731
732 if (MC::isTop(ancestorPDG)) return top;
733 if (MC::isW(ancestorPDG) && ancestorProdVtx && ancestorProdVtx->nIncomingParticles() != 0) {
734 const xAOD::TruthVertex* prodVert = ancestorProdVtx;
735 const xAOD::TruthParticle* itrP;
736 do {
737 itrP = prodVert->incomingParticle(0); // FIXME just taking the first one
738 prodVert = itrP->hasProdVtx() ? itrP->prodVtx() : nullptr;
739 } while (MC::isW(itrP) && prodVert);
740
741 if (prodVert && prodVert->nIncomingParticles() == 1 ) {
742 if (std::abs(itrP->pdgId()) == MC::RH_NU_E) return NuREle; // Right-handed NU_E (Pythia-specific)
743 if (std::abs(itrP->pdgId()) == MC::RH_NU_MU) return NuRMu; // Right-handed NU_MU (Pythia-specific)
744 if (std::abs(itrP->pdgId()) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
745 }
746 return WBoson;
747 }
748 if (MC::isW(ancestorPDG)) { return WBoson;}
749 if (MC::isZ(ancestorPDG)) { return ZBoson;}
750 if (numOfParents == 1 && numberOfChildren > 4 && (MC::isSMQuark(ancestorPDG) || MC::isGluon(ancestorPDG))) {
751 bool isZboson = false;
752 bool isWboson = false;
753 bool skipnext = false;
754 for (unsigned int ipOut = 0; ipOut + 1 < partProdVtx->nOutgoingParticles(); ipOut++) {
755 if (skipnext) {
756 skipnext = false;
757 continue;
758 }
759 const xAOD::TruthParticle* aChild = partProdVtx->outgoingParticle(ipOut);
760 if (!aChild) continue;
761 const xAOD::TruthParticle* theNextChild{};
762 for (unsigned int ipOut1 = ipOut + 1; ipOut1 < partProdVtx->nOutgoingParticles(); ipOut1++) {
763 theNextChild = partProdVtx->outgoingParticle(ipOut1);
764 if (theNextChild) break;
765 }
766 if (!theNextChild) {
767 continue;
768 }
769 if (MC::isTau(aChild) && MC::isTau(theNextChild)) {
770 // Zboson
771 if (thePriPart == aChild || thePriPart == theNextChild) {
772 isZboson = true;
773 break;
774 }
775 skipnext = true;
776 } else if (MC::isTau(aChild) && std::abs(theNextChild->pdgId()) == MC::NU_TAU) {
777 // WBoson
778 if (thePriPart == aChild || thePriPart == theNextChild) {
779 isWboson = true;
780 break;
781 }
782 skipnext = true;
783 }
784 }
785 if (isWboson) return WBoson;
786 if (isZboson) return ZBoson;
787 }
788 if (numOfParents == 2 ) {
789 const int pdg1 = partProdVtx->incomingParticle(0)->pdgId();
790 const int pdg2 = partProdVtx->incomingParticle(1)->pdgId();
791 //--Sherpa Z->tautau
792 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && NumOfTau == 2 && (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return ZBoson; // FIXME Why the extra checks on incoming particles compared to Z->ee, Z->mumu and Z->nunu?
793
794 //--Sherpa W->taunu new
795 if ((numberOfChildren - NumOfquark - NumOfgluon) == 2 && NumOfTau == 1 && NumOfTauNeut == 1) return WBoson;
796
797 //--Sherpa ZZ,ZW
798 if ((numberOfChildren - NumOfquark - NumOfgluon) == 4 &&
799 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 4) &&
800 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return DiBoson;
801
802 //--Sherpa VVV -- Note, have to allow for prompt photon radiation or these get lost
803 if ((numberOfChildren - NumOfquark - NumOfgluon - NumOfPhot) == 6 &&
804 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 6) &&
805 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) return MultiBoson;
806
807 //--Sherpa tttt with all t->Wb; W->lnu
808 if ((numberOfChildren - NumOfquark - NumOfgluon) == 8 &&
809 (NumOfEl + NumOfPos + NumOfMuPl + NumOfMuMin + NumOfTau + NumOfElNeut + NumOfMuNeut + NumOfTauNeut == 8) &&
810 (MC::isQuark(pdg1)||MC::isGluon(pdg1)) && (MC::isQuark(pdg2)||MC::isGluon(pdg2))) {
811 // MultiBoson for 4topLep
812 return MultiBoson;
813 }
814
815 //--Sherpa Vgamma ( Z->tautau+gamma or W->taunu+gamma )
816 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && NumOfTau == 2) {
817 // Sherpa tautau + gamma
818 return ZBoson;
819 }
820 if ((numberOfChildren - NumOfquark - NumOfgluon) >= 3 && NumOfPhot >= 1 && NumOfTau == 1 && NumOfTauNeut == 1) {
821 // Sherpa taunu + gamma
822 return WBoson;
823 }
824 }
825
826 // New Sherpa Z->tautau
827 if (partProdVtx == ancestorProdVtx) {
828 int NumOfTauLoop = 0;
829 int NumOfTauNeuLoop = 0;
830 int NumOfLepLoop = 0;
831 for ( const auto *const pout: partProdVtx->particles_out()) {
832 if (!pout) continue;
833 for (const auto *const pin: partProdVtx->particles_in()) {
834 if (!pin) continue;
835 if (!HepMC::is_same_particle(pout,pin)) continue;
836 if (MC::isTau(pout)) NumOfTauLoop++;
837 if (std::abs(pout->pdgId()) == MC::NU_TAU) NumOfTauNeuLoop++;
838 if (MC::isSMLepton(pout)) NumOfLepLoop++;
839 break; // break out of inner loop after having found two matching particles
840 }
841 }
842 if (NumOfTauLoop == 2 && NumOfTauNeuLoop == 0) return ZBoson;
843 if (NumOfTauLoop == 1 && NumOfTauNeuLoop == 1) return WBoson;
844 if ((NumOfTauLoop == 4 && NumOfTauNeuLoop == 0) || (NumOfTauLoop == 3 && NumOfTauNeuLoop == 1) || (NumOfTauLoop == 2 && NumOfTauNeuLoop == 2)) return DiBoson;
845 if (NumOfLepLoop == 4) return DiBoson;
846 }
847
848 //-- McAtNLo
849
850 if (MC::isHiggs(ancestorPDG)) return Higgs;
851 if (MC::isMSSMHiggs(ancestorPDG)) return HiggsMSSM; // MSSM Higgs bosons
852 if (MC::isHeavyBoson(ancestorPDG)) return HeavyBoson; // Heavy bosons( Z', Z'', W'+)
853 if (std::abs(ancestorPDG) == MC::WBOSON_LRSM) return WBosonLRSM; // Left-right symmetric model WBoson (Pythia-specific)
854 if (std::abs(ancestorPDG) == MC::RH_NU_TAU) return NuRTau; // Right-handed NU_TAU (Pythia-specific)
855 if (MC::isSUSY(ancestorPDG)) return SUSY;
856 if (MC::isBSM(ancestorPDG)) return OtherBSM;
857 if (std::abs(ancestorPDG) == MC::JPSI) return JPsi;
858
859 const ParticleType pType = defTypeOfHadron(ancestorPDG);
860 return convHadronTypeToOrig(pType, ancestorPDG);
861}

◆ defOutComeOfElectron()

template<class T>
ParticleOutCome MCTruthPartClassifier::defOutComeOfElectron ( T thePart)

Determine the outcome of a simulated electron from its end vertex (NonInteract, ElectrMagInter, NuclInteraction or UnknownOutCome).

Definition at line 224 of file TruthClassifiers.h.

224 {
225 ParticleOutCome PartOutCome = UnknownOutCome;
226 auto EndVert = MC::findSimulatedEndVertex(thePart);
227 if (EndVert == nullptr) return NonInteract;
228
229 int ElecOutNumOfNucFr(0);
230 int ElecOutNumOfElec(0);
231 int NumOfHadr(0);
232 auto outgoing = EndVert->particles_out();
233 int NumOfElecDaug = outgoing.size();
234 for (const auto& p: outgoing) {
235 if (!p) continue;
236 int EndDaugType = p->pdg_id();
237 if (MC::isElectron(EndDaugType)) ElecOutNumOfElec++;
238 if (MC::isHadron(p) && !MC::isBeam(p)) NumOfHadr++;
239 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) ElecOutNumOfNucFr++;
240 }
241
242 if (ElecOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome = NuclInteraction;
243 if (ElecOutNumOfElec == 1 && NumOfElecDaug == 1) PartOutCome = ElectrMagInter;
244
245 return PartOutCome;
246}
ParticleOutCome
Outcome of a (simulated) truth particle: what happened to it after being produced,...
auto findSimulatedEndVertex(T thePart) -> decltype(thePart->end_vertex())
Function to find the end vertex of a particle.

◆ defOutComeOfMuon()

template<class T>
ParticleOutCome MCTruthPartClassifier::defOutComeOfMuon ( T thePart)

Determine the outcome of a simulated muon from its end vertex (NonInteract, DecaytoElectron, NuclInteraction or UnknownOutCome).

Definition at line 250 of file TruthClassifiers.h.

250 {
251 ParticleOutCome PartOutCome = UnknownOutCome;
252 auto EndVert = MC::findSimulatedEndVertex(thePart);
253 if (EndVert == nullptr) return NonInteract;
254 int MuOutNumOfNucFr(0);
255 int NumOfHadr(0);
256 int NumOfEleNeutr(0);
257 int NumOfMuonNeutr(0);
258 int NumOfElec(0);
259 auto outgoing = EndVert->particles_out();
260 int NumOfMuDaug = outgoing.size();
261 for (const auto& p: outgoing) {
262 if (!p) continue;
263 int EndDaugType = p->pdg_id();
264 if (MC::isElectron(EndDaugType)) NumOfElec++;
265 if (abs(EndDaugType) == 12) NumOfEleNeutr++;
266 if (abs(EndDaugType) == 14) NumOfMuonNeutr++;
267 if (MC::isHadron(p) && !MC::isBeam(p)) NumOfHadr++;
268 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) MuOutNumOfNucFr++;
269 }
270
271 if (MuOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome = NuclInteraction;
272 if (NumOfMuDaug == 3 && NumOfElec == 1 && NumOfEleNeutr == 1 && NumOfMuonNeutr == 1) PartOutCome = DecaytoElectron;
273
274 return PartOutCome;
275}

◆ defOutComeOfPhoton()

template<class T>
ParticleOutCome MCTruthPartClassifier::defOutComeOfPhoton ( T thePart)

Determine the outcome of a simulated photon from its end vertex (UnConverted, Converted, NuclInteraction or UnknownOutCome).

Definition at line 308 of file TruthClassifiers.h.

308 {
309 ParticleOutCome PartOutCome = UnknownOutCome;
310 auto EndVert = MC::findSimulatedEndVertex(thePart);
311 if (EndVert == nullptr) return UnConverted;
312
313 int PhtOutNumOfNucFr(0);
314 int PhtOutNumOfEl(0);
315 int PhtOutNumOfPos(0);
316 int PhtOutNumOfHadr(0);
317
318 auto outgoing = EndVert->particles_out();
319 int NumOfPhtDaug = outgoing.size();
320 for (const auto& p: outgoing) {
321 if (!p) continue;
322 int EndDaugType = p->pdg_id();
323 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) PhtOutNumOfNucFr++;
324 if (EndDaugType == 11) PhtOutNumOfEl++;
325 if (EndDaugType == -11) PhtOutNumOfPos++;
326 if (MC::isHadron(p) && !MC::isBeam(p)) PhtOutNumOfHadr++;
327 }
328
329 if (PhtOutNumOfEl == 1 && PhtOutNumOfPos == 1 && NumOfPhtDaug == 2) PartOutCome = Converted;
330 if ((NumOfPhtDaug > 1 && PhtOutNumOfNucFr != 0) || PhtOutNumOfHadr > 0) PartOutCome = NuclInteraction;
331
332 return PartOutCome;
333}

◆ defOutComeOfTau()

template<class T>
ParticleOutCome MCTruthPartClassifier::defOutComeOfTau ( T thePart)

Determine the outcome of a simulated tau from its decay products (NonInteract, NuclInteraction, DecaytoElectron/Muon, One/Three/FiveProng or UnknownOutCome).

Definition at line 278 of file TruthClassifiers.h.

278 {
279 ParticleOutCome PartOutCome = UnknownOutCome;
280 auto EndVert = MC::findSimulatedEndVertex(thePart);
281 if (EndVert == nullptr) return NonInteract;
282 int NumOfTauDaug = EndVert->nOutgoingParticles();
283 auto tauFinalStatePart = MC::findFinalStateParticles(EndVert);
284 auto PD = DecayProducts(tauFinalStatePart);
285 int NumOfElec = PD.apd(11);
286 int NumOfMuon = PD.apd(13);
287 int NumOfElecNeut = PD.apd(12);
288 int NumOfMuonNeut = PD.apd(14);
289 int NumOfPhot = PD.apd(22);
290 int NumOfPi = PD.apd(211);
291 int NumOfKaon = PD.apd(321);
292 int NumOfNucFr = PD.apd(0) + PD.apd(1000000000, std::numeric_limits<int>::max());
293
294 if (NumOfNucFr != 0) PartOutCome = NuclInteraction;
295 if ((NumOfTauDaug == 3 && NumOfElec == 1 && NumOfElecNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfElecNeut == 1)) PartOutCome = DecaytoElectron;
296 if ((NumOfTauDaug == 3 && NumOfMuon == 1 && NumOfMuonNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfMuonNeut == 1)) PartOutCome = DecaytoMuon;
297
298 if (NumOfPi == 1 || NumOfKaon == 1) PartOutCome = OneProng;
299 if (NumOfPi + NumOfKaon == 3) PartOutCome = ThreeProng;
300 if (NumOfPi + NumOfKaon == 5) PartOutCome = FiveProng;
301
302
303 return PartOutCome;
304}
auto findFinalStateParticles(V theVert) -> decltype(theVert->particles_out())
Function to find the descendants of the given vertex: its outgoing particles and, recursively,...

◆ defTypeOfElectron()

ParticleType MCTruthPartClassifier::defTypeOfElectron ( ParticleOrigin EleOrig,
bool isPrompt )
inline

Classify an electron (Unknown/Iso/NonIso/Bkg) from its origin; prompt electrons are always Iso.

Definition at line 64 of file TruthClassifiers.h.

64 {
65
66 if (EleOrig == NonDefined)
67 return UnknownElectron;
68
69 if (EleOrig == WBoson || EleOrig == ZBoson || EleOrig == top || EleOrig == SingleElec || EleOrig == Higgs ||
70 EleOrig == HiggsMSSM || EleOrig == HeavyBoson || EleOrig == WBosonLRSM || EleOrig == NuREle || EleOrig == NuRMu ||
71 EleOrig == NuRTau || EleOrig == LQ || EleOrig == SUSY || EleOrig == DiBoson || EleOrig == ZorHeavyBoson ||
72 EleOrig == OtherBSM || EleOrig == MultiBoson || isPrompt) {
73 return IsoElectron;
74 }
75 if (EleOrig == JPsi || EleOrig == BottomMeson || EleOrig == CharmedMeson || EleOrig == BottomBaryon ||
76 EleOrig == CharmedBaryon || EleOrig == TauLep || EleOrig == Mu || EleOrig == QuarkWeakDec) {
77 return NonIsoElectron;
78 }
79 return BkgElectron;
80}

◆ defTypeOfHadron()

ParticleType MCTruthPartClassifier::defTypeOfHadron ( int pdg)
inline

Classify a hadron by PDG ID into a ParticleType (Unknown if none applies).

Definition at line 48 of file TruthClassifiers.h.

48 {
49 if (MC::isBBbarMeson(pdg)) return BBbarMesonPart;
50 if (MC::isCCbarMeson(pdg)) return CCbarMesonPart;
51 if (MC::isBottomMeson(pdg)) return BottomMesonPart;
52 if (MC::isCharmMeson(pdg)) return CharmedMesonPart;
53 if (MC::isBottomBaryon(pdg)) return BottomBaryonPart;
54 if (MC::isCharmBaryon(pdg)) return CharmedBaryonPart;
56 if (MC::isLightBaryon(pdg)) return LightBaryonPart;
57 if (MC::isStrangeMeson(pdg)) return StrangeMesonPart;
58 if (MC::isLightMeson(pdg)) return LightMesonPart;
59 return Unknown;
60}

◆ defTypeOfMuon()

ParticleType MCTruthPartClassifier::defTypeOfMuon ( ParticleOrigin MuOrig,
bool isPrompt )
inline

Classify a muon (Unknown/Iso/NonIso/Bkg) from its origin; prompt muons are always Iso.

Definition at line 84 of file TruthClassifiers.h.

84 {
85
86 if (MuOrig == NonDefined) return UnknownMuon;
87
88 if (MuOrig == WBoson || MuOrig == ZBoson || MuOrig == top || MuOrig == SingleMuon || MuOrig == Higgs ||
89 MuOrig == HiggsMSSM || MuOrig == HeavyBoson || MuOrig == WBosonLRSM || MuOrig == NuREle || MuOrig == NuRMu ||
90 MuOrig == NuRTau || MuOrig == LQ || MuOrig == SUSY || MuOrig == DiBoson || MuOrig == ZorHeavyBoson ||
91 MuOrig == OtherBSM || MuOrig == MultiBoson || isPrompt) {
92 return IsoMuon;
93 }
94 if (MuOrig == JPsi || MuOrig == BottomMeson || MuOrig == CharmedMeson || MuOrig == BottomBaryon ||
95 MuOrig == CharmedBaryon || MuOrig == TauLep || MuOrig == QuarkWeakDec) {
96 return NonIsoMuon;
97 }
98 // if (MuOrig == Pion || MuOrig == Kaon ) return DecayMuon;
99 return BkgMuon;
100}

◆ defTypeOfPhoton()

ParticleType MCTruthPartClassifier::defTypeOfPhoton ( ParticleOrigin PhotOrig)
inline

Classify a photon (Unknown/Iso/NonIso/Bkg) from its origin.

Definition at line 121 of file TruthClassifiers.h.

122{
123 if (PhotOrig == NonDefined) return UnknownPhoton;
124
125 if (PhotOrig == WBoson || PhotOrig == ZBoson || PhotOrig == SinglePhot || PhotOrig == Higgs ||
126 PhotOrig == HiggsMSSM || PhotOrig == HeavyBoson || PhotOrig == PromptPhot || PhotOrig == SUSY ||
127 PhotOrig == OtherBSM)
128 return IsoPhoton;
129
130 if (PhotOrig == ISRPhot || PhotOrig == FSRPhot || PhotOrig == TauLep || PhotOrig == Mu || PhotOrig == NuREle ||
131 PhotOrig == NuRMu || PhotOrig == NuRTau)
132 return NonIsoPhoton;
133
134 return BkgPhoton;
135}

◆ defTypeOfTau()

ParticleType MCTruthPartClassifier::defTypeOfTau ( ParticleOrigin TauOrig)
inline

Classify a tau (Unknown/Iso/NonIso/Bkg) from its origin.

Definition at line 103 of file TruthClassifiers.h.

103 {
104 if (TauOrig == NonDefined) return UnknownTau;
105
106 if (TauOrig == WBoson || TauOrig == ZBoson || TauOrig == top || TauOrig == SingleTau || TauOrig == Higgs ||
107 TauOrig == HiggsMSSM || TauOrig == HeavyBoson || TauOrig == WBosonLRSM || TauOrig == NuREle || TauOrig == NuRMu ||
108 TauOrig == NuRTau || TauOrig == SUSY || TauOrig == DiBoson || TauOrig == ZorHeavyBoson || TauOrig == OtherBSM ||
109 TauOrig == MultiBoson)
110 return IsoTau;
111
112 if (TauOrig == JPsi || TauOrig == BottomMeson || TauOrig == CharmedMeson || TauOrig == BottomBaryon ||
113 TauOrig == CharmedBaryon || TauOrig == QuarkWeakDec)
114 return NonIsoTau;
115
116 return BkgTau;
117}

◆ isPrompt()

int MCTruthPartClassifier::isPrompt ( const unsigned int classify,
bool allow_prompt_tau_decays = true )
inline

Tell whether a particle is prompt, from the word returned by defOrigOfParticle().

Parameters
allow_prompt_tau_decayscount products of prompt tau decays as prompt
Returns
1 prompt, 0 non-prompt, -1 uncategorised

Definition at line 214 of file TruthClassifiers.h.

214 {
215 std::bitset<MCTC_bits::totalBits> res(classify);
216 if (res.test(MCTC_bits::uncat)) return -1;
217 bool fromPromptTau = res.test(MCTC_bits::Tau) && !res.test(MCTC_bits::HadTau);
218 if (fromPromptTau) return int(allow_prompt_tau_decays);
219 return !res.test(MCTC_bits::hadron);
220 }
std::pair< std::vector< unsigned int >, bool > res