|
MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
|
Stores event-related information. More...
#include <GenEvent.h>
Public Member Functions | |
| GenEvent (const GenEvent &) | |
| Copy constructor. | |
| GenEvent (std::shared_ptr< GenRunInfo > run, Units::MomentumUnit mu=Units::GEV, Units::LengthUnit lu=Units::MM) | |
| Constructor with associated run. | |
| GenEvent (Units::MomentumUnit mu=Units::GEV, Units::LengthUnit lu=Units::MM) | |
| Event constructor without a run. | |
| ~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 velocities. | |
| 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. | |
Stores event-related information.
Manages event-related information. Contains lists of GenParticle and GenVertex objects
Definition at line 47 of file GenEvent.h.
| HepMC3::GenEvent::GenEvent | ( | Units::MomentumUnit | mu = Units::GEV, |
| Units::LengthUnit | lu = Units::MM ) |
Event constructor without a run.
Definition at line 490 of file marley_hepmc3.cc.
Referenced by GenEvent(), and operator=().
| HepMC3::GenEvent::GenEvent | ( | std::shared_ptr< GenRunInfo > | run, |
| Units::MomentumUnit | mu = Units::GEV, | ||
| Units::LengthUnit | lu = Units::MM ) |
Constructor with associated run.
Definition at line 496 of file marley_hepmc3.cc.
| HepMC3::GenEvent::GenEvent | ( | const GenEvent & | e | ) |
Copy constructor.
Definition at line 531 of file marley_hepmc3.cc.
References GenEvent(), read_data(), and write_data().
| HepMC3::GenEvent::~GenEvent | ( | ) |
Destructor.
Definition at line 544 of file marley_hepmc3.cc.
| void HepMC3::GenEvent::add_attribute | ( | const std::string & | name, |
| const std::shared_ptr< Attribute > & | att, | ||
| const int & | id = 0 ) |
Disallow empty strings
Definition at line 1265 of file marley_hepmc3.cc.
References particles(), and vertices().
Referenced by HepMC3::GenParticle::add_attribute(), HepMC3::GenVertex::add_attribute(), marley::Generator::add_state_to_event(), add_tree(), marley::Generator::create_event(), marley::Generator::create_event(), marley::Generator::finish_event_metadata(), set_cross_section(), set_heavy_ion(), and set_pdf_info().
| void HepMC3::GenEvent::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 1339 of file marley_hepmc3.cc.
References particles_size(), and vertices_size().
| void HepMC3::GenEvent::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 1314 of file marley_hepmc3.cc.
References particles_size(), and vertices_size().
| void HepMC3::GenEvent::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 1282 of file marley_hepmc3.cc.
References particles_size(), and vertices_size().
| void HepMC3::GenEvent::add_beam_particle | ( | GenParticlePtr | p1 | ) |
Add particle to root vertex.
Definition at line 1226 of file marley_hepmc3.cc.
References add_particle().
| void HepMC3::GenEvent::add_particle | ( | GenParticlePtr | p | ) |
Add particle.
Definition at line 516 of file marley_hepmc3.cc.
References particles().
Referenced by add_beam_particle(), and add_vertex().
| void HepMC3::GenEvent::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.
Definition at line 736 of file marley_hepmc3.cc.
References add_attribute(), add_vertex(), attribute(), and particles().
| void HepMC3::GenEvent::add_vertex | ( | GenVertexPtr | v | ) |
Add vertex.
Definition at line 567 of file marley_hepmc3.cc.
References add_particle(), and vertices().
Referenced by add_tree().
| std::shared_ptr< T > HepMC3::GenEvent::attribute | ( | const std::string & | name, |
| const int & | id = 0 ) const |
Get attribute of type T.
Definition at line 418 of file GenEvent.h.
References particles(), run_info(), and vertices().
Referenced by add_tree(), HepMC3::GenParticle::attribute(), HepMC3::GenVertex::attribute(), cross_section(), cross_section(), heavy_ion(), heavy_ion(), pdf_info(), pdf_info(), and HepMC3::GenVertex::position().
| std::string HepMC3::GenEvent::attribute_as_string | ( | const std::string & | name, |
| const int & | id = 0 ) const |
Get attribute of any type as string.
Definition at line 1244 of file marley_hepmc3.cc.
References run_info().
Referenced by HepMC3::GenParticle::attribute_as_string(), and HepMC3::GenVertex::attribute_as_string().
| std::vector< std::string > HepMC3::GenEvent::attribute_names | ( | const int & | id = 0 | ) | const |
Get list of attribute names.
Definition at line 1081 of file marley_hepmc3.cc.
Referenced by HepMC3::GenParticle::attribute_names(), HepMC3::GenVertex::attribute_names(), and HepMC3::Print::line().
|
inline |
Get a copy of the list of attributes.
Definition at line 268 of file GenEvent.h.
Referenced by HepMC3::Print::content(), write_data(), and HepMC3::WriterAscii::write_event().
| const std::vector< GenParticlePtr > & HepMC3::GenEvent::beams | ( | ) |
Vector of beam particles.
Definition at line 902 of file marley_hepmc3.cc.
| std::vector< ConstGenParticlePtr > HepMC3::GenEvent::beams | ( | ) | const |
Vector of beam particles.
Definition at line 897 of file marley_hepmc3.cc.
| std::vector< ConstGenParticlePtr > HepMC3::GenEvent::beams | ( | const int | status | ) | const |
Vector of beam particles.
Definition at line 890 of file marley_hepmc3.cc.
| bool HepMC3::GenEvent::boost | ( | const FourVector & | delta | ) |
Boost event using x,y,z components of delta as velocities.
Definition at line 1015 of file marley_hepmc3.cc.
References HepMC3::FourVector::e(), HepMC3::FourVector::length2(), HepMC3::FourVector::x(), HepMC3::FourVector::y(), and HepMC3::FourVector::z().
| void HepMC3::GenEvent::clear | ( | ) |
Remove contents of this event.
Definition at line 1060 of file marley_hepmc3.cc.
Referenced by read_data(), and HepMC3::ReaderAscii::read_event().
|
inline |
|
inline |
Get cross-section information (const version)
Definition at line 184 of file GenEvent.h.
References attribute().
|
inline |
Get event number.
Definition at line 155 of file GenEvent.h.
Referenced by write_data(), and HepMC3::WriterAscii::write_event().
| const FourVector & HepMC3::GenEvent::event_pos | ( | ) | const |
Vertex representing the overall event position.
Definition at line 886 of file marley_hepmc3.cc.
Referenced by HepMC3::GenVertex::position(), shift_position_by(), shift_position_to(), write_data(), and HepMC3::WriterAscii::write_event().
|
inline |
Get heavy ion generator additional information.
Definition at line 168 of file GenEvent.h.
References attribute().
|
inline |
Get heavy ion generator additional information (const version)
Definition at line 170 of file GenEvent.h.
References attribute().
|
inline |
Get length unit.
Definition at line 162 of file GenEvent.h.
Referenced by HepMC3::Print::listing(), write_data(), and HepMC3::WriterAscii::write_event().
|
inline |
Get momentum unit.
Definition at line 160 of file GenEvent.h.
Referenced by HepMC3::Print::listing(), write_data(), and HepMC3::WriterAscii::write_event().
Copy Assignment operator.
Definition at line 552 of file marley_hepmc3.cc.
References GenEvent(), read_data(), and write_data().
|
inline |
Get/set list of particles (non-const)
Definition at line 80 of file GenEvent.h.
| const std::vector< ConstGenParticlePtr > & HepMC3::GenEvent::particles | ( | ) | const |
Get list of particles (const)
Definition at line 507 of file marley_hepmc3.cc.
Referenced by add_attribute(), add_particle(), add_tree(), attribute(), HepMC3::Print::content(), HepMC3::ReaderAscii::read_event(), marley::ProjectileDirectionRotator::rotate_event(), write_data(), and HepMC3::WriterAscii::write_event().
|
inline |
Particles empty, HepMC2 compatibility.
Definition at line 93 of file GenEvent.h.
|
inline |
Particles size, HepMC2 compatibility.
Definition at line 91 of file GenEvent.h.
Referenced by add_attributes(), add_attributes(), and add_attributes().
|
inline |
|
inline |
Get PDF information (const version)
Definition at line 177 of file GenEvent.h.
References attribute().
| void HepMC3::GenEvent::read_data | ( | const GenEventData & | data | ) |
Fill GenEvent based on GenEventData.
Disallow empty strings
Definition at line 1150 of file marley_hepmc3.cc.
References HepMC3::GenEventData::attribute_id, HepMC3::GenEventData::attribute_name, HepMC3::GenEventData::attribute_string, clear(), HepMC3::GenEventData::event_number, HepMC3::GenEventData::event_pos, HepMC3::GenEventData::length_unit, HepMC3::GenEventData::links1, HepMC3::GenEventData::links2, HepMC3::GenEventData::momentum_unit, HepMC3::GenEventData::particles, set_event_number(), shift_position_to(), HepMC3::GenEventData::vertices, weights(), and HepMC3::GenEventData::weights.
Referenced by GenEvent(), marley::EventFileReader::next_event(), operator=(), and HepMC3::ReaderAscii::read_event().
| bool HepMC3::GenEvent::reflect | ( | const int | axis | ) |
Change sign of axis.
Definition at line 983 of file marley_hepmc3.cc.
References HepMC3::FourVector::setT(), HepMC3::FourVector::setX(), HepMC3::FourVector::setY(), and HepMC3::FourVector::setZ().
| void HepMC3::GenEvent::remove_attribute | ( | const std::string & | name, |
| const int & | id = 0 ) |
Remove attribute.
Definition at line 1070 of file marley_hepmc3.cc.
Referenced by HepMC3::GenParticle::remove_attribute(), and HepMC3::GenVertex::remove_attribute().
| void HepMC3::GenEvent::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
Definition at line 587 of file marley_hepmc3.cc.
References remove_vertex().
Referenced by remove_particles(), and remove_vertex().
| void HepMC3::GenEvent::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.
Definition at line 650 of file marley_hepmc3.cc.
References remove_particle().
| void HepMC3::GenEvent::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 658 of file marley_hepmc3.cc.
References remove_particle().
Referenced by remove_particle().
| void HepMC3::GenEvent::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 859 of file marley_hepmc3.cc.
| bool HepMC3::GenEvent::rotate | ( | const FourVector & | delta | ) |
Rotate event using x,y,z components of delta as rotation angles.
Definition at line 917 of file marley_hepmc3.cc.
References HepMC3::FourVector::e(), HepMC3::FourVector::is_zero(), HepMC3::FourVector::t(), HepMC3::FourVector::x(), HepMC3::FourVector::y(), and HepMC3::FourVector::z().
|
inline |
Get a pointer to the the GenRunInfo object.
Definition at line 144 of file GenEvent.h.
Referenced by attribute(), attribute_as_string(), marley::CommandHandler::cmd_reweight(), marley::EventFileReader::deduce_file_format(), weight(), weight(), weight_names(), and HepMC3::WriterAscii::write_event().
| void HepMC3::GenEvent::set_beam_particles | ( | GenParticlePtr | p1, |
| GenParticlePtr | p2 ) |
Set incoming beam particles.
Definition at line 1221 of file marley_hepmc3.cc.
|
inline |
Set cross-section information.
Definition at line 186 of file GenEvent.h.
References add_attribute().
|
inline |
Set event number.
Definition at line 157 of file GenEvent.h.
Referenced by read_data().
|
inline |
Set heavy ion generator additional information.
Definition at line 172 of file GenEvent.h.
References add_attribute().
|
inline |
|
inline |
Set the GenRunInfo object by smart pointer.
Definition at line 148 of file GenEvent.h.
Referenced by marley::CommandHandler::cmd_convert(), marley::CommandHandler::cmd_reweight(), marley::EventFileReader::next_event(), and HepMC3::ReaderAscii::read_event().
| void HepMC3::GenEvent::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 865 of file marley_hepmc3.cc.
References HepMC3::Units::convert(), and HepMC3::FourVector::is_zero().
| void HepMC3::GenEvent::shift_position_by | ( | const FourVector & | delta | ) |
Shift position of all vertices in the event by delta.
Definition at line 906 of file marley_hepmc3.cc.
References event_pos().
Referenced by shift_position_to().
|
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().
Referenced by read_data().
|
inline |
Get/set list of vertices (non-const)
Definition at line 82 of file GenEvent.h.
| const std::vector< ConstGenVertexPtr > & HepMC3::GenEvent::vertices | ( | ) | const |
Get list of vertices (const)
Definition at line 511 of file marley_hepmc3.cc.
Referenced by add_attribute(), add_vertex(), attribute(), HepMC3::Print::content(), HepMC3::Print::listing(), HepMC3::ReaderAscii::read_event(), write_data(), and HepMC3::WriterAscii::write_event().
|
inline |
Vertices empty, HepMC2 compatibility.
Definition at line 97 of file GenEvent.h.
|
inline |
Vertices size, HepMC2 compatibility.
Definition at line 95 of file GenEvent.h.
Referenced by add_attributes(), add_attributes(), and add_attributes().
|
inline |
Get event weight accessed by weight name
Definition at line 121 of file GenEvent.h.
References run_info().
|
inline |
Get event weight accessed by weight name
Definition at line 114 of file GenEvent.h.
References run_info(), and weight().
|
inline |
Get event weight accessed by index (or the canonical/first one if there is no argument)
Definition at line 110 of file GenEvent.h.
References weights().
Referenced by weight().
|
inline |
Get event weight names, if there are some
Definition at line 130 of file GenEvent.h.
References run_info().
|
inline |
Get event weights as a vector (non-const)
Definition at line 107 of file GenEvent.h.
|
inline |
Get event weight values as a vector.
Definition at line 105 of file GenEvent.h.
Referenced by marley::CommandHandler::cmd_reweight(), HepMC3::Print::content(), read_data(), weight(), write_data(), and HepMC3::WriterAscii::write_event().
| void HepMC3::GenEvent::write_data | ( | GenEventData & | data | ) | const |
Fill GenEventData object.
Definition at line 1093 of file marley_hepmc3.cc.
References HepMC3::GenEventData::attribute_id, HepMC3::GenEventData::attribute_name, HepMC3::GenEventData::attribute_string, attributes(), event_number(), HepMC3::GenEventData::event_number, event_pos(), HepMC3::GenEventData::event_pos, length_unit(), HepMC3::GenEventData::length_unit, HepMC3::GenEventData::links1, HepMC3::GenEventData::links2, momentum_unit(), HepMC3::GenEventData::momentum_unit, particles(), HepMC3::GenEventData::particles, vertices(), HepMC3::GenEventData::vertices, weights(), and HepMC3::GenEventData::weights.
Referenced by GenEvent(), and operator=().