HepMC3 event record library: GenEvent Class Reference

HepMC3 event record library

Public Member Functions
GenEvent Class Reference

## Detailed Description

Stores event-related information.

Manages event-related information. Contains lists of GenParticle and GenVertex objects

Examples
  HepMC2_reader_example.cc, HepMC3_fileIO_example.cc, LHEF_example_cat.cc, basic_tree.cc, class_example_write.cc, convert_example.cc, pythia8_example.cc, rootIO_example_read.cc, and rootIO_example_write.cc.

Definition at line 47 of file GenEvent.h.

`#include <GenEvent.h>`

Collaboration diagram for GenEvent:
[legend]

## Public Member Functions
| GenEvent (Units::MomentumUnit mu=Units::GEV, Units::LengthUnit lu=Units::MM)
| Event constructor without a run.
| GenEvent (std::shared_ptr< GenRunInfo > run, Units::MomentumUnit mu=Units::GEV, Units::LengthUnit lu=Units::MM)
| Constructor with associated run.
| GenEvent (const GenEvent &)
| Copy constructor.
| ~GenEvent ()
| Destructor.
GenEvent & | operator= (const GenEvent &)
| Copy Assignment operator.
Particle and vertex access
const std::vector< ConstGenParticlePtr > & | particles () const
| Get list of particles (const).
const std::vector< ConstGenVertexPtr > & | vertices () const
| Get list of vertices (const).
const std::vector< GenParticlePtr > & | particles ()
| Get/set list of particles (non-const).
const std::vector< GenVertexPtr > & | vertices ()
| Get/set list of vertices (non-const).
int | particles_size () const
| Particles size, HepMC2 compatibility.
bool | particles_empty () const
| Particles empty, HepMC2 compatibility.
int | vertices_size () const
| Vertices size, HepMC2 compatibility.
bool | vertices_empty () const
| Vertices empty, HepMC2 compatibility.
Event weights
const std::vector< double > & | weights () const
| Get event weight values as a vector.
std::vector< double > & | weights ()
| Get event weights as a vector (non-const).
double | weight (const unsigned long &index=0) const
double | weight (const std::string &name) const
double & | weight (const std::string &name)
const std::vector< std::string > & | weight_names () const
Auxiliary info and event metadata
std::shared_ptr< GenRunInfo > | run_info () const
| Get a pointer to the the GenRunInfo object.
void | set_run_info (std::shared_ptr< GenRunInfo > run)
| Set the GenRunInfo object by smart pointer.
int | event_number () const
| Get event number.
void | set_event_number (const int &num)
| Set event number.
const Units::MomentumUnit & | momentum_unit () const
| Get momentum unit.
const Units::LengthUnit & | length_unit () const
| Get length unit.
void | set_units (Units::MomentumUnit new_momentum_unit, Units::LengthUnit new_length_unit)
| Change event units Converts event from current units to new ones.
GenHeavyIonPtr | heavy_ion ()
| Get heavy ion generator additional information.
ConstGenHeavyIonPtr | heavy_ion () const
| Get heavy ion generator additional information (const version).
void | set_heavy_ion (GenHeavyIonPtr hi)
| Set heavy ion generator additional information.
GenPdfInfoPtr | pdf_info ()
| Get PDF information.
ConstGenPdfInfoPtr | pdf_info () const
| Get PDF information (const version).
void | set_pdf_info (GenPdfInfoPtr pi)
| Set PDF information.
GenCrossSectionPtr | cross_section ()
| Get cross-section information.
ConstGenCrossSectionPtr | cross_section () const
| Get cross-section information (const version).
void | set_cross_section (GenCrossSectionPtr cs)
| Set cross-section information.
Event position
const FourVector & | event_pos () const
| Vertex representing the overall event position.
std::vector< ConstGenParticlePtr > | beams () const
| Vector of beam particles.
std::vector< ConstGenParticlePtr > | beams (const int status) const
| Vector of beam particles.
const std::vector< GenParticlePtr > & | beams ()
| Vector of beam particles.
void | shift_position_by (const FourVector &delta)
| Shift position of all vertices in the event by delta.
void | shift_position_to (const FourVector &newpos)
| Shift position of all vertices in the event to op.
bool | boost (const FourVector &delta)
| Boost event using x,y,z components of delta as velocity fractions.
bool | rotate (const FourVector &delta)
| Rotate event using x,y,z components of delta as rotation angles.
bool | reflect (const int axis)
| Change sign of axis.
Additional attributes
Add event attribute to event This will overwrite existing attribute if an attribute with the same name is present
void | add_attribute (const std::string &name, const std::shared_ptr< Attribute > &att, const int &id=0)
void | add_attributes (const std::vector< std::string > &names, const std::vector< std::shared_ptr< Attribute > > &atts, const std::vector< int > &ids)
| Add multiple attributes to event.
void | add_attributes (const std::string &name, const std::vector< std::shared_ptr< Attribute > > &atts, const std::vector< int > &ids)
| Add multiple attributes to event.
void | add_attributes (const std::string &name, const std::vector< std::pair< int, std::shared_ptr< Attribute > > > &atts)
| Add multiple attributes to event.
void | remove_attribute (const std::string &name, const int &id=0)
| Remove attribute.
template<class T>
std::shared_ptr< T > | attribute (const std::string &name, const int &id=0) const
| Get attribute of type T.
std::string | attribute_as_string (const std::string &name, const int &id=0) const
| Get attribute of any type as string.
std::vector< std::string > | attribute_names (const int &id=0) const
| Get list of attribute names.
std::map< std::string, std::map< int, std::shared_ptr< Attribute > > > | attributes () const
| Get a copy of the list of attributes.
Particle and vertex modification
void | add_particle (GenParticlePtr p)
| Add particle.
void | add_vertex (GenVertexPtr v)
| Add vertex.
void | remove_particle (GenParticlePtr p)
| Remove particle from the event.
void | remove_particles (std::vector< GenParticlePtr > v)
| Remove a set of particles.
void | remove_vertex (GenVertexPtr v)
| Remove vertex from the event.
void | add_tree (const std::vector< GenParticlePtr > &parts)
| Add whole tree in topological order.
void | reserve (const size_t &parts, const size_t &verts=0)
| Reserve memory for particles and vertices.
void | clear ()
| Remove contents of this event.
Deprecated functionality
void | set_beam_particles (GenParticlePtr p1, GenParticlePtr p2)
| Set incoming beam particles.
void | add_beam_particle (GenParticlePtr p1)
| Add particle to root vertex.
Methods to fill GenEventData and to read it back
void | write_data (GenEventData &data) const
| Fill GenEventData object.
void | read_data (const GenEventData &data)
| Fill GenEvent based on GenEventData.

