PYTHIA  8.312
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Writer Class Reference

#include <LHEF3.h>

Public Member Functions

 Writer (ostream &os)
 
 Writer (string filename)
 
 ~Writer ()
 The destructor.
 
ostream & headerBlock ()
 Add header lines consisting of XML code with this stream.
 
ostream & initComments ()
 Add comment lines to the init block with this stream.
 
ostream & eventComments ()
 Add comment lines to the next event to be written out with this stream.
 
void list_end_tag ()
 Write out the final XML end-tag.
 
void init ()
 
bool writeEvent (HEPEUP *peup=0, int pDigits=15)
 
string getEventString (HEPEUP *peup=0)
 Write out an event as a string. More...
 

Public Attributes

ostringstream headerStream
 Stream to add all lines in the header block.
 
HEPRUP heprup
 The standard init information.
 
ostringstream initStream
 Stream to add additional comments to be put in the init block.
 
HEPEUP hepeup
 The standard information about the event we will write next.
 
ostringstream eventStream
 Stream to add additional comments to be written together the next event.
 
int version
 XML file version.
 

Protected Member Functions

string hashline (string s, bool comment=false)
 

Protected Attributes

ofstream intstream
 
ostream & file
 

Detailed Description

The Writer class is initialized with a stream to which to write a version 1.0 or 3.0 Les Houches Accord event file. In the init() function of the Writer object the main XML tag, header and init blocks are written, with the corresponding end tag is written by list_end_tag(). After a Writer object (in the following called "writer") has been created, it is possible to assign version (3 by default) information by

writer.version =

;

The header block (called "someHeaderString" below) is assigned by

writer.headerBlock() << someHeaderString;

and the init block comments (called "someInitString" below) are assigned via

writer.initComments() << someInitString;

The standard init information (including amendments for LHEF 3.0) can be assigned by the heprup member variable:

writer.heprup = heprup;

where heprup is an object of type HEPRUP. All of the above information will be writen by calling the init() function.

Before each event is written out with the writeEvent() function, the standard event information can be assigned to the hepeup variable by

writer.hepeup = hepeup;

where hepeup is of type HEPEUP. Event comments (called "someCommentString" below) can be assigned through

writer.eventComments() << someCommentString;

All of this event information is written by the writeEvent() function.

Constructor & Destructor Documentation

Writer ( ostream &  os)
inline

Create a Writer object giving a stream to write to.

Parameters
osthe stream where the event file is written.
Writer ( string  filename)
inline

Create a Writer object giving a filename to write to.

Parameters
filenamethe name of the event file to be written.

Member Function Documentation

string getEventString ( HEPEUP peup = 0)

Write out an event as a string.

Write event comments.

event = helperString.c_str();

string hashline ( string  s,
bool  comment = false 
)
protected

Make sure that each line in the string s starts with a #-character and that the string ends with a new-line.

Make sure that each line in the string s starts with a #-character and that the string ends with a new-line.

void init ( )

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

The Writer class is initialized with a stream to which to write a version 3.0 Les Houches Accord event file. Write out an optional header block followed by the standard init block information together with any comment lines.

Write out the standard XML tag for the event file.

Print headercomments and header init information.

bool writeEvent ( HEPEUP peup = 0,
int  pDigits = 15 
)

Write out the event stored in hepeup, followed by optional comment lines.

Write event comments.

Member Data Documentation

ostream& file
protected

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

ofstream intstream
protected

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


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