StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
HepMC::GenEvent Class Reference

The GenEvent class is the core of HepMC. More...

#include <GenEvent.h>

Classes

class  particle_const_iterator
 const particle iterator More...
 
class  particle_iterator
 non-const particle iterator More...
 
class  vertex_const_iterator
 const vertex iterator More...
 
class  vertex_iterator
 non-const vertex iterator More...
 

Public Member Functions

 GenEvent (int signal_process_id=0, int event_number=0, GenVertex *signal_vertex=0, const WeightContainer &weights=std::vector< double >(), const std::vector< long > &randomstates=std::vector< long >(), Units::MomentumUnit=Units::default_momentum_unit(), Units::LengthUnit=Units::default_length_unit())
 default constructor creates null pointers to HeavyIon, PdfInfo, and GenCrossSection More...
 
 GenEvent (int signal_process_id, int event_number, GenVertex *signal_vertex, const WeightContainer &weights, const std::vector< long > &randomstates, const HeavyIon &ion, const PdfInfo &pdf, Units::MomentumUnit=Units::default_momentum_unit(), Units::LengthUnit=Units::default_length_unit())
 explicit constructor that takes HeavyIon and PdfInfo More...
 
 GenEvent (Units::MomentumUnit, Units::LengthUnit, int signal_process_id=0, int event_number=0, GenVertex *signal_vertex=0, const WeightContainer &weights=std::vector< double >(), const std::vector< long > &randomstates=std::vector< long >())
 constructor requiring units - all else is default More...
 
 GenEvent (Units::MomentumUnit, Units::LengthUnit, int signal_process_id, int event_number, GenVertex *signal_vertex, const WeightContainer &weights, const std::vector< long > &randomstates, const HeavyIon &ion, const PdfInfo &pdf)
 explicit constructor with units first that takes HeavyIon and PdfInfo More...
 
 GenEvent (const GenEvent &inevent)
 deep copy More...
 
GenEventoperator= (const GenEvent &inevent)
 make a deep copy More...
 
virtual ~GenEvent ()
 deletes all vertices/particles in this evt More...
 
void swap (GenEvent &other)
 swap
 
void print (std::ostream &ostr=std::cout) const
 dumps to ostr More...
 
void print_version (std::ostream &ostr=std::cout) const
 dumps release version to ostr
 
GenParticlebarcode_to_particle (int barCode) const
 assign a barcode to a particle More...
 
GenVertexbarcode_to_vertex (int barCode) const
 assign a barcode to a vertex More...
 
int signal_process_id () const
 unique signal process id More...
 
int event_number () const
 event number
 
int mpi () const
 number of multi parton interactions More...
 
double event_scale () const
 energy scale, see hep-ph/0109068
 
double alphaQCD () const
 QCD coupling, see hep-ph/0109068.
 
double alphaQED () const
 
GenVertexsignal_process_vertex () const
 pointer to the vertex containing the signal process More...
 
bool valid_beam_particles () const
 test to see if we have two valid beam particles
 
std::pair< HepMC::GenParticle
*, HepMC::GenParticle * > 
beam_particles () const
 pair of pointers to the two incoming beam particles
 
bool is_valid () const
 
WeightContainerweights ()
 direct access to WeightContainer More...
 
const WeightContainerweights () const
 direct access to WeightContainer
 
GenCrossSection const * cross_section () const
 access the GenCrossSection container if it exists
 
GenCrossSectioncross_section ()
 
HeavyIon const * heavy_ion () const
 access the HeavyIon container if it exists
 
HeavyIonheavy_ion ()
 
PdfInfo const * pdf_info () const
 access the PdfInfo container if it exists
 
PdfInfopdf_info ()
 
const std::vector< long > & random_states () const
 vector of integers containing information about the random state More...
 
int particles_size () const
 how many particle barcodes exist?
 
bool particles_empty () const
 return true if there are no particle barcodes
 
int vertices_size () const
 how many vertex barcodes exist?
 
bool vertices_empty () const
 return true if there are no vertex barcodes
 