## Fields
typedef std::map< std::string, std::map< int, std::shared_ptr< Attribute > > >::value_type | att_key_t
| Attribute map key type.
typedef std::map< int, std::shared_ptr< Attribute > >::value_type | att_val_t
| Attribute map value type.
std::vector< GenParticlePtr > | m_particles
| List of particles.
std::vector< GenVertexPtr > | m_vertices
| List of vertices.
int | m_event_number = 0
| Event number.
std::vector< double > | m_weights
| Event weights.
Units::MomentumUnit | m_momentum_unit = Units::GEV
| Momentum unit.
Units::LengthUnit | m_length_unit = Units::MM
| Length unit.
GenVertexPtr | m_rootvertex
| The root vertex is stored outside the normal vertices list to block user access to it.
std::shared_ptr< GenRunInfo > | m_run_info
| Global run information.
std::map< std::string, std::map< int, std::shared_ptr< Attribute > > > | m_attributes
| Map of event, particle and vertex attributes.
std::recursive_mutex | m_lock_attributes
| Mutex lock for the m_attibutes map.

## Member Typedef Documentation

## ◆ att_key_t

typedef std::map<std::string,std::map<int,std::shared_ptr<Attribute>>>::value_type att_key_t
| private

Attribute map key type.

Definition at line 400 of file GenEvent.h.

## ◆ att_val_t

typedef std::map<int,std::shared_ptr<Attribute>>::value_type att_val_t
| private

Attribute map value type.

