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

The Reader class is initialized with a stream from which to read a version 1/2 Les Houches Accord event file. More...

#include <LHEF.h>

Public Member Functions

 Reader (std::istream &is)
 Initialize the Reader with a stream from which to read an event file.
 
 Reader (std::string filename)
 Initialize the Reader with a filename from which to read an event file.
 
bool readEvent ()
 Read an event from the file and store it in the hepeup object.
 

Public Attributes

int version
 XML file version.
 
std::string outsideBlock
 All lines (since the last readEvent()) outside the header, init and event tags.
 
std::string headerBlock
 All lines from the header block.
 
HEPRUP heprup
 The standard init information.
 
std::string initComments
 Additional comments found in the init block.
 
HEPEUP hepeup
 The standard information about the last read event.
 
std::string eventComments
 Additional comments found with the last read event.
 

Protected Member Functions

bool getline ()
 Used internally to read a single line from the stream.
 
bool currentFind (std::string str) const
 

Protected Attributes

std::ifstream intstream
 A local stream which is unused if a stream is supplied from the outside.
 
std::istream & file
 The stream we are reading from.
 
std::string currentLine
 The last line read in from the stream in getline().
 

Private Member Functions

void init ()
 Used internally in the constructors to read header and init blocks.
 
 Reader ()
 The default constructor should never be used.
 
 Reader (const Reader &)
 The copy constructor should never be used.
 
Readeroperator= (const Reader &)
 The Reader cannot be assigned to.
 

Detailed Description

The Reader class is initialized with a stream from which to read a version 1/2 Les Houches Accord event file.

In the constructor of the Reader object the optional header information is read and then the mandatory init is read. After this the whole header block including the enclosing lines with tags are available in the public headerBlock member variable. Also the information from the init block is available in the heprup member variable and any additional comment lines are available in initComments. After each successful call to the readEvent() function the standard Les Houches Accord information about the event is available in the hepeup member variable and any additional comments in the eventComments variable. A typical reading sequence would look as follows:

Examples:
LHEFCat.cc.

Definition at line 2437 of file LHEF.h.

Constructor & Destructor Documentation

LHEF::Reader::Reader ( std::istream &  is)
inline

Initialize the Reader with a stream from which to read an event file.

After the constructor is called the whole header block including the enclosing lines with tags are available in the public headerBlock member variable. Also the information from the init block is available in the heprup member variable and any additional comment lines are available in initComments.

Parameters
isthe stream to read from.

Definition at line 2451 of file LHEF.h.

References init().

LHEF::Reader::Reader ( std::string  filename)
inline

Initialize the Reader with a filename from which to read an event file.

After the constructor is called the whole header block including the enclosing lines with tags are available in the public headerBlock member variable. Also the information from the init block is available in the heprup member variable and any additional comment lines are available in initComments.

Parameters
filenamethe name of the file to read from.

Definition at line 2466 of file LHEF.h.

References init().

Member Function Documentation

bool LHEF::Reader::currentFind ( std::string  str) const
inlineprotected
Returns
true if the current line contains the given string.

Definition at line 2611 of file LHEF.h.

References currentLine.

Referenced by init(), and readEvent().

bool LHEF::Reader::readEvent ( )
inline

Read an event from the file and store it in the hepeup object.

Optional comment lines are stored i the eventComments member variable.

Returns
true if the read sas successful.
Examples:
LHEFCat.cc.

Definition at line 2553 of file LHEF.h.

References currentFind(), currentLine, LHEF::XMLTag::deleteAll(), LHEF::XMLTag::findXMLTags(), getline(), hepeup, heprup, LHEF::HEPRUP::NPRUP, and outsideBlock.

Member Data Documentation

std::istream& LHEF::Reader::file
protected

The stream we are reading from.

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

Definition at line 2627 of file LHEF.h.

Referenced by getline().


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