Projection.hh
// -*- C++ -*-
#ifndef RIVET_Projection_HH
#define RIVET_Projection_HH
#include "Rivet/Rivet.hh"
#include "Rivet/Projection.fhh"
#include "Rivet/ProjectionApplier.hh"
#include "Rivet/ProjectionHandler.hh"
#include "Rivet/Constraints.hh"
#include "Rivet/ParticleName.hh"
#include "Rivet/Event.fhh"
#include "Rivet/Tools/Logging.hh"
#include "Rivet/Cmp.fhh"
namespace Rivet {
class Projection : public ProjectionApplier {
public:
friend class Event;
friend class Cmp<Projection>;
public:
Projection();
virtual const Projection* clone() const = 0;
virtual ~Projection();
public:
virtual void project(const Event& e) = 0;
protected:
virtual int compare(const Projection& p) const = 0;
public:
bool before(const Projection& p) const;
virtual const std::set<PdgIdPair> beamPairs() const;
virtual std::string name() const {
return _name;
}
Projection& addPdgIdPair(PdgId beam1, PdgId beam2) {
_beamPairs.insert(PdgIdPair(beam1, beam2));
return *this;
}
Log& getLog() const {
string logname = "Rivet.Projection." + name();
return Log::getLog(logname);
}
void setName(const std::string& name) {
_name = name;
}
protected:
Cmp<Projection> mkNamedPCmp(const Projection& otherparent, const std::string& pname) const;
Cmp<Projection> mkPCmp(const Projection& otherparent, const std::string& pname) const;
private:
string _name;
set<PdgIdPair> _beamPairs;
};
}
inline bool std::less<const Rivet::Projection *>::operator()(const Rivet::Projection* x,
const Rivet::Projection* y) const {
return x->before(*y);
}
// Definition of the comparison objects and functions
#include "Rivet/Cmp.hh"
#endif
Rivet::PdgId
int PdgId
Typedef for a PDG ID code.
Definition: Particle.fhh:29
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:120
Rivet::Projection::Projection
Projection()
The default constructor.
Definition: Projection.cc:10
Rivet::Projection::name
virtual std::string name() const
Get the name of the projection.
Definition: Projection.hh:101
Rivet::Log::getLog
static Log & getLog(const std::string &name)
Definition: Logging.cc:55
Rivet::Log
Definition: Logging.hh:9
Rivet::Projection::compare
virtual int compare(const Projection &p) const =0
Rivet::Projection::project
virtual void project(const Event &e)=0
Rivet::Projection::addPdgIdPair
Projection & addPdgIdPair(PdgId beam1, PdgId beam2)
Add a colliding beam pair.
Definition: Projection.hh:107
Rivet::Event
Definition: Event.hh:22
Rivet::ProjectionApplier
Common base class for Projection and Analysis, used for internal polymorphism.
Definition: ProjectionApplier.hh:18
Rivet::Projection::before
bool before(const Projection &p) const
Definition: Projection.cc:28
Rivet::Cmp< Projection >
Specialization of Cmp for checking the ordering of two {Projection}s.
Definition: Cmp.hh:112
std::less< const Rivet::Projection * >::operator()
bool operator()(const Rivet::Projection *x, const Rivet::Projection *y) const
Define &quot;less&quot; operator for Projection* containers in terms of the Projection::before virtual method...
Definition: Projection.hh:152
Rivet::Projection::beamPairs
virtual const std::set< PdgIdPair > beamPairs() const
Definition: Projection.cc:39
Rivet::PdgIdPair
std::pair< PdgId, PdgId > PdgIdPair
Typedef for a pair of particle names.
Definition: Particle.fhh:32
Rivet::Projection::clone
virtual const Projection * clone() const =0
Clone on the heap.
Rivet::Projection::mkPCmp
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:57
Rivet::Cmp
Definition: Cmp.fhh:10
Rivet::Projection::mkNamedPCmp
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:51
Rivet::Projection
Base class for all Rivet projections.
Definition: Projection.hh:28
Rivet::Projection::~Projection
virtual ~Projection()
The destructor.
Definition: Projection.cc:18
Rivet::Projection::getLog
Log & getLog() const
Get a Log object based on the getName() property of the calling projection object.
Definition: Projection.hh:114