Definition at line 403 of file GenEvent.h.

## Constructor & Destructor Documentation

## ◆ GenEvent() [1/3]

GenEvent | ( | Units::MomentumUnit | mu = Units::GEV,
|  | Units::LengthUnit | lu = Units::MM )

Event constructor without a run.

Definition at line 22 of file GenEvent.cc.

References m_length_unit, m_momentum_unit, and m_rootvertex.

## ◆ GenEvent() [2/3]

GenEvent | ( | std::shared_ptr< GenRunInfo > | run,
|  | Units::MomentumUnit | mu = Units::GEV,
|  | Units::LengthUnit | lu = Units::MM )

Constructor with associated run.

Definition at line 28 of file GenEvent.cc.

References m_length_unit, m_momentum_unit, m_rootvertex, and m_run_info.

## ◆ GenEvent() [3/3]

GenEvent | ( | const GenEvent & | e | ) |

Copy constructor.

Definition at line 63 of file GenEvent.cc.

References GenEvent(), m_lock_attributes, m_run_info, read_data(), and write_data().

## ◆ ~GenEvent()

~GenEvent | ( |  | ) |

Destructor.

Definition at line 76 of file GenEvent.cc.

References m_attributes, m_particles, and m_vertices.

## Member Function Documentation

## ◆ add_attribute()

void add_attribute | ( | const std::string & | name,
|  | const std::shared_ptr< Attribute > & | att,
|  | const int & | id = 0 )

Disallow empty strings

Examples
  LHEF_example_cat.cc, and basic_tree.cc.

Definition at line 797 of file GenEvent.cc.

References m_attributes, m_lock_attributes, particles(), and vertices().

## ◆ add_attributes() [1/3]

void add_attributes | ( | const std::string & | name,
|  | const std::vector< std::pair< int, std::shared_ptr< Attribute > > > & | atts )

Add multiple attributes to event.

This will overwrite existing attributes if attributes with the same names are present

Disallow empty strings

Definition at line 871 of file GenEvent.cc.

References m_attributes, m_lock_attributes, m_particles, m_vertices, particles_size(), and vertices_size().

## ◆ add_attributes() [2/3]

void add_attributes | ( | const std::string & | name,
|  | const std::vector< std::shared_ptr< Attribute > > & | atts,
|  | const std::vector< int > & | ids )

Add multiple attributes to event.

This will overwrite existing attributes if attributes with the same names are present

Disallow empty strings

Definition at line 846 of file GenEvent.cc.

References m_attributes, m_lock_attributes, m_particles, m_vertices, particles_size(), and vertices_size().

## ◆ add_attributes() [3/3]

void add_attributes | ( | const std::vector< std::string > & | names,
|  | const std::vector< std::shared_ptr< Attribute > > & | atts,
|  | const std::vector< int > & | ids )

Add multiple attributes to event.

This will overwrite existing attributes if attributes with the same names are present

Disallow empty strings

Definition at line 814 of file GenEvent.cc.

References m_attributes, m_lock_attributes, m_particles, m_vertices, particles_size(), and vertices_size().

## ◆ add_beam_particle()

void add_beam_particle | ( | GenParticlePtr | p1 | ) |

Add particle to root vertex.

Definition at line 758 of file GenEvent.cc.

References add_particle(), and HEPMC3_WARNING_LEVEL.

## ◆ add_particle()

void add_particle | ( | GenParticlePtr | p | ) |

Add particle.

Definition at line 48 of file GenEvent.cc.

References m_particles, m_rootvertex, and particles().

## ◆ add_tree()

void add_tree | ( | const std::vector< GenParticlePtr > & | parts | ) |

Add whole tree in topological order.

This function will find the beam particles (particles that have no production vertices or their production vertices have no particles) and will add the whole decay tree starting from these particles.

Note
  Any particles on this list that do not belong to the tree will be ignored.

Definition at line 268 of file GenEvent.cc.

References add_attribute(), add_vertex(), attribute(), HEPMC3_DEBUG, HEPMC3_DEBUG_CODE_BLOCK, HEPMC3_WARNING_LEVEL, m_attributes, m_lock_attributes, m_particles, m_rootvertex, m_vertices, and particles().

