HepMC Reference Documentation

HepMC

HepMC::IO_Ascii Class Reference

IO_Ascii is used to read or write from an ascii file. More...

#include <IO_Ascii.h>

Inheritance diagram for HepMC::IO_Ascii:

HepMC::IO_BaseClass List of all members.

Public Member Functions

 IO_Ascii (const char *filename="IO_Ascii.dat", std::ios::openmode mode=std::ios::out)
 constructor requiring a file name and std::ios mode
virtual ~IO_Ascii ()
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

Protected Member Functions

void write_vertex (GenVertex *)
 write vertex information
void write_particle (GenParticle *p)
 write particle information
void write_particle_data (const ParticleData *d)
 write ParticleDataTable 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 ParticleDataTable information
bool write_end_listing ()
 write end tag
bool search_for_key_end (std::istream &in, const char *key)
 look for line type (key)
bool search_for_key_beginning (std::istream &in, const char *key)
 not tested and NOT used anywhere!
bool eat_key (std::iostream &in, const char *key)
 string manipulation accounting
int find_in_map (const std::map< GenVertex *, int > &m, GenVertex *v) const
 find this vertex in the map of vertices
void output (const double &)
 write double
void output (const int &)
 write int
void output (const long int &)
 write long int
void output (const char &)
 write a single character

Detailed Description

IO_Ascii is used to read or write from an ascii file.

Strategy for reading or writing events/particleData as machine readable ascii to a file. When instantiating, the mode of file to be created must be specified.

Examples:

example_EventSelection.cc, example_MyPythia.cc, example_MyPythiaRead.cc, and example_UsingIterators.cc.

Definition at line 63 of file IO_Ascii.h.


Constructor & Destructor Documentation

HepMC::IO_Ascii::IO_Ascii ( const char *  filename = "IO_Ascii.dat",
std::ios::openmode  mode = std::ios::out 
)

constructor requiring a file name and std::ios mode

Definition at line 15 of file IO_Ascii.cc.

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

Definition at line 34 of file IO_Ascii.cc.

References write_end_listing().


Member Function Documentation

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

write this event

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

Implements HepMC::IO_BaseClass.

Definition at line 49 of file IO_Ascii.cc.

References HepMC::GenEvent::alphaQCD(), HepMC::GenEvent::alphaQED(), HepMC::GenVertex::barcode(), HepMC::WeightContainer::begin(), HepMC::WeightContainer::end(), HepMC::GenEvent::event_number(), HepMC::GenEvent::event_scale(), output(), 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(), and write_vertex().

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

get the next event

Implements HepMC::IO_BaseClass.

Definition at line 98 of file IO_Ascii.cc.

References HepMC::GenVertex::add_particle_in(), HepMC::GenEvent::add_vertex(), HepMC::GenEvent::barcode_to_vertex(), eat_key(), HepMC::TempParticleMap::end_vertex(), HepMC::TempParticleMap::order_begin(), HepMC::TempParticleMap::order_end(), p, read_vertex(), search_for_key_end(), HepMC::GenEvent::set_event_number(), HepMC::GenEvent::set_random_states(), HepMC::GenEvent::set_signal_process_id(), HepMC::GenEvent::set_signal_process_vertex(), v, and HepMC::GenEvent::weights().

void HepMC::IO_Ascii::write_particle_data_table ( const ParticleDataTable  )  [virtual]

write this ParticleDataTable

Implements HepMC::IO_BaseClass.

Definition at line 219 of file IO_Ascii.cc.

References HepMC::ParticleDataTable::begin(), HepMC::ParticleDataTable::end(), write_end_listing(), and write_particle_data().

bool HepMC::IO_Ascii::fill_particle_data_table ( ParticleDataTable  )  [virtual]

fill this ParticleDataTable

Implements HepMC::IO_BaseClass.

Definition at line 239 of file IO_Ascii.cc.

References eat_key(), read_particle_data(), search_for_key_end(), and HepMC::ParticleDataTable::set_description().

void HepMC::IO_Ascii::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_Ascii-COMMENT\n"

Definition at line 204 of file IO_Ascii.cc.

References write_end_listing().

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

check the state of the IO stream

Definition at line 140 of file IO_Ascii.h.

Referenced by main().

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

clear the IO stream

Definition at line 141 of file IO_Ascii.h.

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

write to ostr

Reimplemented from HepMC::IO_BaseClass.

Definition at line 39 of file IO_Ascii.cc.

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

write vertex information

Definition at line 287 of file IO_Ascii.cc.

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

Referenced by write_event().

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

write particle information

Definition at line 333 of file IO_Ascii.cc.

References output(), and p.

Referenced by write_vertex().

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

write ParticleDataTable information

Definition at line 357 of file IO_Ascii.cc.

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

Referenced by write_particle_data_table().

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

read vertex information

Definition at line 376 of file IO_Ascii.cc.

References read_particle(), and v.

Referenced by fill_next_event().

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

read GenParticle information

Definition at line 413 of file IO_Ascii.cc.

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

Referenced by read_vertex().

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

read ParticleDataTable information

Definition at line 454 of file IO_Ascii.cc.

References HepMC::ParticleDataTable::insert().

Referenced by fill_particle_data_table().

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

write end tag

Definition at line 476 of file IO_Ascii.cc.

Referenced by write_comment(), write_particle_data_table(), and ~IO_Ascii().

bool HepMC::IO_Ascii::search_for_key_end ( std::istream &  in,
const char *  key 
) [protected]

look for line type (key)

reads characters from in until the string of characters matching key is found (success) or EOF is reached (failure). It stops immediately thereafter. Returns T/F for success/fail

Definition at line 485 of file IO_Ascii.cc.

Referenced by fill_next_event(), fill_particle_data_table(), and search_for_key_beginning().

bool HepMC::IO_Ascii::search_for_key_beginning ( std::istream &  in,
const char *  key 
) [protected]

not tested and NOT used anywhere!

not tested and NOT used anywhere!

Definition at line 501 of file IO_Ascii.cc.

References search_for_key_end().

bool HepMC::IO_Ascii::eat_key ( std::iostream &  in,
const char *  key 
) [protected]

string manipulation accounting

eats the character string key from istream in - only if the key is the very next occurence in the stream if the key is not the next occurence, it eats nothing ... i.e. it puts back whatever it would have eaten.

Definition at line 515 of file IO_Ascii.cc.

Referenced by fill_next_event(), and fill_particle_data_table().

int HepMC::IO_Ascii::find_in_map ( const std::map< GenVertex *, int > &  m,
GenVertex v 
) const [protected]

find this vertex in the map of vertices

Definition at line 544 of file IO_Ascii.cc.

References v.

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

write double

Definition at line 130 of file IO_Ascii.h.

Referenced by write_event(), write_particle(), write_particle_data(), and write_vertex().

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

write int

Definition at line 137 of file IO_Ascii.h.

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

write long int

Definition at line 138 of file IO_Ascii.h.

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

write a single character

Definition at line 139 of file IO_Ascii.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 5 13:25:47 2008 for HepMC by  doxygen 1.5.1-3