Rivet is hosted by Hepforge, IPPP Durham

#include <Event.hh>

Collaboration diagram for Event:

List of all members.

Public Member Functions

Constructors and destructors.
 Event (const GenEvent *ge)
 Constructor from a HepMC GenEvent pointer.
 Event (const GenEvent &ge)
 Event (const Event &e)
 Copy constructor.
Major event properties
ParticlePair beams () const
 Get the beam particles.
double sqrtS () const
 Get the beam centre-of-mass energy.
double asqrtS () const
 Get the beam centre-of-mass energy per nucleon.
const GenEvent * genEvent () const
 The generated event obtained from an external event generator.
const ParticlesallParticles () const
 All the raw GenEvent particles, wrapped in Rivet::Particle objects.
Particles allParticles (const Cut &c) const
 All the raw GenEvent particles, wrapped in Rivet::Particle objects, but with a Cut applied.
template<typename FN >
Particles allParticles (const FN &f) const
 All the raw GenEvent particles, wrapped in Rivet::Particle objects, but with a selection function applied.
double weight () const
 The generation weight associated with the event.
Projection running
template<typename PROJ >
const PROJ & applyProjection (PROJ &p) const
 Add a projection p to this Event.
template<typename PROJ >
const PROJ & applyProjection (PROJ *pp) const
 Add a projection p to this Event by pointer.

Private Member Functions

void _init (const GenEvent &ge)
 Actual (shared) implementation of the constructors from GenEvents.

Private Attributes

const GenEvent * _genevent_original
 The generated event, as obtained from an external generator.
GenEvent _genevent
 The GenEvent used by Rivet analysis projections etc.
Particles _particles
std::set< ConstProjectionPtr_projections
 The set of Projection objects applied so far.

Detailed Description

Rivet wrapper for HepMC event and Projection references.

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 Projection objects which have been applied to the Event so far.

Definition at line 22 of file Event.hh.


Constructor & Destructor Documentation

Event ( const GenEvent *  ge) [inline]

Constructor from a HepMC GenEvent pointer.

Definition at line 29 of file Event.hh.

References Event::_init().

      : _genevent_original(ge), _genevent(*ge)
    { assert(ge); _init(*ge); }
Event ( const GenEvent &  ge) [inline]

Constructor from a HepMC GenEvent reference

Deprecated:
HepMC uses pointers, so we should talk to HepMC via pointers

Definition at line 35 of file Event.hh.

References Event::_init().

      : _genevent_original(&ge), _genevent(ge)
    { _init(ge); }
Event ( const Event e) [inline]

Copy constructor.

Definition at line 40 of file Event.hh.

      : _genevent_original(e._genevent_original), _genevent(e._genevent)
    {  }

Member Function Documentation

void _init ( const GenEvent &  ge) [private]

Actual (shared) implementation of the constructors from GenEvents.

Todo:
Filter the event to remove generator-specific particles: optional behaviour? Maybe disableable in an inconvenient way, e.g. with an env var, to communicate the appropriate distaste for this sort of truth analysis ;-)
Todo:
Enable this when HepMC has been fixed to allow printing to a stream like the Rivet logger.

Definition at line 24 of file Event.cc.

References Event::_genevent.

Referenced by Event::Event().

                                      {
    // Use Rivet's preferred units if possible
    #ifdef HEPMC_HAS_UNITS
    _genevent.use_units(HepMC::Units::GEV, HepMC::Units::MM);
    #endif

    // Use the conventional alignment
    // _geNormAlignment();

    /// @todo Filter the event to remove generator-specific particles: optional
    /// behaviour? Maybe disableable in an inconvenient way, e.g. with an env
    /// var, to communicate the appropriate distaste for this sort of truth
    /// analysis ;-)

    // Debug printout to check that copying/mangling has worked
    /// @todo Enable this when HepMC has been fixed to allow printing to a stream like the Rivet logger.
    //_genevent.print();
  }
const Particles & allParticles ( ) const

All the raw GenEvent particles, wrapped in Rivet::Particle objects.

Definition at line 99 of file Event.cc.

References Event::_particles, Event::genEvent(), and Rivet::particles().

Referenced by Event::allParticles(), and PartonicTops::project().

                                             {
    if (_particles.empty()) { //< assume that empty means no attempt yet made
      for (const GenParticle* gp : particles(genEvent())) {
        _particles += Particle(gp);
      }
    }
    return _particles;
  }
Particles allParticles ( const Cut c) const [inline]

All the raw GenEvent particles, wrapped in Rivet::Particle objects, but with a Cut applied.

Note:
Due to the cut, this returns by value, i.e. involves an expensive copy

Definition at line 74 of file Event.hh.

References Event::allParticles(), and Rivet::filter_select().

                                                      {
      return filter_select(allParticles(), c);
    }