## ◆ add_vertex()

void add_vertex | ( | GenVertexPtr | v | ) |

Add vertex.

Examples
  LHEF_example_cat.cc, and basic_tree.cc.

Definition at line 99 of file GenEvent.cc.

References add_particle(), m_vertices, and vertices().

## ◆ attribute()

template<class T>

std::shared_ptr< T > attribute | ( | const std::string & | name,
|  | const int & | id = 0 ) const

Get attribute of type T.

Examples
  HepMC3_fileIO_example.cc, LHEF_example_cat.cc, and basic_tree.cc.

Definition at line 420 of file GenEvent.h.

References m_attributes, m_lock_attributes, m_particles, m_vertices, particles(), run_info(), and vertices().

## ◆ attribute_as_string()

std::string attribute_as_string | ( | const std::string & | name,
|  | const int & | id = 0 ) const

Get attribute of any type as string.

Definition at line 776 of file GenEvent.cc.

References m_attributes, m_lock_attributes, and run_info().

## ◆ attribute_names()

std::vector< std::string > attribute_names | ( | const int & | id = 0 | ) | const

Get list of attribute names.

Definition at line 613 of file GenEvent.cc.

References m_attributes.

## ◆ attributes()

std::map< std::string, std::map< int, std::shared_ptr< Attribute > > > attributes | ( |  | ) | const
| inline

Get a copy of the list of attributes.

Note
  To avoid thread issues, this is returns a copy. Better solution may be needed.

Definition at line 270 of file GenEvent.h.

References m_attributes, and m_lock_attributes.

## ◆ beams() [1/3]

const std::vector< GenParticlePtr > & beams | ( |  | ) |

Vector of beam particles.

Definition at line 434 of file GenEvent.cc.

References m_rootvertex.

## ◆ beams() [2/3]

std::vector< ConstGenParticlePtr > beams | ( |  | ) | const

Vector of beam particles.

Examples
  basic_tree.cc.

Definition at line 429 of file GenEvent.cc.

References m_rootvertex.

## ◆ beams() [3/3]

std::vector< ConstGenParticlePtr > beams | ( | const int | status | ) | const

Vector of beam particles.

Definition at line 422 of file GenEvent.cc.

References m_rootvertex.

## ◆ boost()

bool boost | ( | const FourVector & | delta | ) |

Boost event using x,y,z components of delta as velocity fractions.

Definition at line 547 of file GenEvent.cc.

References FourVector::e(), HEPMC3_WARNING_LEVEL, FourVector::length2(), m_particles, FourVector::x(), FourVector::y(), and FourVector::z().

## ◆ clear()

void clear | ( |  | ) |

Remove contents of this event.

Definition at line 592 of file GenEvent.cc.

References m_attributes, m_event_number, m_lock_attributes, m_particles, m_rootvertex, m_vertices, and m_weights.

## ◆ cross_section() [1/2]

GenCrossSectionPtr cross_section | ( |  | ) |
| inline

Get cross-section information.

Definition at line 182 of file GenEvent.h.

References attribute().

## ◆ cross_section() [2/2]

ConstGenCrossSectionPtr cross_section | ( |  | ) | const
| inline

Get cross-section information (const version).

Definition at line 184 of file GenEvent.h.

References attribute().

## ◆ event_number()

int event_number | ( |  | ) | const
| inline

Get event number.

Examples
  LHEF_example_cat.cc.

Definition at line 155 of file GenEvent.h.

References m_event_number.

## ◆ event_pos()

const FourVector & event_pos | ( |  | ) | const

Vertex representing the overall event position.

Definition at line 418 of file GenEvent.cc.

References m_rootvertex.

## ◆ heavy_ion() [1/2]

GenHeavyIonPtr heavy_ion | ( |  | ) |
| inline

Get heavy ion generator additional information.

Definition at line 168 of file GenEvent.h.

References attribute().

## ◆ heavy_ion() [2/2]

ConstGenHeavyIonPtr heavy_ion | ( |  | ) | const
| inline

Get heavy ion generator additional information (const version).