void write_units (std::ostream &os=std::cout) const
 
void write_cross_section (std::ostream &ostr=std::cout) const
 
Units::MomentumUnit momentum_unit () const
 Units used by the GenParticle momentum FourVector.
 
Units::LengthUnit length_unit () const
 Units used by the GenVertex position FourVector.
 
std::ostream & write (std::ostream &)
 
std::istream & read (std::istream &)
 
bool add_vertex (GenVertex *vtx)
 adds to evt and adopts More...
 
bool remove_vertex (GenVertex *vtx)
 erases vtx from evt More...
 
void clear ()
 empties the entire event More...
 
void set_signal_process_id (int id)
 set unique signal process id
 
void set_event_number (int eventno)
 set event number
 
void set_mpi (int)
 set number of multi parton interactions More...
 
void set_event_scale (double scale)
 set energy scale
 
void set_alphaQCD (double a)
 set QCD coupling
 
void set_alphaQED (double a)
 set QED coupling
 
void set_signal_process_vertex (GenVertex *)
 set pointer to the vertex containing the signal process
 
bool set_beam_particles (GenParticle *, GenParticle *)
 set incoming beam particles More...
 
bool set_beam_particles (std::pair< HepMC::GenParticle *, HepMC::GenParticle * > const &)
 use a pair of GenParticle*'s to set incoming beam particles More...
 
void set_random_states (const std::vector< long > &randomstates)
 provide random state information
 
void set_cross_section (const GenCrossSection &)
 provide a pointer to the GenCrossSection container
 
void set_heavy_ion (const HeavyIon &ion)
 provide a pointer to the HeavyIon container
 
void set_pdf_info (const PdfInfo &p)
 provide a pointer to the PdfInfo container
 
void use_units (Units::MomentumUnit, Units::LengthUnit)
 
void use_units (std::string &, std::string &)
 
void define_units (Units::MomentumUnit, Units::LengthUnit)
 
void define_units (std::string &, std::string &)
 
GenEventVertexRange vertex_range ()
 vertex range
 
ConstGenEventVertexRange vertex_range () const
 vertex range
 
GenEventParticleRange particle_range ()
 particle range
 
ConstGenEventParticleRange particle_range () const
 particle range
 
vertex_const_iterator vertices_begin () const
 begin vertex iteration
 
vertex_const_iterator vertices_end () const
 end vertex iteration
 
vertex_iterator vertices_begin ()
 begin vertex iteration
 
vertex_iterator vertices_end ()
 end vertex iteration
 
particle_const_iterator particles_begin () const
 begin particle iteration
 
particle_const_iterator particles_end () const
 end particle iteration
 
particle_iterator particles_begin ()
 begin particle iteration
 
particle_iterator particles_end ()
 end particle iteration
 

Protected Member Functions

bool set_barcode (GenParticle *p, int suggested_barcode=false)
 set the barcode - intended for use by GenParticle
 
bool set_barcode (GenVertex *v, int suggested_barcode=false)
 set the barcode - intended for use by GenVertex
 
void remove_barcode (GenParticle *p)
 intended for use by GenParticle
 
void remove_barcode (GenVertex *v)
 intended for use by GenVertex
 
void delete_all_vertices ()
 delete all vertices owned by this event More...
 

Friends

class GenParticle
 
class GenVertex
 
class vertex_const_iterator
 
class vertex_iterator
 
class particle_const_iterator
 
class particle_iterator
 

Detailed Description

The GenEvent class is the core of HepMC.

HepMC::GenEvent contains information about generated particles. GenEvent is structured as a set of vertices which contain the particles.

Definition at line 155 of file GenEvent.h.

Constructor & Destructor Documentation

HepMC::GenEvent::GenEvent ( int  signal_process_id = 0,
int  event_number = 0,
GenVertex signal_vertex = 0,
const WeightContainer weights = std::vector<double>(),
const std::vector< long > &  randomstates = std::vector<long>(),
Units::MomentumUnit  mom = Units::default_momentum_unit(),
Units::LengthUnit  len = Units::default_length_unit() 
)

