HepMC Reference Documentation

HepMC

HepMC::IO_GenEvent Class Reference

IO_GenEvent also deals with HeavyIon and PdfInfo. More...

#include <IO_GenEvent.h>

Inheritance diagram for HepMC::IO_GenEvent:

HepMC::IO_BaseClass List of all members.

Public Member Functions

 IO_GenEvent (const std::string &filename="IO_GenEvent.dat", std::ios::openmode mode=std::ios::out)
 constructor requiring a file name and std::ios mode
 IO_GenEvent (std::istream &)
 constructor requiring an input stream
 IO_GenEvent (std::ostream &)
 constructor requiring an output stream
virtual ~IO_GenEvent ()
void write_event (const GenEvent *evt)
 write this event
bool fill_next_event (GenEvent *evt)
 get the next event
void write_particle_data_table (const ParticleDataTable *)
 write this ParticleDataTable
bool fill_particle_data_table (ParticleDataTable *)
 fill this ParticleDataTable
void write_comment (const std::string comment)
int rdstate () const
 check the state of the IO stream
void clear ()
 clear the IO stream
void print (std::ostream &ostr=std::cout) const
 write to ostr
void use_input_units (Units::MomentumUnit, Units::LengthUnit)

Protected Member Functions

void write_vertex (GenVertex *)
 write vertex information
void write_beam_particles (std::pair< HepMC::GenParticle *, HepMC::GenParticle * >)
 write beam particle information
void write_heavy_ion (HeavyIon const *)
 write heavy ion information
void write_pdf_info (PdfInfo const *)
 write PDF information
void write_unit_info (const GenEvent *evt)
 write units
void write_particle (GenParticle *p)
 write particle information
void write_particle_data (const ParticleData *d)
 write particle data information
GenVertexread_vertex (TempParticleMap &particle_to_end_vertex)
 read vertex information
GenParticleread_particle (TempParticleMap &particle_to_end_vertex)
 read GenParticle information
ParticleDataread_particle_data (ParticleDataTable *)
 read particle data table information
HeavyIonread_heavy_ion ()
 read heavy ion information
void read_unit_info (GenEvent *evt)
 read units
bool write_end_listing ()
 write end tag
void output (const double &)
 write double
void output (const float &)
 write float
void output (const int &)
 write int
void output (const long &)
 write long
void output (const char &)
 write a single character

Detailed Description

IO_GenEvent also deals with HeavyIon and PdfInfo.

event input/output in ascii format for machine reading extended format contains HeavyIon and PdfInfo classes

Strategy for reading or writing events using iostreams When instantiating with a file name, the mode of file to be created must be specified. Options are: std::ios::in open file for input std::ios::out open file for output std::ios::trunc erase old file when opening (i.e. ios::out|iostrunc removes oldfile, and creates a new one for output ) std::ios::app append output to end of file for the purposes of this class, simultaneous input and output mode ( std::ios::in | std::ios::out ) is not allowed.

Event listings are preceded by the key: "HepMC::IO_GenEvent-START_EVENT_LISTING\n" and terminated by the key: "HepMC::IO_GenEvent-END_EVENT_LISTING\n" GenParticle Data tables are preceded by the key: "HepMC::IO_GenEvent-START_PARTICLE_DATA\n" and terminated by the key: "HepMC::IO_GenEvent-END_PARTICLE_DATA\n" Comments are allowed. They need not be preceded by anything, though if a comment is written using write_comment( const string ) then it will be preceded by "HepMC::IO_GenEvent-COMMENT\n" Each event, vertex, particle, particle data, heavy ion, or pdf info line is preceded by "E ","V ","P ","D ","H ","F " respectively. Comments may appear anywhere in the file -- so long as they do not contain any of the start/stop keys.

Examples:

example_EventSelection.cc, example_MyPythia.cc, example_UsingIterators.cc, testHepMC.cc.in, testHepMCIteration.cc.in, testMass.cc.in, and testMultipleCopies.cc.in.

Definition at line 65 of file IO_GenEvent.h.


Constructor & Destructor Documentation

HepMC::IO_GenEvent::IO_GenEvent ( const std::string &  filename = "IO_GenEvent.dat",
std::ios::openmode  mode = std::ios::out 
)

constructor requiring a file name and std::ios mode

Definition at line 19 of file IO_GenEvent.cc.

HepMC::IO_GenEvent::IO_GenEvent ( std::istream &   ) 

constructor requiring an input stream

Definition at line 57 of file IO_GenEvent.cc.

