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

| Rivet 3.1.9

LossyFinalState.hh
1// -*- C++ -*-
2#ifndef RIVET_LossyFinalState_HH
3#define RIVET_LossyFinalState_HH
4
5#include "Rivet/Tools/Logging.hh"
6#include "Rivet/Config/RivetCommon.hh"
7#include "Rivet/Particle.hh"
8#include "Rivet/Event.hh"
9#include "Rivet/Projection.hh"
10#include "Rivet/Projections/FinalState.hh"
11
12namespace Rivet {
13
14
16 template <typename FILTER>
17 class LossyFinalState : public FinalState {
18 public:
19
21
22
24 LossyFinalState(const FinalState& fsp, FILTER filter)
25 : _filter(filter)
26 {
27 setName("LossyFinalState");
28 declare(fsp, "FS");
29 }
30
32 LossyFinalState(FILTER filter, const Cut& c=Cuts::open())
33 : _filter(filter)
34 {
35 setName("LossyFinalState");
36 declare(FinalState(c), "FS");
37 }
38
40 virtual ~LossyFinalState() { }
41
43 DEFAULT_RIVET_PROJ_CLONE(LossyFinalState);
44
46
48 using Projection::operator =;
49
50
52 void project(const Event& e) {
53 const FinalState& fs = applyProjection<FinalState>(e, "FS");
54 getLog() << Log::DEBUG << "Pre-loss number of FS particles = " << fs.particles().size() << '\n';
55 _theParticles.clear();
56 std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
57 std::back_inserter(_theParticles), _filter);
58 getLog() << Log::DEBUG << "Filtered number of FS particles = " << _theParticles.size() << '\n';
59 }
60
61
63 CmpState compare(const Projection& p) const {
64 const LossyFinalState<FILTER>& other = pcast< LossyFinalState<FILTER> >(p);
65 const CmpState fscmp = mkNamedPCmp(other, "FS");
66 if (fscmp != CmpState::EQ) return fscmp;
67 return _filter.compare(other._filter);
68 }
69
70
71 protected:
72
74 FILTER _filter;
75
76 };
77
78
79}
80
81#endif
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::FinalState
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
Rivet::LossyFinalState
Templated FS projection which can lose some of the supplied particles.
Definition LossyFinalState.hh:17
Rivet::LossyFinalState::compare
CmpState compare(const Projection &p) const
Compare projections.
Definition LossyFinalState.hh:63
Rivet::LossyFinalState::~LossyFinalState
virtual ~LossyFinalState()
Virtual destructor, to allow subclassing.
Definition LossyFinalState.hh:40
Rivet::LossyFinalState::LossyFinalState
LossyFinalState(const FinalState &fsp, FILTER filter)
Constructor from FinalState.
Definition LossyFinalState.hh:24
Rivet::LossyFinalState::project
void project(const Event &e)
Apply the projection on the supplied event.
Definition LossyFinalState.hh:52
Rivet::LossyFinalState::LossyFinalState
LossyFinalState(FILTER filter, const Cut &c=Cuts::open())
Stand-alone constructor. Initialises the base FinalState projection.
Definition LossyFinalState.hh:32
Rivet::LossyFinalState::DEFAULT_RIVET_PROJ_CLONE
DEFAULT_RIVET_PROJ_CLONE(LossyFinalState)
Clone on the heap.
Rivet::ParticleFinder::particles
virtual const Particles & particles() const
Get the particles in no particular order, with no cuts.
Definition ParticleFinder.hh:52
Rivet::ProjectionApplier::declare
const PROJ & declare(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition ProjectionApplier.hh:170
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Rivet::Projection::getLog
Log & getLog() const
Get a Log object based on the getName() property of the calling projection object.
Definition Projection.hh:136
Rivet::Projection::mkNamedPCmp
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet::Cuts::open
const Cut & open()
Fully open cut singleton, accepts everything.
Rivet
Definition MC_Cent_pPb.hh:10