2#ifndef RIVET_PartonicTops_HH
3#define RIVET_PartonicTops_HH
5#include "Rivet/Projections/ParticleFinder.hh"
43 PartonicTops(
DecayMode decaymode,
bool emu_from_prompt_tau=
true,
bool include_hadronic_taus=
false,
const Cut& c=Cuts::OPEN,
WhichTop whichtop=WhichTop::LAST)
45 _emu_from_prompt_tau(emu_from_prompt_tau), _include_hadronic_taus(include_hadronic_taus)
50 :
PartonicTops(decaymode, emu_from_prompt_tau, include_hadronic_taus, c, whichtop)
65 using Projection::operator =;
74 _theParticles.clear();
84 static bool donerubric =
false;
86 MSG_WARNING(
"PartonicTops is not recommended: MC generators do not guarantee physical properties for, or even the existence of, partonic event-record entries. Caveat emptor!");
94 if (_decaymode != DecayMode::ALL) {
95 const auto decaycheck = [&](
const Particle& t) {
96 const Particles descendants = t.allDescendants();
97 const bool prompt_e =
any(descendants, [&](
const Particle&
p){
return p.abspid() == PID::ELECTRON &&
p.isPrompt(_emu_from_prompt_tau) && !
p.hasAncestor(PID::PHOTON,
false); });
98 const bool prompt_mu =
any(descendants, [&](
const Particle&
p){
return p.abspid() == PID::MUON &&
p.isPrompt(_emu_from_prompt_tau) && !
p.hasAncestor(PID::PHOTON,
false); });
99 if (prompt_e && (_decaymode == DecayMode::ELECTRON || _decaymode == DecayMode::E_MU || _decaymode == DecayMode::E_MU_TAU))
return true;
100 if (prompt_mu && (_decaymode == DecayMode::MUON || _decaymode == DecayMode::E_MU || _decaymode == DecayMode::E_MU_TAU))
return true;
101 const bool prompt_tau =
any(descendants, [&](
const Particle&
p){
return p.abspid() == PID::TAU &&
p.isPrompt() && !
p.hasAncestor(PID::PHOTON,
false); });
102 const bool prompt_hadronic_tau =
any(descendants, [&](
const Particle&
p){
return p.abspid() == PID::TAU &&
p.isPrompt() && !
p.hasAncestor(PID::PHOTON,
false) &&
none(
p.children(), isChargedLepton); });
103 if (prompt_tau && (_decaymode == DecayMode::TAU || _decaymode == DecayMode::E_MU_TAU))
return (_include_hadronic_taus || !prompt_hadronic_tau);
104 if (_decaymode == DecayMode::HADRONIC && (!prompt_e && !prompt_mu && (!prompt_tau || (_include_hadronic_taus && prompt_hadronic_tau))))
return true;
111 const auto physcheck = [&](
const Particle& t) {
112 if (t.E() < 0 || t.mass() < 0) {
113 MSG_WARNING(
"Unphysical partonic top with negative E or m found: " << t.mom());
125 return cmp(_cuts, other._cuts) ||
126 cmp(_topmode, other._topmode) ||
127 cmp(_decaymode, other._decaymode) ||
128 cmp(_emu_from_prompt_tau, other._emu_from_prompt_tau) ||
129 cmp(_include_hadronic_taus, other._include_hadronic_taus);
139 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.
Base class for projections which return subsets of an event's particles.
Definition ParticleFinder.hh:11
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:53
Specialised vector of Particle objects.
Definition Particle.hh:25
Convenience finder of partonic top quarks.
Definition PartonicTops.hh:18
DecayMode
Enum for categorising top quark decay modes.
Definition PartonicTops.hh:24
const Particles & tops() const
Access to the found partonic tops.
Definition PartonicTops.hh:69
PartonicTops(DecayMode decaymode, const Cut &c, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, WhichTop whichtop=WhichTop::LAST)
Constructor taking decay mode details (and a non-optional cuts object)
Definition PartonicTops.hh:49
DEFAULT_RIVET_PROJ_CLONE(PartonicTops)
Clone on the heap.
CmpState compare(const Projection &p) const
Compare projections.
Definition PartonicTops.hh:123
void clear()
Clear the projection.
Definition PartonicTops.hh:73
WhichTop
Enum for categorising which top quark to be selected: last (weakly decaying) or first?
Definition PartonicTops.hh:36
PartonicTops(DecayMode decaymode, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Constructor taking decay mode details (and an optional cuts object)
Definition PartonicTops.hh:43
PartonicTops(const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Simple constructor optionally taking cuts object.
Definition PartonicTops.hh:54
void project(const Event &event)
Apply the projection on the supplied event.
Definition PartonicTops.hh:81
Base class for all Rivet projections.
Definition Projection.hh:29
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition Utils.hh:369
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition Utils.hh:325
Jets filter_select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition JetUtils.hh:157
Jets & ifilter_select(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:684
Definition MC_Cent_pPb.hh:10
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:255
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:556
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:575