StRoot
1
|
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... | |
GenEvent & | operator= (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 | |
GenParticle * | barcode_to_particle (int barCode) const |
assign a barcode to a particle More... | |
GenVertex * | barcode_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 |
GenVertex * | signal_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 |
WeightContainer & | weights () |
direct access to WeightContainer More... | |
const WeightContainer & | weights () const |
direct access to WeightContainer | |
GenCrossSection const * | cross_section () const |
access the GenCrossSection container if it exists | |
GenCrossSection * | cross_section () |
HeavyIon const * | heavy_ion () const |
access the HeavyIon container if it exists | |
HeavyIon * | heavy_ion () |
PdfInfo const * | pdf_info () const |
access the PdfInfo container if it exists | |
PdfInfo * | pdf_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 |
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.
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() |
||
) |
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 & | |||
) |
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 | ) |
deep copy
deep copy - makes a copy of all vertices!
Definition at line 156 of file GenEvent.cc.
References add_vertex(), beam_particles(), HepMC::GenParticle::end_vertex(), particles_begin(), particles_end(), HepMC::GenParticle::production_vertex(), random_states(), set_beam_particles(), set_random_states(), set_signal_process_vertex(), signal_process_vertex(), HepMC::GenVertex::suggest_barcode(), vertices_begin(), vertices_end(), and weights().
|
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().
bool HepMC::GenEvent::add_vertex | ( | GenVertex * | vtx | ) |
adds to evt and adopts
returns true if successful - generally will only return false if the inserted vertex is already included in the event.
Definition at line 334 of file GenEvent.cc.
References HepMC::GenVertex::barcode(), HepMC::GenVertex::parent_event(), remove_vertex(), and HepMC::GenVertex::set_parent_event_().
Referenced by HepMC::IO_HEPEVT::build_end_vertex(), HepMC::IO_HERWIG::build_end_vertex(), HepMC::IO_HEPEVT::build_production_vertex(), HepMC::IO_HERWIG::build_production_vertex(), Photospp::PhotosHepMCParticle::createSelfDecayVertex(), HepMC::IO_HEPEVT::fill_next_event(), HepMC::IO_HERWIG::fill_next_event(), GenEvent(), read(), set_signal_process_vertex(), Photospp::PhotosHepMCParticle::setDaughters(), Tauolapp::TauolaHepMCParticle::setDaughters(), Photospp::PhotosHepMCParticle::setMothers(), and Tauolapp::TauolaHepMCParticle::setMothers().
|
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().
|
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().
|
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().
|
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.
|
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().
|
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().
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().
|
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 | ) |
read a GenEvent from streaming input
Definition at line 155 of file GenEventStreamIO.cc.
References HepMC::GenVertex::add_particle_in(), add_vertex(), HepMC::GenParticle::barcode(), barcode_to_vertex(), clear(), HepMC::GenParticle::end_vertex(), HepMC::StreamInfo::finished_first_event(), HepMC::get_stream_info(), HepMC::StreamInfo::has_key(), HepMC::StreamInfo::io_momentum_unit(), HepMC::StreamInfo::io_position_unit(), HepMC::StreamInfo::io_type(), HepMC::GenCrossSection::is_set(), HepMC::PdfInfo::is_valid(), HepMC::HeavyIon::is_valid(), HepMC::GenParticle::production_vertex(), HepMC::GenCrossSection::read(), HepMC::StreamInfo::reading_event_header(), set_beam_particles(), set_cross_section(), HepMC::StreamInfo::set_finished_first_event(), set_heavy_ion(), set_pdf_info(), HepMC::StreamInfo::set_reading_event_header(), set_signal_process_vertex(), signal_process_vertex(), and use_units().
Referenced by HepMC::operator>>().
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().
|
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.
|
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().
|
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().
|
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().
|
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.
|
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 | ) |
Writes evt to an output stream.
Definition at line 72 of file GenEventStreamIO.cc.
References alphaQCD(), alphaQED(), beam_particles(), event_number(), event_scale(), HepMC::StreamInfo::finished_first_event(), HepMC::get_stream_info(), heavy_ion(), length_unit(), momentum_unit(), mpi(), pdf_info(), HepMC::StreamInfo::set_finished_first_event(), signal_process_id(), signal_process_vertex(), HepMC::WeightContainer::size(), vertices_begin(), vertices_end(), vertices_size(), weights(), and HepMC::GenCrossSection::write().
Referenced by HepMC::operator<<().
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().