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_particle_data_table is required by IO_BaseClass, but not used here
bool fill_particle_data_table (ParticleDataTable *)
 fill_particle_data_table is required by IO_BaseClass, but not used here
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)
void precision (int)
const int error_type () const
 integer (enum) associated with read error
const std::string & error_message () const
 the read error message string

Protected Member Functions

ParticleDataread_particle_data (std::istream *, ParticleDataTable *)
bool read_io_particle_data_table (std::istream *, ParticleDataTable *)

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_MyHerwig.cc, example_MyPythia.cc, example_UsingIterators.cc, testFlow.cc, testHepMC.cc.in, testHepMCIteration.cc.in, testMass.cc.in, testMultipleCopies.cc.in, and testStreamIO.cc.in.

Definition at line 64 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 17 of file IO_GenEvent.cc.

References HepMC::detail::establish_input_stream_info(), HepMC::detail::establish_output_stream_info(), and HepMC::IO_Exception::InputAndOutput.

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

constructor requiring an input stream

Definition at line 51 of file IO_GenEvent.cc.

References HepMC::detail::establish_input_stream_info().

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

constructor requiring an output stream

Definition at line 62 of file IO_GenEvent.cc.

References HepMC::detail::establish_output_stream_info().

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

Definition at line 73 of file IO_GenEvent.cc.

References HepMC::write_HepMC_IO_block_end().


Member Function Documentation

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

clear the IO stream

Definition at line 146 of file IO_GenEvent.h.

const std::string & HepMC::IO_GenEvent::error_message (  )  const [inline]

the read error message string

Definition at line 158 of file IO_GenEvent.h.

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

integer (enum) associated with read error

Definition at line 154 of file IO_GenEvent.h.

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

get the next event

Implements HepMC::IO_BaseClass.

Definition at line 110 of file IO_GenEvent.cc.

References HepMC::GenEvent::clear(), HepMC::IO_Exception::InvalidData, HepMC::GenEvent::is_valid(), HepMC::IO_Exception::NullEvent, HepMC::IO_Exception::OK, and HepMC::IO_Exception::WrongFileType.

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

fill_particle_data_table is required by IO_BaseClass, but not used here

Implements HepMC::IO_BaseClass.

Definition at line 164 of file IO_GenEvent.h.

void HepMC::IO_GenEvent::precision ( int   ) 

set output precision The default precision is 16.

Definition at line 97 of file IO_GenEvent.cc.

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

write to ostr

Reimplemented from HepMC::IO_BaseClass.

Definition at line 87 of file IO_GenEvent.cc.

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

check the state of the IO stream

Definition at line 136 of file IO_GenEvent.h.

Referenced by main().

bool HepMC::IO_GenEvent::read_io_particle_data_table ( std::istream *  ,
ParticleDataTable  
) [protected]

Definition at line 179 of file IO_GenEvent.cc.

References read_particle_data().

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

read particle data table information ParticleDataTable is deprecated. We include this method for reading old files which may have ParticleData information.

Definition at line 187 of file IO_GenEvent.cc.

References HepMC::ParticleDataTable::insert().

Referenced by read_io_particle_data_table().

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 80 of file IO_GenEvent.cc.

References HepMC::set_input_units().

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 163 of file IO_GenEvent.cc.

References HepMC::write_HepMC_IO_block_end(), and HepMC::IO_Exception::WrongFileType.

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 144 of file IO_GenEvent.cc.

References HepMC::write_HepMC_IO_block_begin(), and HepMC::IO_Exception::WrongFileType.

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

write_particle_data_table is required by IO_BaseClass, but not used here

Implements HepMC::IO_BaseClass.

Definition at line 163 of file IO_GenEvent.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 7 13:10:20 2010 for HepMC by  doxygen 1.4.7