2#ifndef RIVET_PartonicTops_HH
3#define RIVET_PartonicTops_HH
5#include "Rivet/Projections/ParticleFinder.hh"
13 enum class TopDecay { ANY = 0, ALL = 0, ELECTRON, MUON, TAU, E_MU, E_MU_TAU, HADRONIC };
18 enum class PromptEMuFromTau { YES, NO };
20 enum class InclHadronicTau { YES, NO };
39 PromptEMuFromTau emu_from_prompt_tau = PromptEMuFromTau::YES,
40 InclHadronicTau include_hadronic_taus = InclHadronicTau::NO,
41 const Cut& c = Cuts::OPEN,
45 _decaymode(decaymode),
46 _emu_from_prompt_tau(emu_from_prompt_tau == PromptEMuFromTau::YES),
47 _include_hadronic_taus(include_hadronic_taus == InclHadronicTau::YES) { }
52 PromptEMuFromTau emu_from_prompt_tau = PromptEMuFromTau::YES,
53 InclHadronicTau include_hadronic_taus = InclHadronicTau::NO,
55 :
PartonicTops(decaymode, emu_from_prompt_tau, include_hadronic_taus, c, whichtop) { }
69 using Projection::operator=;
80 _theParticles.clear();
90 static bool donerubric =
false;
92 MSG_WARNING(
"PartonicTops is not recommended: MC generators do not guarantee physical properties "
93 "for, or even the existence of, partonic event-record entries. Caveat emptor!");
99 (_topmode == WhichTop::LAST ? lastParticleWith(isTop)
100 : firstParticleWith(isTop)));
103 if (_decaymode != TopDecay::ALL) {
104 const auto decaycheck = [&](
const Particle& t) {
105 const Particles descendants = t.allDescendants();
106 const bool prompt_e =
any(descendants, [&](
const Particle&
p) {
107 return p.abspid() == PID::ELECTRON &&
p.isPrompt(_emu_from_prompt_tau)
108 && !
p.hasAncestorWith(Cuts::pid == PID::PHOTON,
false);
110 const bool prompt_mu =
any(descendants, [&](
const Particle&
p) {
111 return p.abspid() == PID::MUON &&
p.isPrompt(_emu_from_prompt_tau)
112 && !
p.hasAncestorWith(Cuts::pid == PID::PHOTON,
false);
115 && (_decaymode == TopDecay::ELECTRON || _decaymode == TopDecay::E_MU
116 || _decaymode == TopDecay::E_MU_TAU))
119 && (_decaymode == TopDecay::MUON || _decaymode == TopDecay::E_MU
120 || _decaymode == TopDecay::E_MU_TAU))
122 const bool prompt_tau =
any(descendants, [&](
const Particle&
p) {
123 return p.abspid() == PID::TAU &&
p.isPrompt()
124 && !
p.hasAncestorWith(Cuts::pid == PID::PHOTON,
false);
126 const bool prompt_hadronic_tau =
any(descendants, [&](
const Particle&
p) {
127 return p.abspid() == PID::TAU &&
p.isPrompt()
128 && !
p.hasAncestorWith(Cuts::pid == PID::PHOTON,
false) &&
none(
p.children(), isChargedLepton);
130 if (prompt_tau && (_decaymode == TopDecay::TAU || _decaymode == TopDecay::E_MU_TAU))
131 return (_include_hadronic_taus || !prompt_hadronic_tau);
132 if (_decaymode == TopDecay::HADRONIC
133 && (!prompt_e && !prompt_mu
134 && (!prompt_tau || (_include_hadronic_taus && prompt_hadronic_tau))))
138 iselect(_theParticles, decaycheck);
142 const auto physcheck = [&](
const Particle& t) {
143 if (t.E() < 0 || t.mass() < 0) {
144 MSG_WARNING(
"Unphysical partonic top with negative E or m found: " << t.mom());
149 iselect(_theParticles, physcheck);
156 return cmp(_cuts, other._cuts) ||
cmp(_topmode, other._topmode) ||
cmp(_decaymode, other._decaymode)
157 ||
cmp(_emu_from_prompt_tau, other._emu_from_prompt_tau)
158 ||
cmp(_include_hadronic_taus, other._include_hadronic_taus);
168 bool _emu_from_prompt_tau, _include_hadronic_taus;
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
const Particles & allParticles() const
All the raw GenEvent particles, wrapped in Rivet::Particle objects.
ParticleFinder(const Cut &c=Cuts::OPEN)
Construction using Cuts object.
Definition ParticleFinder.hh:20
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:50
Specialised vector of Particle objects.
Definition Particle.hh:21
const Particles & tops() const
Access to the found partonic tops.
Definition PartonicTops.hh:73
PartonicTops(TopDecay decaymode, PromptEMuFromTau emu_from_prompt_tau=PromptEMuFromTau::YES, InclHadronicTau include_hadronic_taus=InclHadronicTau::NO, const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Constructor taking decay mode details (and an optional cuts object).
Definition PartonicTops.hh:38
CmpState compare(const Projection &p) const
Compare projections.
Definition PartonicTops.hh:154
void clear()
Clear the projection.
Definition PartonicTops.hh:79
PartonicTops(TopDecay decaymode, const Cut &c, PromptEMuFromTau emu_from_prompt_tau=PromptEMuFromTau::YES, InclHadronicTau include_hadronic_taus=InclHadronicTau::NO, WhichTop whichtop=WhichTop::LAST)
Constructor taking decay mode details (and a non-optional cuts object).
Definition PartonicTops.hh:50
PartonicTops(const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Simple constructor optionally taking cuts object.
Definition PartonicTops.hh:58
RIVET_DEFAULT_PROJ_CLONE(PartonicTops)
Clone on the heap.
void project(const Event &event)
Apply the projection on the supplied event.
Definition PartonicTops.hh:87
Base class for all Rivet projections.
Definition Projection.hh:29
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition Utils.hh:364
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition Utils.hh:418
Jets select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition JetUtils.hh:183
Jets & iselect(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
#define MSG_WARNING(x)
Warning messages for non-fatal bad things, using MSG_LVL.
Definition Logging.hh:200
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
Definition LHCbCommon.hh:9
WhichTop
Enum for categorising which top quark to be selected: last (weakly decaying) or first?
Definition PartonicTops.hh:16
TopDecay
Enum for categorising top quark decay modes.
Definition PartonicTops.hh:13
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:253