HepMC event record
Public Member Functions | Data Fields | Protected Attributes | Private Member Functions
Writer Class Reference

Detailed Description

The Writer class is initialized with a stream to which to write a version 1.0 Les Houches Accord event file. In the constructor of the Writer object the main XML tag is written out, with the corresponding end tag is written in the destructor. After a Writer object has been created, it is possible to assign standard init information in the heprup member variable. In addition any XML formatted information can be added to the headerBlock member variable (directly or via the addHeader() function). Further comment line (beginning with a # character) can be added to the initComments variable (directly or with the addInitComment() function). After this information is set, it should be written out to the file with the init() function.

Before each event is written out with the writeEvent() function, the standard event information can then be assigned to the hepeup variable and optional comment lines (beginning with a # character) may be given to the eventComments variable (directly or with the addEventComment() function).

Examples:
LHEF_example_cat.cc.

Definition at line 2723 of file build/outputs/include/HepMC/LHEF.h.

#include <LHEF.h>

+ Collaboration diagram for Writer:

Public Member Functions

 Writer (std::ostream &os)
 
 Writer (std::string filename)
 
 ~Writer ()
 
std::ostream & headerBlock ()
 
std::ostream & initComments ()
 
std::ostream & eventComments ()
 
void init ()
 
void writeEvent ()
 
 Writer (std::ostream &os)
 
 Writer (std::string filename)
 
 ~Writer ()
 
std::ostream & headerBlock ()
 
std::ostream & initComments ()
 
std::ostream & eventComments ()
 
void init ()
 
void writeEvent ()
 

Data Fields

std::ostringstream headerStream
 
HEPRUP heprup
 
std::ostringstream initStream
 
HEPEUP hepeup
 
std::ostringstream eventStream
 

Protected Attributes

std::ofstream intstream
 
std::ostream & file
 

Private Member Functions

 Writer ()
 
 Writer (const Writer &)
 
Writeroperator= (const Writer &)
 
 Writer ()
 
 Writer (const Writer &)
 
Writeroperator= (const Writer &)
 

Constructor & Destructor Documentation

◆ Writer() [1/8]

Writer ( std::ostream &  os)
inline

Create a Writer object giving a stream to write to.

Parameters
osthe stream where the event file is written.

Definition at line 2731 of file build/outputs/include/HepMC/LHEF.h.

◆ Writer() [2/8]

Writer ( std::string  filename)
inline

Create a Writer object giving a filename to write to.

Parameters
filenamethe name of the event file to be written.

Definition at line 2738 of file build/outputs/include/HepMC/LHEF.h.

◆ ~Writer() [1/2]

~Writer ( )
inline

The destructor writes out the final XML end-tag.

Definition at line 2744 of file build/outputs/include/HepMC/LHEF.h.

References Writer::file.

◆ Writer() [3/8]

Writer ( )
private

The default constructor should never be used.

◆ Writer() [4/8]

Writer ( const Writer )
private

The copy constructor should never be used.

◆ Writer() [5/8]

Writer ( std::ostream &  os)
inline

Create a Writer object giving a stream to write to.

Parameters
osthe stream where the event file is written.

Definition at line 2731 of file include/HepMC/LHEF.h.

◆ Writer() [6/8]

Writer ( std::string  filename)
inline

Create a Writer object giving a filename to write to.

Parameters
filenamethe name of the event file to be written.

Definition at line 2738 of file include/HepMC/LHEF.h.

◆ ~Writer() [2/2]

~Writer ( )
inline

The destructor writes out the final XML end-tag.

Definition at line 2744 of file include/HepMC/LHEF.h.

References Writer::file.

◆ Writer() [7/8]

Writer ( )
private

The default constructor should never be used.

◆ Writer() [8/8]

Writer ( const Writer )
private

The copy constructor should never be used.

Member Function Documentation

◆ eventComments() [1/2]

std::ostream& eventComments ( )
inline

Add comment lines to the next event to be written out with this stream.

Examples:
LHEF_example_cat.cc.

Definition at line 2765 of file build/outputs/include/HepMC/LHEF.h.

References Writer::eventStream.

◆ eventComments() [2/2]

std::ostream& eventComments ( )
inline

Add comment lines to the next event to be written out with this stream.

Definition at line 2765 of file include/HepMC/LHEF.h.

References Writer::eventStream.

◆ headerBlock() [1/2]

std::ostream& headerBlock ( )
inline

Add header lines consisting of XML code with this stream.

Examples:
LHEF_example_cat.cc.

Definition at line 2751 of file build/outputs/include/HepMC/LHEF.h.

References Writer::headerStream.

◆ headerBlock() [2/2]

std::ostream& headerBlock ( )
inline

Add header lines consisting of XML code with this stream.

Definition at line 2751 of file include/HepMC/LHEF.h.

References Writer::headerStream.

◆ init() [1/2]

void init ( )
inline

Write out an optional header block followed by the standard init block information together with any comment lines.

Examples:
LHEF_example_cat.cc.

Definition at line 2773 of file build/outputs/include/HepMC/LHEF.h.

References Writer::file, Writer::headerStream, Writer::heprup, HEPRUP::print(), and HEPRUP::version.

◆ init() [2/2]

void init ( )
inline

Write out an optional header block followed by the standard init block information together with any comment lines.

Definition at line 2773 of file include/HepMC/LHEF.h.

References Writer::file, Writer::headerStream, Writer::heprup, HEPRUP::print(), and HEPRUP::version.

◆ initComments() [1/2]

std::ostream& initComments ( )
inline

Add comment lines to the init block with this stream.

Definition at line 2758 of file include/HepMC/LHEF.h.

References Writer::initStream.

◆ initComments() [2/2]

std::ostream& initComments ( )
inline

Add comment lines to the init block with this stream.

Definition at line 2758 of file build/outputs/include/HepMC/LHEF.h.

References Writer::initStream.

◆ operator=() [1/2]

Writer& operator= ( const Writer )
private

The Writer cannot be assigned to.

◆ operator=() [2/2]

Writer& operator= ( const Writer )
private

The Writer cannot be assigned to.

◆ writeEvent() [1/2]

void writeEvent ( )
inline

Write the current HEPEUP object to the stream;

Examples:
LHEF_example_cat.cc.

Definition at line 2806 of file build/outputs/include/HepMC/LHEF.h.

References Writer::file, Writer::hepeup, and HEPEUP::print().

◆ writeEvent() [2/2]

void writeEvent ( )
inline

Write the current HEPEUP object to the stream;

Definition at line 2806 of file include/HepMC/LHEF.h.

References Writer::file, Writer::hepeup, and HEPEUP::print().

Field Documentation

◆ eventStream

std::ostringstream eventStream

Stream to add additional comments to be written together the next event.

Definition at line 2849 of file build/outputs/include/HepMC/LHEF.h.

◆ file

std::ostream & file
protected

The stream we are writing to. This may be a reference to an external stream or the internal intstream.

Definition at line 2822 of file build/outputs/include/HepMC/LHEF.h.

◆ headerStream

std::ostringstream headerStream

Stream to add all lines in the header block.

Definition at line 2829 of file build/outputs/include/HepMC/LHEF.h.

◆ hepeup

HEPEUP hepeup

The standard information about the event we will write next.

Examples:
LHEF_example_cat.cc.

Definition at line 2844 of file build/outputs/include/HepMC/LHEF.h.

◆ heprup

HEPRUP heprup

The standard init information.

Examples:
LHEF_example_cat.cc.

Definition at line 2834 of file build/outputs/include/HepMC/LHEF.h.

◆ initStream

std::ostringstream initStream

Stream to add additional comments to be put in the init block.

Definition at line 2839 of file build/outputs/include/HepMC/LHEF.h.

◆ intstream

std::ofstream intstream
protected

A local stream which is unused if a stream is supplied from the outside.

Definition at line 2816 of file build/outputs/include/HepMC/LHEF.h.


The documentation for this class was generated from the following file: