#include <IO_GenEvent.h>
Inheritance diagram for HepMC::IO_GenEvent:
Public Member Functions | |
IO_GenEvent (const char *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) |
insert a comment directly into the output file --- normally you only want to do this at the beginning or end of the file. | |
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 | |
GenEvent * | read_next_event () |
do not over-ride | |
ParticleDataTable * | read_particle_data_table () |
do not over-ride | |
virtual GenEvent *& | operator>> (GenEvent *&) |
the same as read_next_event | |
virtual ParticleDataTable *& | operator>> (ParticleDataTable *&) |
the same as read_particle_data_table | |
virtual const GenEvent *& | operator<< (const GenEvent *&) |
the same as write_event | |
virtual GenEvent *& | operator<< (GenEvent *&) |
the same as write_event | |
virtual const ParticleDataTable *& | operator<< (const ParticleDataTable *&) |
the same as write_particle_data_table | |
virtual ParticleDataTable *& | operator<< (ParticleDataTable *&) |
the same as write_particle_data_table | |
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_particle (GenParticle *p) |
write particle information | |
void | write_particle_data (const ParticleData *d) |
write particle data information | |
GenVertex * | read_vertex (TempParticleMap &particle_to_end_vertex) |
read vertex information | |
GenParticle * | read_particle (TempParticleMap &particle_to_end_vertex) |
read GenParticle information | |
ParticleData * | read_particle_data (ParticleDataTable *) |
read particle data table information | |
HeavyIon * | read_heavy_ion () |
read heavy ion information | |
PdfInfo * | read_pdf_info () |
read PDF information | |
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 | |
Private Member Functions | |
IO_GenEvent (const IO_GenEvent &) | |
Private Attributes | |
std::ios::openmode | m_mode |
std::fstream | m_file |
std::ostream * | m_ostr |
std::istream * | m_istr |
std::ios * | m_iostr |
bool | m_finished_first_event_io |
bool | m_have_file |
CommonIO | m_common_io |
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. ExtendedAscii ignores particle data blocks Comments may appear anywhere in the file -- so long as they do not contain any of the start/stop keys.
Definition at line 65 of file IO_GenEvent.h.
HepMC::IO_GenEvent::IO_GenEvent | ( | const char * | filename = "IO_GenEvent.dat" , |
|
std::ios::openmode | mode = std::ios::out | |||
) |
constructor requiring a file name and std::ios mode
HepMC::IO_GenEvent::IO_GenEvent | ( | std::istream & | ) |
constructor requiring an input stream
HepMC::IO_GenEvent::IO_GenEvent | ( | std::ostream & | ) |
constructor requiring an output stream
virtual HepMC::IO_GenEvent::~IO_GenEvent | ( | ) | [virtual] |
HepMC::IO_GenEvent::IO_GenEvent | ( | const IO_GenEvent & | ) | [inline, private] |
void HepMC::IO_GenEvent::write_event | ( | const GenEvent * | evt | ) | [virtual] |
bool HepMC::IO_GenEvent::fill_next_event | ( | GenEvent * | evt | ) | [virtual] |
void HepMC::IO_GenEvent::write_particle_data_table | ( | const ParticleDataTable * | ) | [inline, virtual] |
write this ParticleDataTable
Implements HepMC::IO_BaseClass.
Definition at line 203 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 204 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"
int HepMC::IO_GenEvent::rdstate | ( | ) | const [inline] |
check the state of the IO stream
Definition at line 186 of file IO_GenEvent.h.
00186 { 00187 int state; 00188 if( m_istr ) { 00189 state = (int)m_istr->rdstate(); 00190 } else { 00191 state = (int)m_ostr->rdstate(); 00192 } 00193 return state; 00194 }
void HepMC::IO_GenEvent::clear | ( | ) | [inline] |
clear the IO stream
Definition at line 195 of file IO_GenEvent.h.
00195 { 00196 if( m_istr ) { 00197 m_istr->clear(); 00198 } else { 00199 m_ostr->clear(); 00200 } 00201 }
void HepMC::IO_GenEvent::print | ( | std::ostream & | ostr = std::cout |
) | const [virtual] |
void HepMC::IO_GenEvent::write_vertex | ( | GenVertex * | ) | [protected] |
write vertex information
void HepMC::IO_GenEvent::write_beam_particles | ( | std::pair< HepMC::GenParticle *, HepMC::GenParticle * > | ) | [protected] |
write beam particle information
void HepMC::IO_GenEvent::write_heavy_ion | ( | HeavyIon const * | ) | [protected] |
write heavy ion information
void HepMC::IO_GenEvent::write_pdf_info | ( | PdfInfo const * | ) | [protected] |
write PDF information
void HepMC::IO_GenEvent::write_particle | ( | GenParticle * | p | ) | [protected] |
write particle information
void HepMC::IO_GenEvent::write_particle_data | ( | const ParticleData * | d | ) | [protected] |
write particle data information
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
ParticleData* HepMC::IO_GenEvent::read_particle_data | ( | ParticleDataTable * | ) | [protected] |
read particle data table information
HeavyIon* HepMC::IO_GenEvent::read_heavy_ion | ( | ) | [protected] |
read heavy ion information
PdfInfo* HepMC::IO_GenEvent::read_pdf_info | ( | ) | [protected] |
read PDF information
bool HepMC::IO_GenEvent::write_end_listing | ( | ) | [protected] |
write end tag
void HepMC::IO_GenEvent::output | ( | const double & | ) | [inline, protected] |
write double
Definition at line 141 of file IO_GenEvent.h.
00141 { 00142 if( m_ostr ) { 00143 if ( d == 0. ) { 00144 *m_ostr << ' ' << (int)0; 00145 } else { 00146 *m_ostr << ' ' << d; 00147 } 00148 } 00149 }
void HepMC::IO_GenEvent::output | ( | const float & | ) | [inline, protected] |
write float
Definition at line 150 of file IO_GenEvent.h.
00150 { 00151 if( m_ostr ) { 00152 if ( d == 0. ) { 00153 *m_ostr << ' ' << (int)0; 00154 } else { 00155 *m_ostr << ' ' << d; 00156 } 00157 } 00158 }
void HepMC::IO_GenEvent::output | ( | const int & | ) | [inline, protected] |
write int
Definition at line 159 of file IO_GenEvent.h.
00159 { 00160 if( m_ostr ) { 00161 if ( i == 0. ) { 00162 *m_ostr << ' ' << (int)0; 00163 } else { 00164 *m_ostr << ' ' << i; 00165 } 00166 } 00167 }
void HepMC::IO_GenEvent::output | ( | const long & | ) | [inline, protected] |
write long
Definition at line 168 of file IO_GenEvent.h.
00168 { 00169 if( m_ostr ) { 00170 if ( i == 0. ) { 00171 *m_ostr << ' ' << (int)0; 00172 } else { 00173 *m_ostr << ' ' << i; 00174 } 00175 } 00176 }
void HepMC::IO_GenEvent::output | ( | const char & | ) | [inline, protected] |
write a single character
Definition at line 177 of file IO_GenEvent.h.
00177 { 00178 if( m_ostr ) { 00179 if ( c ) { 00180 *m_ostr << c; 00181 } else { 00182 *m_ostr << ' ' ; 00183 } 00184 } 00185 }
GenEvent * HepMC::IO_BaseClass::read_next_event | ( | ) | [inline, inherited] |
do not over-ride
creates a new event and fills it by calling the sister method read_next_event( GenEvent* )
Definition at line 87 of file IO_BaseClass.h.
00087 { 00090 // 00091 // 1. create an empty event container 00092 GenEvent* evt = new GenEvent(); 00093 // 2. fill the evt container - if the read is successful, return the 00094 // pointer, otherwise return null and delete the evt 00095 if ( fill_next_event( evt ) ) return evt; 00096 // note: the below delete is only reached if read fails 00097 // ... thus there is not much overhead in new then delete 00098 // since this statement is rarely reached 00099 delete evt; 00100 return 0; 00101 }
ParticleDataTable * HepMC::IO_BaseClass::read_particle_data_table | ( | ) | [inline, inherited] |
do not over-ride
creates a new particle data table and fills it by calling the sister method read_particle_data_table( ParticleDataTable* )
Definition at line 103 of file IO_BaseClass.h.
00103 { 00106 // 00107 // 1. create an empty pdt 00108 ParticleDataTable* pdt = new ParticleDataTable(); 00109 // 2. fill the pdt container - if the read is successful, return the 00110 // pointer, otherwise return null and delete the evt 00111 if ( fill_particle_data_table( pdt ) ) return pdt; 00112 // next statement is only reached if read fails 00113 delete pdt; 00114 return 0; 00115 }
the same as read_next_event
Definition at line 121 of file IO_BaseClass.h.
00121 { 00122 evt = read_next_event(); 00123 return evt; 00124 }
ParticleDataTable *& HepMC::IO_BaseClass::operator>> | ( | ParticleDataTable *& | ) | [inline, virtual, inherited] |
the same as read_particle_data_table
Definition at line 137 of file IO_BaseClass.h.
00138 { 00139 pdt = read_particle_data_table(); 00140 return pdt; 00141 }
const GenEvent *& HepMC::IO_BaseClass::operator<< | ( | const GenEvent *& | ) | [inline, virtual, inherited] |
the same as write_event
Definition at line 126 of file IO_BaseClass.h.
00127 { 00128 write_event( evt ); 00129 return evt; 00130 }
the same as write_event
Definition at line 132 of file IO_BaseClass.h.
00132 { 00133 write_event( evt ); 00134 return evt; 00135 }
const ParticleDataTable *& HepMC::IO_BaseClass::operator<< | ( | const ParticleDataTable *& | ) | [inline, virtual, inherited] |
the same as write_particle_data_table
Definition at line 143 of file IO_BaseClass.h.
00144 { 00145 write_particle_data_table( pdt ); 00146 return pdt; 00147 }
ParticleDataTable *& HepMC::IO_BaseClass::operator<< | ( | ParticleDataTable *& | ) | [inline, virtual, inherited] |
the same as write_particle_data_table
Definition at line 149 of file IO_BaseClass.h.
00150 { 00151 write_particle_data_table( pdt ); 00152 return pdt; 00153 }
std::ios::openmode HepMC::IO_GenEvent::m_mode [private] |
Definition at line 127 of file IO_GenEvent.h.
std::fstream HepMC::IO_GenEvent::m_file [private] |
Definition at line 128 of file IO_GenEvent.h.
std::ostream* HepMC::IO_GenEvent::m_ostr [private] |
Definition at line 129 of file IO_GenEvent.h.
std::istream* HepMC::IO_GenEvent::m_istr [private] |
Definition at line 130 of file IO_GenEvent.h.
std::ios* HepMC::IO_GenEvent::m_iostr [private] |
Definition at line 131 of file IO_GenEvent.h.
bool HepMC::IO_GenEvent::m_finished_first_event_io [private] |
Definition at line 132 of file IO_GenEvent.h.
bool HepMC::IO_GenEvent::m_have_file [private] |
Definition at line 133 of file IO_GenEvent.h.
CommonIO HepMC::IO_GenEvent::m_common_io [private] |
Definition at line 134 of file IO_GenEvent.h.