Definition at line 170 of file GenEvent.h.

References attribute().

## ◆ length_unit()

const Units::LengthUnit & length_unit | ( |  | ) | const
| inline

Get length unit.

Definition at line 162 of file GenEvent.h.

References m_length_unit.

## ◆ momentum_unit()

const Units::MomentumUnit & momentum_unit | ( |  | ) | const
| inline

Get momentum unit.

Definition at line 160 of file GenEvent.h.

References m_momentum_unit.

## ◆ operator=()

GenEvent & operator= | ( | const GenEvent & | e | ) |

Copy Assignment operator.

Definition at line 84 of file GenEvent.cc.

References GenEvent(), m_lock_attributes, m_run_info, read_data(), and write_data().

## ◆ particles() [1/2]

const std::vector< GenParticlePtr > & particles | ( |  | ) |
| inline

Get/set list of particles (non-const).

Definition at line 80 of file GenEvent.h.

References m_particles.

## ◆ particles() [2/2]

const std::vector< ConstGenParticlePtr > & particles | ( |  | ) | const

Get list of particles (const).

Examples
  LHEF_example_cat.cc.

Definition at line 39 of file GenEvent.cc.

References m_particles.

## ◆ particles_empty()

bool particles_empty | ( |  | ) | const
| inline

Particles empty, HepMC2 compatibility.

Definition at line 93 of file GenEvent.h.

References m_particles.

## ◆ particles_size()

int particles_size | ( |  | ) | const
| inline

Particles size, HepMC2 compatibility.

Definition at line 91 of file GenEvent.h.

References m_particles.

## ◆ pdf_info() [1/2]

GenPdfInfoPtr pdf_info | ( |  | ) |
| inline

Get PDF information.

Definition at line 175 of file GenEvent.h.

References attribute().

## ◆ pdf_info() [2/2]

ConstGenPdfInfoPtr pdf_info | ( |  | ) | const
| inline

Get PDF information (const version).

Definition at line 177 of file GenEvent.h.

References attribute().

## ◆ read_data()

void read_data | ( | const GenEventData & | data | ) |

Fill GenEvent based on GenEventData.

Disallow empty strings

Definition at line 336 of file protobufUtils.cc.

References HEPMC3_WARNING_LEVEL, m_attributes, m_length_unit, m_lock_attributes, m_momentum_unit, m_particles, m_rootvertex, m_vertices, m_weights, read_data(), set_event_number(), and shift_position_to().

## ◆ reflect()

bool reflect | ( | const int | axis | ) |

Change sign of axis.

Definition at line 515 of file GenEvent.cc.

References HEPMC3_WARNING_LEVEL, m_particles, m_vertices, FourVector::setT(), FourVector::setX(), FourVector::setY(), and FourVector::setZ().

## ◆ remove_attribute()

void remove_attribute | ( | const std::string & | name,
|  | const int & | id = 0 )

Remove attribute.

Examples
  basic_tree.cc.

Definition at line 602 of file GenEvent.cc.

References m_attributes, and m_lock_attributes.

## ◆ remove_particle()

void remove_particle | ( | GenParticlePtr | p | ) |

Remove particle from the event.

This function will remove whole sub-tree starting from this particle if it is the only incoming particle of this vertex. It will also production vertex of this particle if this vertex has no more outgoing particles

Examples
  basic_tree.cc.

Definition at line 119 of file GenEvent.cc.

References HEPMC3_DEBUG, m_attributes, m_lock_attributes, m_particles, and remove_vertex().

## ◆ remove_particles()

void remove_particles | ( | std::vector< GenParticlePtr > | v | ) |

Remove a set of particles.

This function follows rules of GenEvent::remove_particle to remove a list of particles from the event.

Examples
  basic_tree.cc.

Definition at line 182 of file GenEvent.cc.

References remove_particle().

## ◆ remove_vertex()

void remove_vertex | ( | GenVertexPtr | v | ) |

Remove vertex from the event.

This will remove all sub-trees of all outgoing particles of this vertex

Definition at line 190 of file GenEvent.cc.

References HEPMC3_DEBUG, m_attributes, m_lock_attributes, m_vertices, and remove_particle().

