Event Class Reference

#include <Event.hh>

Collaboration diagram for Event:

Collaboration graph
[legend]

List of all members.


Detailed Description

Event is a concrete class representing an generated event in Rivet. It is constructed given a HepMC::GenEvent, a pointer to which is kept by the Event object throughout its lifetime. The user must therefore make sure that the corresponding HepMC::GenEvent will persist at least as long as the Event object.

In addition to the HepMC::GenEvent object the Event also keeps track of all Projections object which have been applied to the Event so far.

Definition at line 20 of file Event.hh.


Public Member Functions

const GenEvent & genEvent () const
 Return the generated event obtained from an external event generator.
double weight () const
 The weight associated with the event.
template<typename PROJ>
const PROJ & applyProjection (PROJ &p) const
template<typename PROJ>
const PROJ & applyProjection (PROJ *pp) const
Standard constructors and destructors.
 Event (const GenEvent &ge)
 The default constructor.
 Event (const Event &e)
 The copy constructor.
Eventoperator= (const Event &e)
 Copy assignment operator.

Private Attributes

GenEvent _genEvent
 The generated event, obtained from an external generator. Note that it is only externally accessible via a const reference.
std::set< ConstProjectionPtr_projections
 The set of Projection objects applied so far.
double _weight
 The generation weight associated with the event. Usually 1.0. Only copied from the HepMC event once, at construction time.

Constructor & Destructor Documentation

Event ( const GenEvent &  ge  ) 

The default constructor.

Definition at line 74 of file Event.cc.

References Event::_genEvent, Rivet::_geNormAlignment(), Rivet::_geNormUnits(), and Event::_weight.

00075     : _genEvent(ge), _weight(1.0)
00076   {
00077     // Set the weight if there is one, otherwise default to 1.0
00078     if (!_genEvent.weights().empty()) {
00079       _weight = ge.weights()[0];
00080     }
00081 
00082     // Use Rivet's preferred units if possible
00083     _geNormUnits(_genEvent);
00084  
00085     // Use the conventional alignment
00086     _geNormAlignment(_genEvent);
00087 
00088     // Debug printout to check that copying/magling has worked
00089     //_genEvent.print();
00090   }

Event ( const Event e  ) 

The copy constructor.

Definition at line 93 of file Event.cc.

00094     : _genEvent(e._genEvent),
00095       _weight(e._weight)
00096   {
00097     //
00098   }


Member Function Documentation

Event & operator= ( const Event e  ) 

Copy assignment operator.

Definition at line 101 of file Event.cc.

References Event::_genEvent, and Event::_weight.

00101                                         {
00102     _genEvent = e._genEvent;
00103     _weight = e._weight;
00104     return *this;
00105   }

const GenEvent& genEvent (  )  const [inline]

Return the generated event obtained from an external event generator.

Definition at line 42 of file Event.hh.

References Event::_genEvent.

Referenced by UnstableFinalState::project(), PVertex::project(), InitialQuarks::project(), FinalState::project(), and Beam::project().

00042                                      {
00043       return _genEvent;
00044     }

double weight (  )  const [inline]

const PROJ& applyProjection ( PROJ &  p  )  const [inline]

Add a projection p to this Event. If an equivalent Projection has been applied before, the Projection::project(const Event &) of p is not called and a reference to the previous equivalent projection is returned. If no previous Projection was found, the Projection::project(const Event &) of p is called and a reference to p is returned.

Definition at line 61 of file Event.hh.

References Event::_projections, and Projection::project().

Referenced by ProjectionApplier::_applyProjection(), and Event::applyProjection().

00061                                                {
00062       const Projection* cpp(&p);
00063       std::set<const Projection*>::const_iterator old = _projections.find(cpp);
00064       if (old != _projections.end()) {
00065         const Projection& pRef = **old;
00066         return pcast<PROJ>(pRef);
00067       }
00068       // Add the projection via the Projection base class (only
00069       // possible because Event is a friend of Projection)
00070       Projection* pp = const_cast<Projection*>(cpp);
00071       pp->project(*this);
00072       _projections.insert(pp);
00073       return p;
00074     }

const PROJ& applyProjection ( PROJ *  pp  )  const [inline]

Definition at line 78 of file Event.hh.

References Event::applyProjection().

00078                                                 {
00079       if (!pp) throw Error("Event::applyProjection(PROJ*): Projection pointer is null.");
00080       return applyProjection(*pp);
00081     }


Member Data Documentation

GenEvent _genEvent [private]

The generated event, obtained from an external generator. Note that it is only externally accessible via a const reference.

Definition at line 88 of file Event.hh.

Referenced by Event::Event(), Event::genEvent(), and Event::operator=().

std::set<ConstProjectionPtr> _projections [mutable, private]

The set of Projection objects applied so far.

Definition at line 91 of file Event.hh.

Referenced by Event::applyProjection().

double _weight [private]

The generation weight associated with the event. Usually 1.0. Only copied from the HepMC event once, at construction time.

Definition at line 95 of file Event.hh.

Referenced by Event::Event(), Event::operator=(), and Event::weight().


The documentation for this class was generated from the following files: