rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
PartonicTops.hh
1 // -*- C++ -*-
2 #ifndef RIVET_PartonicTops_HH
3 #define RIVET_PartonicTops_HH
4 
5 #include "Rivet/Projections/ParticleFinder.hh"
6 
7 namespace Rivet {
8 
9 
14  class PartonicTops : public ParticleFinder {
15  public:
16 
17 
21  enum DecayMode { ALL = 0, ANY = 0, ELECTRON, MUON, TAU, E_MU, E_MU_TAU, HADRONIC };
22 
24  enum TopMode { FIRST, LAST };
25 
26 
28 
29 
31  PartonicTops(const Cut& c=Cuts::OPEN, TopMode whichtop=LAST)
32  : ParticleFinder(c), _topmode(whichtop), _decaymode(ALL),
33  _emu_from_prompt_tau(true), _include_hadronic_taus(false)
34  { }
35 
37  PartonicTops(DecayMode decaymode, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, const Cut& c=Cuts::OPEN, TopMode whichtop=LAST)
38  : ParticleFinder(c), _topmode(whichtop), _decaymode(decaymode),
39  _emu_from_prompt_tau(emu_from_prompt_tau), _include_hadronic_taus(include_hadronic_taus)
40  { }
41 
43  PartonicTops(DecayMode decaymode, const Cut& c, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, TopMode 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 
48 
51 
53 
54 
56  const Particles& tops() const { return _theParticles; }
57 
58 
60  void clear() {
61  _theParticles.clear();
62  }
63 
64 
65  protected:
66 
68  void project(const Event& event) {
69  // Find partonic tops
70  _theParticles = filter_select(event.allParticles(_cuts), (_topmode == LAST ? lastParticleWith(isTop) : firstParticleWith(isTop)));
71  // Filtering by decay mode
72  if (_decaymode != ALL) {
73  const auto fn = [&](const Particle& t) {
74  const Particles descendants = t.allDescendants();
75  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); });
76  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); });
77  if (prompt_e && (_decaymode == ELECTRON || _decaymode == E_MU || _decaymode == E_MU_TAU)) return true;
78  if (prompt_mu && (_decaymode == MUON || _decaymode == E_MU || _decaymode == E_MU_TAU)) return true;
79  const bool prompt_tau = any(descendants, [&](const Particle& p){ return p.abspid() == PID::TAU && p.isPrompt() && !p.hasAncestor(PID::PHOTON, false); });
80  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); });
81  if (prompt_tau && (_decaymode == TAU || _decaymode == E_MU_TAU)) return (_include_hadronic_taus || !prompt_hadronic_tau);
82  if (_decaymode == HADRONIC && (!prompt_e && !prompt_mu && (!prompt_tau || (_include_hadronic_taus && prompt_hadronic_tau)))) return true; //< logical hairiness...
83  return false;
84  };
85  ifilter_select(_theParticles, fn);
86  }
87  }
88 
89 
91  int compare(const Projection& p) const {
92  const PartonicTops& other = dynamic_cast<const PartonicTops&>(p);
93  return cmp(_cuts, other._cuts) ||
94  cmp(_topmode, other._topmode) ||
95  cmp(_decaymode, other._decaymode) ||
96  cmp(_emu_from_prompt_tau, other._emu_from_prompt_tau) ||
97  cmp(_include_hadronic_taus, other._include_hadronic_taus);
98  }
99 
100 
101  private:
102 
103  TopMode _topmode;
104 
105  DecayMode _decaymode;
106 
107  bool _emu_from_prompt_tau, _include_hadronic_taus;
108 
109  };
110 
111 
112 }
113 
114 
115 #endif
Definition: ALICE_2010_I880049.cc:13
void project(const Event &event)
Apply the projection on the supplied event.
Definition: PartonicTops.hh:68
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition: Utils.hh:287
DecayMode
Enum for categorising top quark decay modes.
Definition: PartonicTops.hh:21
Particles children(const Cut &c=Cuts::OPEN) const
Get a list of the direct descendants from the current particle (with optional selection Cut) ...
Definition: Particle.cc:104
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition: Particle.hh:18
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition: Utils.hh:315
Base class for projections which return subsets of an event&#39;s particles.
Definition: ParticleFinder.hh:11
Definition: Event.hh:22
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:143
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:558
int compare(const Projection &p) const
Compare projections.
Definition: PartonicTops.hh:91
DEFAULT_RIVET_PROJ_CLONE(PartonicTops)
Clone on the heap.
PartonicTops(const Cut &c=Cuts::OPEN, TopMode whichtop=LAST)
Constructor optionally taking cuts object.
Definition: PartonicTops.hh:31
PartonicTops(DecayMode decaymode, const Cut &c, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, TopMode whichtop=LAST)
Constructor taking decay mode details (and an optional cuts object)
Definition: PartonicTops.hh:43
const Particles & allParticles() const
All the raw GenEvent particles, wrapped in Rivet::Particle objects.
Definition: Event.cc:47
void clear()
Clear the projection.
Definition: PartonicTops.hh:60
Convenience finder of partonic top quarks.
Definition: PartonicTops.hh:14
const Particles & tops() const
Access to the found partonic tops.
Definition: PartonicTops.hh:56
PartonicTops(DecayMode decaymode, bool emu_from_prompt_tau=true, bool include_hadronic_taus=false, const Cut &c=Cuts::OPEN, TopMode whichtop=LAST)
Constructor taking decay mode details (and an optional cuts object)
Definition: PartonicTops.hh:37
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:577
Base class for all Rivet projections.
Definition: Projection.hh:29
PdgId abspid() const
Absolute value of the PDG ID code.
Definition: Particle.hh:137
bool isPrompt(bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) const
Alias for isDirect.
Definition: Particle.hh:500
Jets & ifilter_select(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition: JetUtils.cc:7
bool hasAncestor(PdgId pid, bool only_physical=true) const
Definition: Particle.cc:193
TopMode
Enum for categorising which top quark to be selected: last (weakly decaying) or first?
Definition: PartonicTops.hh:24
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition: Cmp.hh:285