## ◆ reserve()

void reserve | ( | const size_t & | parts,
|  | const size_t & | verts = 0 )

Reserve memory for particles and vertices.

Helps optimize event creation when size of the event is known beforehand

Definition at line 391 of file GenEvent.cc.

References m_particles, and m_vertices.

## ◆ rotate()

bool rotate | ( | const FourVector & | delta | ) |

Rotate event using x,y,z components of delta as rotation angles.

Todo
  Clarify orders of rotations?

Definition at line 449 of file GenEvent.cc.

References FourVector::e(), FourVector::is_zero(), m_particles, m_vertices, FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().

## ◆ run_info()

std::shared_ptr< GenRunInfo > run_info | ( |  | ) | const
| inline

Get a pointer to the the GenRunInfo object.

Examples
  class_example_write.cc.

Definition at line 144 of file GenEvent.h.

References m_run_info.

## ◆ set_beam_particles()

void set_beam_particles | ( | GenParticlePtr | p1,
|  | GenParticlePtr | p2 )

Set incoming beam particles.

Deprecated
  Backward compatibility

Definition at line 753 of file GenEvent.cc.

References m_rootvertex.

## ◆ set_cross_section()

void set_cross_section | ( | GenCrossSectionPtr | cs | ) |
| inline

Set cross-section information.

Definition at line 186 of file GenEvent.h.

References add_attribute().

## ◆ set_event_number()

void set_event_number | ( | const int & | num | ) |
| inline

Set event number.

Examples
  LHEF_example_cat.cc.

Definition at line 157 of file GenEvent.h.

References m_event_number.

## ◆ set_heavy_ion()

void set_heavy_ion | ( | GenHeavyIonPtr | hi | ) |
| inline

Set heavy ion generator additional information.

Definition at line 172 of file GenEvent.h.

References add_attribute().

## ◆ set_pdf_info()

void set_pdf_info | ( | GenPdfInfoPtr | pi | ) |
| inline

Set PDF information.

Definition at line 179 of file GenEvent.h.

References add_attribute().

## ◆ set_run_info()

void set_run_info | ( | std::shared_ptr< GenRunInfo > | run | ) |
| inline

Set the GenRunInfo object by smart pointer.

Examples
  class_example_read.cc.

Definition at line 148 of file GenEvent.h.

References m_run_info, and m_weights.

## ◆ set_units()

void set_units | ( | Units::MomentumUnit | new_momentum_unit,
|  | Units::LengthUnit | new_length_unit )

Change event units Converts event from current units to new ones.

Definition at line 397 of file GenEvent.cc.

References Units::convert(), FourVector::is_zero(), m_length_unit, m_momentum_unit, m_particles, and m_vertices.

## ◆ shift_position_by()

void shift_position_by | ( | const FourVector & | delta | ) |

Shift position of all vertices in the event by delta.

Examples
  basic_tree.cc.

Definition at line 438 of file GenEvent.cc.

References event_pos(), m_rootvertex, and m_vertices.

## ◆ shift_position_to()

void shift_position_to | ( | const FourVector & | newpos | ) |
| inline

Shift position of all vertices in the event to op.

Definition at line 211 of file GenEvent.h.

References event_pos(), and shift_position_by().

## ◆ vertices() [1/2]

const std::vector< GenVertexPtr > & vertices | ( |  | ) |
| inline

Get/set list of vertices (non-const).

Definition at line 82 of file GenEvent.h.

References m_vertices.

## ◆ vertices() [2/2]

const std::vector< ConstGenVertexPtr > & vertices | ( |  | ) | const

Get list of vertices (const).

Definition at line 43 of file GenEvent.cc.

References m_vertices.

## ◆ vertices_empty()

bool vertices_empty | ( |  | ) | const
| inline

Vertices empty, HepMC2 compatibility.

Definition at line 97 of file GenEvent.h.

References m_vertices.

## ◆ vertices_size()

int vertices_size | ( |  | ) | const
| inline

Vertices size, HepMC2 compatibility.

Definition at line 95 of file GenEvent.h.

References m_vertices.

