Event.hh
// -*- C++ -*-
#ifndef RIVET_Event_HH
#define RIVET_Event_HH
#include "Rivet/Rivet.hh"
#include "Rivet/Projection.hh"
namespace Rivet {
class Event {
public:
Event(const GenEvent& ge);
Event(const Event& e);
~Event();
public:
const GenEvent& genEvent() const;
double weight() const {
return _weight;
}
public:
template <typename PROJ>
const PROJ& applyProjection(PROJ& p) const {
const Projection* cpp(&p);
std::set<const Projection*>::const_iterator old = _projections.find(cpp);
if (old != _projections.end()) {
const Projection& pRef = **old;
return pcast<PROJ>(pRef);
}
// Add the projection via the Projection base class (only
// possible because Event is a friend of Projection)
Projection* pp = const_cast<Projection*>(cpp);
pp->project(*this);
_projections.insert(pp);
return p;
}
template <typename PROJ>
const PROJ& applyProjection(PROJ* pp) const {
if (!pp) throw Error("Event::applyProjection(PROJ*): Projection pointer is null.");
return applyProjection(*pp);
}
private:
void _geNormAlignment();
GenEvent const& _genEvent;
GenEvent* _modGenEvent;
mutable std::set<ConstProjectionPtr> _projections;
double _weight;
};
}
#endif
Rivet
Definition: MC_JetAnalysis.hh:9
Rivet::Event::~Event
~Event()
The destructor.
Definition: Event.cc:99
Rivet::Event::Event
Event(const GenEvent &ge)
The default constructor.
Definition: Event.cc:66
Rivet::Projection::project
virtual void project(const Event &e)=0
Rivet::Event
Definition: Event.hh:22
Rivet::Event::applyProjection
const PROJ & applyProjection(PROJ &p) const
Definition: Event.hh:60
Rivet::Event::weight
double weight() const
The weight associated with the event.
Definition: Event.hh:46
Rivet::Projection
Base class for all Rivet projections.
Definition: Projection.hh:28
Rivet::Error
Generic runtime Rivet error.
Definition: Exceptions.hh:12
Rivet::Event::genEvent
const GenEvent & genEvent() const
Return the generated event obtained from an external event generator.
Definition: Event.cc:103