HepMC::IO_GenEvent::IO_GenEvent ( std::ostream &   ) 

constructor requiring an output stream

Definition at line 66 of file IO_GenEvent.cc.

HepMC::IO_GenEvent::~IO_GenEvent (  )  [virtual]

Definition at line 82 of file IO_GenEvent.cc.

References write_end_listing().


Member Function Documentation

void HepMC::IO_GenEvent::write_event ( const GenEvent evt  )  [virtual]

write this event

Writes evt to output stream. It does NOT delete the event after writing.

Implements HepMC::IO_BaseClass.

Definition at line 101 of file IO_GenEvent.cc.

References HepMC::GenEvent::alphaQCD(), HepMC::GenEvent::alphaQED(), HepMC::GenVertex::barcode(), HepMC::GenEvent::beam_particles(), HepMC::WeightContainer::begin(), HepMC::WeightContainer::end(), HepMC::GenEvent::event_number(), HepMC::GenEvent::event_scale(), HepMC::GenEvent::heavy_ion(), HepMC::GenEvent::mpi(), output(), HepMC::GenEvent::pdf_info(), HepMC::GenEvent::random_states(), HepMC::GenEvent::signal_process_id(), HepMC::GenEvent::signal_process_vertex(), HepMC::WeightContainer::size(), v, HepMC::versionName(), HepMC::GenEvent::vertices_begin(), HepMC::GenEvent::vertices_end(), HepMC::GenEvent::vertices_size(), HepMC::GenEvent::weights(), write_beam_particles(), write_heavy_ion(), HepMC::CommonIO::write_IO_GenEvent_Key(), write_pdf_info(), write_unit_info(), and write_vertex().

bool HepMC::IO_GenEvent::fill_next_event ( GenEvent evt  )  [virtual]

get the next event

Implements HepMC::IO_BaseClass.

Definition at line 156 of file IO_GenEvent.cc.

References HepMC::ascii, HepMC::ascii_pdt, HepMC::extascii, HepMC::extascii_pdt, HepMC::CommonIO::find_end_key(), HepMC::CommonIO::find_file_type(), HepMC::gen, HepMC::CommonIO::io_type(), HepMC::CommonIO::read_io_ascii(), HepMC::CommonIO::read_io_extendedascii(), and HepMC::CommonIO::read_io_genevent().

void HepMC::IO_GenEvent::write_particle_data_table ( const ParticleDataTable  )  [inline, virtual]

write this ParticleDataTable

Implements HepMC::IO_BaseClass.

Definition at line 212 of file IO_GenEvent.h.

bool HepMC::IO_GenEvent::fill_particle_data_table ( ParticleDataTable  )  [inline, virtual]

fill this ParticleDataTable

Implements HepMC::IO_BaseClass.

Definition at line 213 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::write_comment ( const std::string  comment  ) 

insert a comment directly into the output file --- normally you only want to do this at the beginning or end of the file. All comments are preceded with "HepMC::IO_GenEvent-COMMENT\n"

Definition at line 234 of file IO_GenEvent.cc.

References write_end_listing().

int HepMC::IO_GenEvent::rdstate (  )  const [inline]

check the state of the IO stream

Definition at line 195 of file IO_GenEvent.h.

Referenced by main().

void HepMC::IO_GenEvent::clear (  )  [inline]

clear the IO stream

Definition at line 204 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::print ( std::ostream &  ostr = std::cout  )  const [virtual]

write to ostr

Reimplemented from HepMC::IO_BaseClass.

Definition at line 91 of file IO_GenEvent.cc.

void HepMC::IO_GenEvent::use_input_units ( Units::MomentumUnit  ,
Units::LengthUnit   
)

needed when reading a file without units if those units are different than the declared default units (e.g., the default units are MeV, but the file was written with GeV) This method is not necessary if the units are written in the file

Definition at line 87 of file IO_GenEvent.cc.

References HepMC::CommonIO::use_input_units().

void HepMC::IO_GenEvent::write_vertex ( GenVertex  )  [protected]

write vertex information

Definition at line 249 of file IO_GenEvent.cc.

References output(), v, and write_particle().

Referenced by write_event().

void HepMC::IO_GenEvent::write_beam_particles ( std::pair< HepMC::GenParticle *, HepMC::GenParticle * >   )  [protected]

write beam particle information

Definition at line 295 of file IO_GenEvent.cc.

References output(), and p.

Referenced by write_event().

void HepMC::IO_GenEvent::write_heavy_ion ( HeavyIon const *   )  [protected]