Particles allParticles ( const FN &  f) const [inline]

All the raw GenEvent particles, wrapped in Rivet::Particle objects, but with a selection function applied.

Note:
Due to the cut, this returns by value, i.e. involves an expensive copy

Definition at line 82 of file Event.hh.

References Event::allParticles(), and Rivet::filter_select().

                                                     {
      return filter_select(allParticles(), f);
    }
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 106 of file Event.hh.

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

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

                                               {
      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;
    }
const PROJ& applyProjection ( PROJ *  pp) const [inline]

Add a projection p to this Event by pointer.

Definition at line 123 of file Event.hh.

References Event::applyProjection().

                                                {
      if (!pp) throw Error("Event::applyProjection(PROJ*): Projection pointer is null.");
      return applyProjection(*pp);
    }
double asqrtS ( ) const

Get the beam centre-of-mass energy per nucleon.

Definition at line 16 of file Event.cc.

References Event::beams().

{ return Rivet::asqrtS(beams()); }
ParticlePair beams ( ) const

Get the beam particles.

Definition at line 10 of file Event.cc.

Referenced by Event::asqrtS(), and Event::sqrtS().

{ return Rivet::beams(*this); }
double sqrtS ( ) const

Get the beam centre-of-mass energy.

Definition at line 14 of file Event.cc.

References Event::beams().

{ return Rivet::sqrtS(beams()); }
double weight ( ) const

The generation weight associated with the event.

Todo:
This needs to be revisited when we finally add the mechanism to support NLO counter-events and weight vectors.

Definition at line 109 of file Event.cc.

References Event::_genevent.

Referenced by ARGUS_1993_S2653028::analyze(), BELLE_2013_I1216515::analyze(), BABAR_2003_I593379::analyze(), CLEO_2004_S5809304::analyze(), MC_JetSplittings::analyze(), MC_JetAnalysis::analyze(), BELLE_2001_S4598261::analyze(), OPAL_1993_S2692198::analyze(), BABAR_2007_S6895344::analyze(), BABAR_2005_S6181155::analyze(), BABAR_2013_I1238276::analyze(), CDF_2008_S8093652::analyze(), DELPHI_2011_I890503::analyze(), D0_2007_S7075677::analyze(), D0_2010_S8671338::analyze(), MC_XS::analyze(), ATLAS_2011_S9035664::analyze(), MC_WJETS::analyze(), ATLAS_2011_I930220::analyze(), BELLE_2011_I878990::analyze(), BABAR_2013_I1116411::analyze(), BABAR_2015_I1334693::analyze(), D0_2010_S8566488::analyze(), PDG_TAUS::analyze(), ATLAS_2013_I1216670::analyze(), BELLE_2013_I1238273::analyze(), D0_2008_S7863608::analyze(), D0_2009_S8320160::analyze(), ATLAS_2011_S9131140::analyze(), MC_WINC::analyze(), D0_2009_S8202443::analyze(), BELLE_2015_I1397632::analyze(), MC_ZZJETS::analyze(), ARGUS_1993_S2789213::analyze(), MC_WWJETS::analyze(), CMS_2012_I941555::analyze(), JADE_OPAL_2000_S4300807::analyze(), MC_WWINC::analyze(), ATLAS_2014_I1306294::analyze(), ATLAS_2014_I1307243::analyze(), ATLAS_2013_I1217867::analyze(), ALEPH_2004_S5765862::analyze(), AnalysisHandler::analyze(), and ATLAS_2012_I1203852::analyze().

                             {
    return (!_genevent.weights().empty()) ? _genevent.weights()[0] : 1.0;
  }

Member Data Documentation

GenEvent _genevent [mutable, private]

The GenEvent used by Rivet analysis projections etc.

This version may be rotated to a "normal" alignment, have generator-specific particles stripped out, etc. If an analysis is affected by these modifications, it is probably an unphysical analysis!

Stored as a non-pointer since it may get overwritten, and memory for copying and cleanup is neater this way.

Todo:
Change needed for HepMC3?

Definition at line 160 of file Event.hh.

Referenced by Event::_init(), Event::genEvent(), and Event::weight().

const GenEvent* _genevent_original [private]

The generated event, as obtained from an external generator.

This is the original GenEvent. In practise the version seen by users will often/always be a modified one.

Todo:
Provide access to this via an Event::originalGenEvent() method? If requested...

Definition at line 149 of file Event.hh.

Particles _particles [mutable, private]

All the GenEvent particles, wrapped as Rivet::Particles

Note:
To be populated lazily, hence mutability

Definition at line 164 of file Event.hh.

Referenced by Event::allParticles().

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

The set of Projection objects applied so far.

Definition at line 167 of file Event.hh.

Referenced by Event::applyProjection().


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