LHEF  3.0(beta)
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
LHEF::Writer Class Reference

The Writer class is initialized with a stream to which to write a version 1.0 Les Houches Accord event file. More...

#include <LHEF.h>

Public Member Functions

 Writer (std::ostream &os)
 Create a Writer object giving a stream to write to.
 
 Writer (std::string filename)
 Create a Writer object giving a filename to write to.
 
 ~Writer ()
 The destructor writes out the final XML end-tag.
 
std::ostream & headerBlock ()
 Add header lines consisting of XML code with this stream.
 
std::ostream & initComments ()
 Add comment lines to the init block with this stream.
 
std::ostream & eventComments ()
 Add comment lines to the next event to be written out with this stream.
 
void init ()
 Write out an optional header block followed by the standard init block information together with any comment lines.
 
void writeEvent ()
 Write the current HEPEUP object to the stream;.
 

Public Attributes

std::ostringstream headerStream
 Stream to add all lines in the header block.
 
HEPRUP heprup
 The standard init information.
 
std::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.
 
std::ostringstream eventStream
 Stream to add additional comments to be written together the next event.
 

Protected Attributes

std::ofstream intstream
 A local stream which is unused if a stream is supplied from the outside.
 
std::ostream & file
 The stream we are writing to.
 

Private Member Functions

 Writer ()
 The default constructor should never be used.
 
 Writer (const Writer &)
 The copy constructor should never be used.
 
Writeroperator= (const Writer &)
 The Writer cannot be assigned to.
 

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:
LHEFCat.cc.

Definition at line 2712 of file LHEF.h.

Constructor & Destructor Documentation

LHEF::Writer::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 2720 of file LHEF.h.

LHEF::Writer::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 2727 of file LHEF.h.

Member Data Documentation

std::ostream& LHEF::Writer::file
protected

The stream we are writing to.

This may be a reference to an external stream or the internal intstream.

Definition at line 2811 of file LHEF.h.

Referenced by init(), writeEvent(), and ~Writer().


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