rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
PartonicTops.hh
1// -*- C++ -*-
2#ifndef RIVET_PartonicTops_HH
3#define RIVET_PartonicTops_HH
4
5#include "Rivet/Projections/ParticleFinder.hh"
6
7namespace Rivet {
8
9
13 enum class TopDecay {
14 ANY=0, ALL=0,
15 ELECTRON,
16 MUON,
17 TAU,
18 E_MU,
19 E_MU_TAU,
20 HADRONIC
21 };
22
24 enum class WhichTop { FIRST, LAST };
25
26 enum class PromptEMuFromTau { YES, NO };
27
28 enum class InclHadronicTau { YES, NO };
29
30
40 public:
41
44
47 PromptEMuFromTau emu_from_prompt_tau=PromptEMuFromTau::YES,
48 InclHadronicTau include_hadronic_taus=InclHadronicTau::NO,
49 const Cut& c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
50 : ParticleFinder(c), _topmode(whichtop), _decaymode(decaymode),
51 _emu_from_prompt_tau(emu_from_prompt_tau == PromptEMuFromTau::YES),
52 _include_hadronic_taus(include_hadronic_taus == InclHadronicTau::YES)
53 { }
54
56 PartonicTops(TopDecay decaymode, const Cut& c,
57 PromptEMuFromTau emu_from_prompt_tau=PromptEMuFromTau::YES,
58 InclHadronicTau include_hadronic_taus=InclHadronicTau::NO,
59 WhichTop whichtop=WhichTop::LAST)
60 : PartonicTops(decaymode, emu_from_prompt_tau, include_hadronic_taus, c, whichtop)
61 { }
62
64 PartonicTops(const Cut& c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
65 : PartonicTops(TopDecay::ALL, PromptEMuFromTau::YES, InclHadronicTau::NO, c, whichtop)
66 { }
67
68
71
73
74
76 using Projection::operator =;
77
78
80 const Particles& tops() const { return _theParticles; }
81
82
84 void clear() {
85 _theParticles.clear();
86 }
87
88
89 protected:
90
92 void project(const Event& event) {
93
94 // Warn about how terrible this is, the first time it's called!
95 static bool donerubric = false;
96 if (!donerubric) {
97 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!");
98 donerubric = true;
99 }
100
101 // Find partonic tops
102 _theParticles = select(event.allParticles(_cuts), (_topmode == WhichTop::LAST ? lastParticleWith(isTop) : firstParticleWith(isTop)));
103
104 // Filtering by decay mode
105 if (_decaymode != TopDecay::ALL) {
106 const auto decaycheck = [&](const Particle& t) {
107 const Particles descendants = t.allDescendants();
108 const bool prompt_e = any(descendants, [&](const Particle& p){ return p.abspid() == PID::ELECTRON && p.isPrompt(_emu_from_prompt_tau) && !p.hasAncestorWith(Cuts::pid == PID::PHOTON, false); });
109 const bool prompt_mu = any(descendants, [&](const Particle& p){ return p.abspid() == PID::MUON && p.isPrompt(_emu_from_prompt_tau) && !p.hasAncestorWith(Cuts::pid == PID::PHOTON, false); });
110 if (prompt_e && (_decaymode == TopDecay::ELECTRON || _decaymode == TopDecay::E_MU || _decaymode == TopDecay::E_MU_TAU)) return true;
111 if (prompt_mu && (_decaymode == TopDecay::MUON || _decaymode == TopDecay::E_MU || _decaymode == TopDecay::E_MU_TAU)) return true;
112 const bool prompt_tau = any(descendants, [&](const Particle& p){ return p.abspid() == PID::TAU && p.isPrompt() && !p.hasAncestorWith(Cuts::pid == PID::PHOTON, false); });
113 const bool prompt_hadronic_tau = any(descendants, [&](const Particle& p){ return p.abspid() == PID::TAU && p.isPrompt() && !p.hasAncestorWith(Cuts::pid == PID::PHOTON, false) && none(p.children(), isChargedLepton); });
114 if (prompt_tau && (_decaymode == TopDecay::TAU || _decaymode == TopDecay::E_MU_TAU)) return (_include_hadronic_taus || !prompt_hadronic_tau);
115 if (_decaymode == TopDecay::HADRONIC && (!prompt_e && !prompt_mu && (!prompt_tau || (_include_hadronic_taus && prompt_hadronic_tau)))) return true; //< logical hairiness...
116 return false;
117 };
118 iselect(_theParticles, decaycheck);
119 }
120
121 // Filtering and warning about unphysical partonic tops
122 const auto physcheck = [&](const Particle& t) {
123 if (t.E() < 0 || t.mass() < 0) {
124 MSG_WARNING("Unphysical partonic top with negative E or m found: " << t.mom());
125 return false;
126 }
127 return true;
128 };
129 iselect(_theParticles, physcheck);
130 }
131
132
134 CmpState compare(const Projection& p) const {
135 const PartonicTops& other = dynamic_cast<const PartonicTops&>(p);
136 return cmp(_cuts, other._cuts) ||
137 cmp(_topmode, other._topmode) ||
138 cmp(_decaymode, other._decaymode) ||
139 cmp(_emu_from_prompt_tau, other._emu_from_prompt_tau) ||
140 cmp(_include_hadronic_taus, other._include_hadronic_taus);
141 }
142
143
144 protected:
145
146 WhichTop _topmode;
147
148 TopDecay _decaymode;
149
150 bool _emu_from_prompt_tau, _include_hadronic_taus;
151
152 };
153
154
155}
156
157#endif
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:45
Specialised vector of Particle objects.
Definition Particle.hh:21
Convenience finder of partonic top quarks.
Definition PartonicTops.hh:39
const Particles & tops() const
Access to the found partonic tops.
Definition PartonicTops.hh:80
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:46
CmpState compare(const Projection &p) const
Compare projections.
Definition PartonicTops.hh:134
void clear()
Clear the projection.
Definition PartonicTops.hh:84
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:56
PartonicTops(const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Simple constructor optionally taking cuts object.
Definition PartonicTops.hh:64
RIVET_DEFAULT_PROJ_CLONE(PartonicTops)
Clone on the heap.
void project(const Event &event)
Apply the projection on the supplied event.
Definition PartonicTops.hh:92
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:330
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition Utils.hh:379
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:152
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:187
Definition MC_CENT_PPB_Projections.hh:10
WhichTop
Enum for categorising which top quark to be selected: last (weakly decaying) or first?
Definition PartonicTops.hh:24
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:255
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:547
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:566