LossyFinalState.hh
// -*- C++ -*-
#ifndef RIVET_LossyFinalState_HH
#define RIVET_LossyFinalState_HH
#include "Rivet/Tools/Logging.hh"
#include "Rivet/Rivet.hh"
#include "Rivet/Particle.hh"
#include "Rivet/Event.hh"
#include "Rivet/Projection.hh"
#include "Rivet/Projections/FinalState.hh"
namespace Rivet {
template <typename FILTER>
class LossyFinalState : public FinalState {
public:
LossyFinalState(const FinalState& fsp, FILTER filter)
: _filter(filter)
{
setName("LossyFinalState");
addProjection(fsp, "FS");
}
LossyFinalState(FILTER filter,
double mineta = -MAXRAPIDITY,
double maxeta = MAXRAPIDITY,
double minpt = 0.0)
: _filter(filter)
{
setName("LossyFinalState");
addProjection(FinalState(mineta, maxeta, minpt), "FS");
}
virtual ~LossyFinalState() { }
virtual const Projection* clone() const {
return new LossyFinalState<FILTER>(*this);
}
protected:
void project(const Event& e) {
const FinalState& fs = applyProjection<FinalState>(e, "FS");
getLog() << Log::DEBUG << "Pre-loss number of FS particles = " << fs.particles().size() << endl;
_theParticles.clear();
std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
std::back_inserter(_theParticles), _filter);
getLog() << Log::DEBUG << "Filtered number of FS particles = " << _theParticles.size() << endl;
}
int compare(const Projection& p) const {
const LossyFinalState<FILTER>& other = pcast< LossyFinalState<FILTER> >(p);
const int fscmp = mkNamedPCmp(other, "FS");
if (fscmp) return fscmp;
return _filter.compare(other._filter);
}
protected:
FILTER _filter;
};
}
#endif
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:120
Rivet
Definition: MC_JetAnalysis.hh:9
Rivet::LossyFinalState::~LossyFinalState
virtual ~LossyFinalState()
Virtual destructor, to allow subclassing.
Definition: LossyFinalState.hh:43
Rivet::LossyFinalState
Templated FS projection which can lose some of the supplied particles.
Definition: LossyFinalState.hh:17
Rivet::FinalState::particles
virtual const ParticleVector & particles() const
Get the final-state particles.
Definition: FinalState.hh:39
Rivet::LossyFinalState::project
void project(const Event &e)
Apply the projection on the supplied event.
Definition: LossyFinalState.hh:56
Rivet::Event
Definition: Event.hh:22
Rivet::LossyFinalState::LossyFinalState
LossyFinalState(const FinalState &fsp, FILTER filter)
Constructor from FinalState.
Definition: LossyFinalState.hh:24
Rivet::LossyFinalState::compare
int compare(const Projection &p) const
Compare projections.
Definition: LossyFinalState.hh:67
Rivet::Projection::mkNamedPCmp
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:51
Rivet::FinalState
Project out all final-state particles in an event. Probably the most important projection in Rivet! ...
Definition: FinalState.hh:14
Rivet::ProjectionApplier::addProjection
const PROJ & addProjection(const PROJ &proj, const std::string &name)
Definition: ProjectionApplier.hh:113
Rivet::FinalState::FinalState
FinalState(double mineta=-MAXRAPIDITY, double maxeta=MAXRAPIDITY, double minpt=0.0 *GeV)
Definition: FinalState.cc:9
Rivet::LossyFinalState::clone
virtual const Projection * clone() const
Clone on the heap.
Definition: LossyFinalState.hh:46
Rivet::MAXRAPIDITY
static const double MAXRAPIDITY
A sensible default maximum value of rapidity for Rivet analyses to use.
Definition: Rivet.hh:24
Rivet::LossyFinalState::LossyFinalState
LossyFinalState(FILTER filter, double mineta=-MAXRAPIDITY, double maxeta=MAXRAPIDITY, double minpt=0.0)
Stand-alone constructor. Initialises the base FinalState projection.
Definition: LossyFinalState.hh:32
Rivet::Projection
Base class for all Rivet projections.
Definition: Projection.hh:28
Rivet::Projection::getLog
Log & getLog() const
Get a Log object based on the getName() property of the calling projection object.
Definition: Projection.hh:114