## ◆ weight() [1/3]

double & weight | ( | const std::string & | name | ) |
| inline

Get event weight accessed by weight name

Note
  Requires there to be an attached GenRunInfo, otherwise will throw an exception
  It's the user's responsibility to ensure that the given name exists!

Definition at line 121 of file GenEvent.h.

References m_weights, and run_info().

## ◆ weight() [2/3]

double weight | ( | const std::string & | name | ) | const
| inline

Get event weight accessed by weight name

Note
  Requires there to be an attached GenRunInfo, otherwise will throw an exception
  It's the user's responsibility to ensure that the given name exists!

Definition at line 114 of file GenEvent.h.

References run_info(), and weight().

## ◆ weight() [3/3]

double weight | ( | const unsigned long & | index = 0 | ) | const
| inline

Get event weight accessed by index (or the canonical/first one if there is no argument)

Note
  It's the user's responsibility to ensure that the given index exists!

Definition at line 110 of file GenEvent.h.

References weights().

## ◆ weight_names()

const std::vector< std::string > & weight_names | ( |  | ) | const
| inline

Get event weight names, if there are some

Note
  Requires there to be an attached GenRunInfo with registered weight names, otherwise will throw an exception

Definition at line 130 of file GenEvent.h.

References run_info().

## ◆ weights() [1/2]

std::vector< double > & weights | ( |  | ) |
| inline

Get event weights as a vector (non-const).

Definition at line 107 of file GenEvent.h.

References m_weights.

## ◆ weights() [2/2]

const std::vector< double > & weights | ( |  | ) | const
| inline

Get event weight values as a vector.

Examples
  LHEF_example_cat.cc.

Definition at line 105 of file GenEvent.h.

References m_weights.

## ◆ write_data()

void write_data | ( | GenEventData & | data | ) | const

Fill GenEventData object.

Definition at line 625 of file GenEvent.cc.

References GenEventData::attribute_id, GenEventData::attribute_name, GenEventData::attribute_string, attributes(), event_number(), GenEventData::event_number, event_pos(), GenEventData::event_pos, HEPMC3_WARNING_LEVEL, length_unit(), GenEventData::length_unit, GenEventData::links1, GenEventData::links2, m_attributes, momentum_unit(), GenEventData::momentum_unit, particles(), GenEventData::particles, vertices(), GenEventData::vertices, weights(), and GenEventData::weights.

## Field Documentation

## ◆ m_attributes

std::map< std::string, std::map<int, std::shared_ptr<Attribute> > > m_attributes
| mutableprivate

Map of event, particle and vertex attributes.

Keys are name and ID (0 = event, <0 = vertex, >0 = particle)

Definition at line 397 of file GenEvent.h.

## ◆ m_event_number

int m_event_number = 0
| private

Event number.

Definition at line 378 of file GenEvent.h.

## ◆ m_length_unit

Units::LengthUnit m_length_unit = Units::MM
| private

Length unit.

Definition at line 386 of file GenEvent.h.

## ◆ m_lock_attributes

std::recursive_mutex m_lock_attributes
| mutableprivate

Mutex lock for the m_attibutes map.

Definition at line 406 of file GenEvent.h.

## ◆ m_momentum_unit

Units::MomentumUnit m_momentum_unit = Units::GEV
| private

Momentum unit.

Definition at line 384 of file GenEvent.h.

## ◆ m_particles

std::vector<GenParticlePtr> m_particles
| private

List of particles.

Definition at line 373 of file GenEvent.h.

## ◆ m_rootvertex

GenVertexPtr m_rootvertex
| private

The root vertex is stored outside the normal vertices list to block user access to it.

Definition at line 389 of file GenEvent.h.

## ◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
| private

Global run information.

Definition at line 392 of file GenEvent.h.

## ◆ m_vertices

std::vector<GenVertexPtr> m_vertices
| private

List of vertices.

Definition at line 375 of file GenEvent.h.

## ◆ m_weights

std::vector<double> m_weights
| private

Event weights.

Definition at line 381 of file GenEvent.h.

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

- GenEvent.h
- protobufUtils.cc
- GenEvent.cc