default constructor creates null pointers to HeavyIon, PdfInfo, and GenCrossSection

This constructor only allows null pointers to HeavyIon and PdfInfo

note: default values for m_event_scale, m_alphaQCD, m_alphaQED are as suggested in hep-ph/0109068, "Generic Interface..."

Definition at line 22 of file GenEvent.cc.

HepMC::GenEvent::GenEvent ( int  signal_process_id,
int  event_number,
GenVertex signal_vertex,
const WeightContainer weights,
const std::vector< long > &  randomstates,
const HeavyIon ion,
const PdfInfo pdf,
Units::MomentumUnit  mom = Units::default_momentum_unit(),
Units::LengthUnit  len = Units::default_length_unit() 
)

explicit constructor that takes HeavyIon and PdfInfo

GenEvent makes its own copy of HeavyIon and PdfInfo

note: default values for m_event_scale, m_alphaQCD, m_alphaQED are as suggested in hep-ph/0109068, "Generic Interface..."

Definition at line 55 of file GenEvent.cc.

HepMC::GenEvent::GenEvent ( Units::MomentumUnit  mom,
Units::LengthUnit  len,
int  signal_process_id = 0,
int  event_number = 0,
GenVertex signal_vertex = 0,
const WeightContainer weights = std::vector<double>(),
const std::vector< long > &  randomstates = std::vector<long>() 
)

constructor requiring units - all else is default

constructor requiring units - all else is default This constructor only allows null pointers to HeavyIon and PdfInfo

note: default values for m_event_scale, m_alphaQCD, m_alphaQED are as suggested in hep-ph/0109068, "Generic Interface..."

Definition at line 88 of file GenEvent.cc.

HepMC::GenEvent::GenEvent ( Units::MomentumUnit  mom,
Units::LengthUnit  len,
int  signal_process_id,
int  event_number,
GenVertex signal_vertex,
const WeightContainer weights,
const std::vector< long > &  randomstates,
const HeavyIon ion,
const PdfInfo pdf 
)

explicit constructor with units first that takes HeavyIon and PdfInfo

explicit constructor with units first that takes HeavyIon and PdfInfo GenEvent makes its own copy of HeavyIon and PdfInfo

note: default values for m_event_scale, m_alphaQCD, m_alphaQED are as suggested in hep-ph/0109068, "Generic Interface..."

Definition at line 122 of file GenEvent.cc.

HepMC::GenEvent::GenEvent ( const GenEvent inevent)
HepMC::GenEvent::~GenEvent ( )
virtual

deletes all vertices/particles in this evt

Deep destructor. deletes all vertices/particles in this GenEvent deletes the associated HeavyIon and PdfInfo

Definition at line 258 of file GenEvent.cc.

References delete_all_vertices().

Member Function Documentation

bool HepMC::GenEvent::add_vertex ( GenVertex vtx)
double HepMC::GenEvent::alphaQED ( ) const
inline

QED coupling, see hep-ph/0109068

Definition at line 692 of file GenEvent.h.

Referenced by print(), write(), and HepMC::IO_AsciiParticles::write_event().

GenParticle * HepMC::GenEvent::barcode_to_particle ( int  barCode) const
inline

assign a barcode to a particle

Each vertex or particle has a barcode, which is just an integer which uniquely identifies it inside the event (i.e. there is a one to one mapping between particle memory addresses and particle barcodes... and the same applied for vertices).

The value of a barcode has NO MEANING and NO ORDER! For the user's convenience, when an event is read in via an IO_method from an indexed list (like the HEPEVT common block), then the index will become the barcode for that particle.

Particle barcodes are always positive integers. The barcodes are chosen and set automatically when a vertex or particle comes under the ownership of an event (i.e. it is contained in an event).

Please note that the barcodes are intended for internal use within HepMC as a unique identifier for the particles and vertices. Using the barcode to encode extra information is an abuse of the barcode data member and causes confusion among users.

Definition at line 798 of file GenEvent.h.

Referenced by StarEvtGenDecayer::ImportParticles().

