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

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

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

#include <LHEF.h>

+ Collaboration diagram for Reader:

Public Member Functions

 Reader (std::istream &is)
 
 Reader (std::string filename)
 
bool readEvent ()
 
 Reader (std::istream &is)
 
 Reader (std::string filename)
 
bool readEvent ()
 

Data Fields

int version
 
std::string outsideBlock
 
std::string headerBlock
 
HEPRUP heprup
 
std::string initComments
 
HEPEUP hepeup
 
std::string eventComments
 

Protected Member Functions

bool getline ()
 
bool currentFind (std::string str) const
 
bool getline ()
 
bool currentFind (std::string str) const
 

Protected Attributes

std::ifstream intstream
 
std::istream & file
 
std::string currentLine
 

Private Member Functions

void init ()
 
 Reader ()
 
 Reader (const Reader &)
 
Readeroperator= (const Reader &)
 
void init ()
 
 Reader ()
 
 Reader (const Reader &)
 
Readeroperator= (const Reader &)
 

Constructor & Destructor Documentation

◆ Reader() [1/8]

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 2462 of file build/outputs/include/HepMC/LHEF.h.

References Reader::init().

◆ Reader() [2/8]

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 2477 of file build/outputs/include/HepMC/LHEF.h.

References Reader::init().

◆ Reader() [3/8]

Reader ( )
private

The default constructor should never be used.

◆ Reader() [4/8]

Reader ( const Reader )
private

The copy constructor should never be used.

◆ Reader() [5/8]

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 2462 of file include/HepMC/LHEF.h.

References Reader::init().

◆ Reader() [6/8]

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 2477 of file include/HepMC/LHEF.h.

References Reader::init().

◆ Reader() [7/8]

Reader ( )
private

The default constructor should never be used.

◆ Reader() [8/8]

Reader ( const Reader )
private

The copy constructor should never be used.

Member Function Documentation

◆ currentFind() [1/2]

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

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

References Reader::currentLine.

◆ currentFind() [2/2]

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

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

References Reader::currentLine.

◆ getline() [1/2]

bool getline ( )
inlineprotected

Used internally to read a single line from the stream.

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

References Reader::currentLine, and Reader::file.

◆ getline() [2/2]

bool getline ( )
inlineprotected

Used internally to read a single line from the stream.

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

References Reader::currentLine, and Reader::file.

◆ init() [1/2]

void init ( )
inlineprivate

◆ init() [2/2]

void init ( )
inlineprivate

◆ operator=() [1/2]

Reader& operator= ( const Reader )
private

The Reader cannot be assigned to.

◆ operator=() [2/2]

Reader& operator= ( const Reader )
private

The Reader cannot be assigned to.

◆ readEvent() [1/2]

bool 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.

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

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

◆ readEvent() [2/2]

bool 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:
LHEF_example_cat.cc.

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

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

Field Documentation

◆ currentLine

std::string currentLine
protected

The last line read in from the stream in getline().

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

◆ eventComments

std::string eventComments

Additional comments found with the last read event.

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

◆ file

std::istream & file
protected

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

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

◆ headerBlock

std::string headerBlock

All lines from the header block.

Examples:
LHEF_example_cat.cc.

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

◆ hepeup

HEPEUP hepeup

The standard information about the last read event.

Examples:
LHEF_example_cat.cc.

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

◆ heprup

HEPRUP heprup

The standard init information.

Examples:
LHEF_example_cat.cc.

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

◆ initComments

std::string initComments

Additional comments found in the init block.

Examples:
LHEF_example_cat.cc.

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

◆ intstream

std::ifstream intstream
protected

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

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

◆ outsideBlock

std::string outsideBlock

All lines (since the last readEvent()) outside the header, init and event tags.

Examples:
LHEF_example_cat.cc.

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

◆ version

int version

XML file version

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


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