Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/PartonicTops.hh Source File

| Rivet 3.1.9

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
18 class PartonicTops : public ParticleFinder {
19 public:
20
24 enum class DecayMode {
25 ANY = 0,
26 ALL = 0,
27 ELECTRON,
28 MUON,
29 TAU,
30 E_MU,
31 E_MU_TAU,
32 HADRONIC
33 };
34
36 enum class WhichTop { FIRST, LAST };
37
38
40
41
43 PartonicTops(DecayMode decaymode, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, const Cut& c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
44 : ParticleFinder(c), _topmode(whichtop), _decaymode(decaymode),
45 _emu_from_prompt_tau(emu_from_prompt_tau), _include_hadronic_taus(include_hadronic_taus)
46 { }
47
49 PartonicTops(DecayMode decaymode, const Cut& c, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, WhichTop whichtop=WhichTop::LAST)
50 : PartonicTops(decaymode, emu_from_prompt_tau, include_hadronic_taus, c, whichtop)
51 { }
52
54 PartonicTops(const Cut& c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
55 : PartonicTops(DecayMode::ALL, true, false, c, whichtop)
56 { }
57
58
60 DEFAULT_RIVET_PROJ_CLONE(PartonicTops);
61
63
65 using Projection::operator =;
66
67
69 const Particles& tops() const { return _theParticles; }
70
71
73 void clear() {
74 _theParticles.clear();
75 }
76
77
78 protected:
79
81 void project(const Event& event) {
82
83 // Warn about how terrible this is, the first time it's called!
84 static bool donerubric = false;
85 if (!donerubric) {
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!");
87 donerubric = true;
88 }
89
90 // Find partonic tops
91 _theParticles = filter_select(event.allParticles(_cuts), (_topmode == WhichTop::LAST ? lastParticleWith(isTop) : firstParticleWith(isTop)));
92
93 // Filtering by decay mode
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; //< logical hairiness...
105 return false;
106 };
107 ifilter_select(_theParticles, decaycheck);
108 }
109
110 // Filtering and warning about unphysical partonic tops
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());
114 return false;
115 }
116 return true;
117 };
118 ifilter_select(_theParticles, physcheck);
119 }
120
121
123 CmpState compare(const Projection& p) const {
124 const PartonicTops& other = dynamic_cast<const PartonicTops&>(p);
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);
130 }
131
132
133 protected:
134
135 WhichTop _topmode;
136
137 DecayMode _decaymode;
138
139 bool _emu_from_prompt_tau, _include_hadronic_taus;
140
141 };
142
143
144}
145
146#endif
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::Event::allParticles
const Particles & allParticles() const
All the raw GenEvent particles, wrapped in Rivet::Particle objects.
Rivet::ParticleFinder
Base class for projections which return subsets of an event's particles.
Definition ParticleFinder.hh:11
Rivet::Particle
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:53
Rivet::Particles
Specialised vector of Particle objects.
Definition Particle.hh:25
Rivet::PartonicTops
Convenience finder of partonic top quarks.
Definition PartonicTops.hh:18
Rivet::PartonicTops::DecayMode
DecayMode
Enum for categorising top quark decay modes.
Definition PartonicTops.hh:24
Rivet::PartonicTops::tops
const Particles & tops() const
Access to the found partonic tops.
Definition PartonicTops.hh:69
Rivet::PartonicTops::PartonicTops
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
Rivet::PartonicTops::DEFAULT_RIVET_PROJ_CLONE
DEFAULT_RIVET_PROJ_CLONE(PartonicTops)
Clone on the heap.
Rivet::PartonicTops::compare
CmpState compare(const Projection &p) const
Compare projections.
Definition PartonicTops.hh:123
Rivet::PartonicTops::clear
void clear()
Clear the projection.
Definition PartonicTops.hh:73
Rivet::PartonicTops::WhichTop
WhichTop
Enum for categorising which top quark to be selected: last (weakly decaying) or first?
Definition PartonicTops.hh:36
Rivet::PartonicTops::PartonicTops
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
Rivet::PartonicTops::PartonicTops
PartonicTops(const Cut &c=Cuts::OPEN, WhichTop whichtop=WhichTop::LAST)
Simple constructor optionally taking cuts object.
Definition PartonicTops.hh:54
Rivet::PartonicTops::project
void project(const Event &event)
Apply the projection on the supplied event.
Definition PartonicTops.hh:81
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::none
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition Utils.hh:369
Rivet::any
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition Utils.hh:325
Rivet::filter_select
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
Rivet::ifilter_select
Jets & ifilter_select(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
MSG_WARNING
#define MSG_WARNING(x)
Warning messages for non-fatal bad things, using MSG_LVL.
Definition Logging.hh:200
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet
Definition MC_Cent_pPb.hh:10
Rivet::cmp
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:255
Rivet::FirstParticleWith
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:556
Rivet::LastParticleWith
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:575