GenVertex * HepMC::GenEvent::barcode_to_vertex ( int  barCode) const
inline

assign a barcode to a vertex

Each vertex or particle has a barcode, which is just an integer which uniquely identifies it inside the event (i.e. there is a one to one mapping between particle memory addresses and particle barcodes... and the same applied for vertices).

The value of a barcode has NO MEANING and NO ORDER! For the user's convenience, when an event is read in via an IO_method from an indexed list (like the HEPEVT common block), then the index will become the barcode for that particle.

Vertex barcodes are always negative integers. The barcodes are chosen and set automatically when a vertex or particle comes under the ownership of an event (i.e. it is contained in an event).

Please note that the barcodes are intended for internal use within HepMC as a unique identifier for the particles and vertices. Using the barcode to encode extra information is an abuse of the barcode data member and causes confusion among users.

Definition at line 823 of file GenEvent.h.

Referenced by read().

void HepMC::GenEvent::clear ( void  )

empties the entire event

remove all information from the event deletes all vertices/particles in this evt

Definition at line 365 of file GenEvent.cc.

References delete_all_vertices().

Referenced by HepMC::IO_GenEvent::fill_next_event(), and read().

void HepMC::GenEvent::define_units ( Units::MomentumUnit  new_m,
Units::LengthUnit  new_l 
)
inline

set the units using enums This method will NOT convert momentum and position data

Definition at line 866 of file GenEvent.h.

void HepMC::GenEvent::define_units ( std::string &  new_m,
std::string &  new_l 
)

set the units using strings the string must match the enum exactly This method will NOT convert momentum and position data

Definition at line 665 of file GenEvent.cc.

void HepMC::GenEvent::delete_all_vertices ( )
protected

delete all vertices owned by this event

deletes all vertices in the vertex container (i.e. all vertices owned by this event) The vertices are the "owners" of the particles, so as we delete the vertices, the vertex desctructors are automatically deleting their particles.

Definition at line 403 of file GenEvent.cc.

References particles_empty(), and vertices_empty().

Referenced by clear(), and ~GenEvent().

bool HepMC::GenEvent::is_valid ( ) const

check GenEvent for validity A GenEvent is presumed valid if it has particles and/or vertices.

A GenEvent is presumed valid if it has both associated particles and vertices. No other information is checked.

Definition at line 677 of file GenEvent.cc.

References particles_empty(), and vertices_empty().

Referenced by HepMC::IO_GenEvent::fill_next_event().

int HepMC::GenEvent::mpi ( ) const
inline

number of multi parton interactions

Returns the number of multi parton interactions in the event. This number is -1 if it is not set.

Definition at line 686 of file GenEvent.h.

Referenced by write().

GenEvent & HepMC::GenEvent::operator= ( const GenEvent inevent)

make a deep copy

best practices implementation

Definition at line 269 of file GenEvent.cc.

References swap().

void HepMC::GenEvent::print ( std::ostream &  ostr = std::cout) const

dumps to ostr

dumps the content of this event to ostr to dump to cout use: event.print(); if you want to write this event to file outfile.txt you could use: std::ofstream outfile("outfile.txt"); event.print( outfile );

Definition at line 277 of file GenEvent.cc.

References alphaQCD(), alphaQED(), HepMC::GenVertex::barcode(), beam_particles(), event_number(), event_scale(), particles_size(), HepMC::WeightContainer::print(), signal_process_id(), signal_process_vertex(), HepMC::WeightContainer::size(), vertices_begin(), vertices_end(), vertices_size(), weights(), write_cross_section(), and write_units().

Referenced by StarEvtGenDecayer::ImportParticles(), and Photospp::PhotosHepMCEvent::print().

const std::vector< long > & HepMC::GenEvent::random_states ( ) const
inline

vector of integers containing information about the random state

Vector of integers which specify the random number generator's state for this event. It is left to the generator to make use of this. We envision a vector of RndmStatesTags to be included with a run class which would specify the meaning of the random_states.

Definition at line 727 of file GenEvent.h.