write heavy ion information

Definition at line 312 of file IO_GenEvent.cc.

References HepMC::HeavyIon::eccentricity(), HepMC::HeavyIon::event_plane_angle(), HepMC::HeavyIon::impact_parameter(), HepMC::HeavyIon::N_Nwounded_collisions(), HepMC::HeavyIon::Ncoll(), HepMC::HeavyIon::Ncoll_hard(), HepMC::HeavyIon::Npart_proj(), HepMC::HeavyIon::Npart_targ(), HepMC::HeavyIon::Nwounded_N_collisions(), HepMC::HeavyIon::Nwounded_Nwounded_collisions(), output(), HepMC::HeavyIon::sigma_inel_NN(), HepMC::HeavyIon::spectator_neutrons(), and HepMC::HeavyIon::spectator_protons().

Referenced by write_event().

void HepMC::IO_GenEvent::write_pdf_info ( PdfInfo const *   )  [protected]

write PDF information

Definition at line 356 of file IO_GenEvent.cc.

References HepMC::PdfInfo::id1(), HepMC::PdfInfo::id2(), output(), HepMC::PdfInfo::pdf1(), HepMC::PdfInfo::pdf2(), HepMC::PdfInfo::pdf_id1(), HepMC::PdfInfo::pdf_id2(), HepMC::PdfInfo::scalePDF(), HepMC::PdfInfo::x1(), and HepMC::PdfInfo::x2().

Referenced by write_event().

void HepMC::IO_GenEvent::write_unit_info ( const GenEvent evt  )  [protected]

write units

Definition at line 392 of file IO_GenEvent.cc.

References HepMC::GenEvent::length_unit(), HepMC::GenEvent::momentum_unit(), HepMC::Units::name(), and output().

Referenced by write_event().

void HepMC::IO_GenEvent::write_particle ( GenParticle p  )  [protected]

write particle information

Definition at line 405 of file IO_GenEvent.cc.

References output(), and p.

Referenced by write_vertex().

void HepMC::IO_GenEvent::write_particle_data ( const ParticleData d  )  [protected]

write particle data information

Definition at line 430 of file IO_GenEvent.cc.

References HepMC::ParticleData::charge(), HepMC::ParticleData::clifetime(), HepMC::ParticleData::mass(), HepMC::ParticleData::name(), output(), HepMC::ParticleData::pdg_id(), and HepMC::ParticleData::spin().

GenVertex* HepMC::IO_GenEvent::read_vertex ( TempParticleMap particle_to_end_vertex  )  [protected]

read vertex information

GenParticle * HepMC::IO_GenEvent::read_particle ( TempParticleMap particle_to_end_vertex  )  [protected]

read GenParticle information

Definition at line 474 of file IO_GenEvent.cc.

References HepMC::TempParticleMap::addEndParticle(), p, and HepMC::Flow::set_icode().

ParticleData * HepMC::IO_GenEvent::read_particle_data ( ParticleDataTable  )  [protected]

read particle data table information

Definition at line 516 of file IO_GenEvent.cc.

References HepMC::ParticleDataTable::insert().

HeavyIon * HepMC::IO_GenEvent::read_heavy_ion (  )  [protected]

read heavy ion information

Definition at line 448 of file IO_GenEvent.cc.

void HepMC::IO_GenEvent::read_unit_info ( GenEvent evt  )  [protected]

read units

bool HepMC::IO_GenEvent::write_end_listing (  )  [protected]

write end tag

Definition at line 538 of file IO_GenEvent.cc.

References HepMC::CommonIO::write_IO_GenEvent_End().

Referenced by write_comment(), and ~IO_GenEvent().

void HepMC::IO_GenEvent::output ( const double &   )  [inline, protected]

write double

Definition at line 150 of file IO_GenEvent.h.

Referenced by write_beam_particles(), write_event(), write_heavy_ion(), write_particle(), write_particle_data(), write_pdf_info(), write_unit_info(), and write_vertex().

void HepMC::IO_GenEvent::output ( const float &   )  [inline, protected]

write float

Definition at line 159 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::output ( const int &   )  [inline, protected]

write int

Definition at line 168 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::output ( const long &   )  [inline, protected]

write long

Definition at line 177 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::output ( const char &   )  [inline, protected]

write a single character

Definition at line 186 of file IO_GenEvent.h.


The documentation for this class was generated from the following files:
Generated on Wed Jun 3 16:53:04 2009 for HepMC by  doxygen 1.5.1-3