Referenced by GenEvent(), and HepMC::IO_AsciiParticles::write_event().

std::istream & HepMC::GenEvent::read ( std::istream &  is)
bool HepMC::GenEvent::remove_vertex ( GenVertex vtx)

erases vtx from evt

this removes vtx from the event but does NOT delete it. returns True if an entry vtx existed in the table and was erased

Definition at line 357 of file GenEvent.cc.

References HepMC::GenVertex::barcode(), HepMC::GenVertex::parent_event(), and HepMC::GenVertex::set_parent_event_().

Referenced by add_vertex().

bool HepMC::GenEvent::set_beam_particles ( GenParticle bp1,
GenParticle bp2 
)

set incoming beam particles

construct the beam particle information using pointers to GenParticle returns false if either GenParticle* is null

Definition at line 586 of file GenEvent.cc.

Referenced by HepMC::IO_HEPEVT::fill_next_event(), HepMC::IO_HERWIG::fill_next_event(), GenEvent(), read(), and set_beam_particles().

bool HepMC::GenEvent::set_beam_particles ( std::pair< HepMC::GenParticle *, HepMC::GenParticle * > const &  bp)

use a pair of GenParticle*'s to set incoming beam particles

construct the beam particle information using a std::pair of pointers to GenParticle returns false if either GenParticle* is null

Definition at line 595 of file GenEvent.cc.

References set_beam_particles().

void HepMC::GenEvent::set_mpi ( int  nmpi)
inline

set number of multi parton interactions

Use this to set the number of multi parton interactions in each event.

Definition at line 737 of file GenEvent.h.

int HepMC::GenEvent::signal_process_id ( ) const
inline

unique signal process id

The integer ID that uniquely specifies this signal process, i.e. MSUB in Pythia. It is necessary to package this with each event rather than with the run because many processes may be generated within one run.

Definition at line 679 of file GenEvent.h.

Referenced by print(), write(), and HepMC::IO_AsciiParticles::write_event().

GenVertex * HepMC::GenEvent::signal_process_vertex ( ) const
inline

pointer to the vertex containing the signal process

returns a (mutable) pointer to the signal process vertex

Definition at line 694 of file GenEvent.h.

Referenced by GenEvent(), print(), read(), write(), and HepMC::IO_AsciiParticles::write_event().

void HepMC::GenEvent::use_units ( Units::MomentumUnit  new_m,
Units::LengthUnit  new_l 
)
inline

set the units using enums This method will convert momentum and position data if necessary

Definition at line 856 of file GenEvent.h.

Referenced by read(), and Tauolapp::TauolaHepMCEvent::TauolaHepMCEvent().

void HepMC::GenEvent::use_units ( std::string &  new_m,
std::string &  new_l 
)
inline

set the units using strings the string must match the enum exactly This method will convert momentum and position data if necessary

Definition at line 861 of file GenEvent.h.

WeightContainer & HepMC::GenEvent::weights ( )
inline

direct access to WeightContainer

direct access to the weights container is allowed. Thus you can use myevt.weights()[2]; to access element 2 of the weights. or use myevt.weights().push_back( mywgt ); to add an element. and you can set the weights with myevt.weights() = myvector;

Definition at line 699 of file GenEvent.h.

Referenced by GenEvent(), print(), write(), and HepMC::IO_AsciiParticles::write_event().

std::ostream & HepMC::GenEvent::write ( std::ostream &  os)
void HepMC::GenEvent::write_cross_section ( std::ostream &  ostr = std::cout) const

If the cross section is defined, write the cross section information to an output stream. If the output stream is not defined, use std::cout.

Definition at line 605 of file GenEvent.cc.

References HepMC::GenCrossSection::cross_section(), cross_section(), and HepMC::GenCrossSection::cross_section_error().

Referenced by print().

void HepMC::GenEvent::write_units ( std::ostream &  os = std::cout) const

Write the unit information to an output stream. If the output stream is not defined, use std::cout.

Definition at line 599 of file GenEvent.cc.

References length_unit(), and momentum_unit().

Referenced by print().


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