LCIO  "2.7.4"
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SIO::SIOReader Class Reference

Concrete implementation of LCWriter using SIO. More...

#include <SIO/SIOReader.h>

Inheritance diagram for SIO::SIOReader:
IO::LCReader

Public Member Functions

 SIOReader (int lcReaderFlag=0)
 Default constructor.
 
virtual void open (const std::vector< std::string > &filenames) throw (IO::IOException, std::exception)
 Opens a list of files for reading (read-only). More...
 
virtual void open (const std::string &filename) throw (IO::IOException, std::exception)
 Opens a file for reading (read-only). More...
 
virtual EVENT::LCRunHeaderreadNextRunHeader () throw (IO::IOException, std::exception)
 Reads the next run header from the file. More...
 
virtual EVENT::LCRunHeaderreadNextRunHeader (int accessMode) throw (IO::IOException, std::exception)
 Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More...
 
virtual EVENT::LCEventreadNextEvent () throw (IO::IOException, std::exception)
 Reads the next event from the file. More...
 
virtual EVENT::LCEventreadNextEvent (int accessMode) throw (IO::IOException, std::exception)
 Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More...
 
virtual int getNumberOfEvents () throw (IO::IOException, std::exception )
 Return the number of events in the file - the file has to be open. More...
 
virtual int getNumberOfRuns () throw (IO::IOException, std::exception )
 Return the number of runs (run headers) in the file - the file has to be open. More...
 
virtual void getRuns (EVENT::IntVec &runs)
 Return the run numbers of the runs (run headers) in the file - the file has to be open. More...
 
virtual void getEvents (EVENT::IntVec &events)
 Return the run and event numbers of the events in the file - the file has to be open. More...
 
virtual void skipNEvents (int n) throw (IO::IOException, std::exception )
 Skips the next n events from the current position. More...
 
virtual void setReadCollectionNames (const std::vector< std::string > &colnames)
 Limit the collection names that are going to be read to the subset given in the vector - all other collection will be ignored. More...
 
virtual EVENT::LCRunHeaderreadRunHeader (int runNumber) throw (IO::IOException , std::exception)
 Reads the specified runHeader from file. More...
 
virtual EVENT::LCRunHeaderreadRunHeader (int runNumber, int accessMode) throw (IO::IOException , std::exception)
 Same as LCEvent* readRunHeader(int runNumber) allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More...
 
virtual EVENT::LCEventreadEvent (int runNumber, int evtNumber) throw (IO::IOException, std::exception )
 Reads the specified event from file. More...
 
virtual EVENT::LCEventreadEvent (int runNumber, int evtNumber, int accessMode) throw (IO::IOException, std::exception )
 Same as LCEvent* readEvent(int runNumber, int evtNumber allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More...
 
virtual void close () throw (IO::IOException, std::exception)
 Closes the output file/stream etc. More...
 
virtual void registerLCEventListener (IO::LCEventListener *ls)
 Registers a listener for reading LCEvents from a stream.
 
virtual void removeLCEventListener (IO::LCEventListener *ls)
 Remove a listener for reading LCEvents from a stream.
 
virtual void registerLCRunListener (IO::LCRunListener *ls)
 Registers a listener for reading LCEventsLCRunHeaders from a stream.
 
virtual void removeLCRunListener (IO::LCRunListener *ls)
 Remove a listener for reading LCRunHeaders from a stream.
 
virtual void readStream () throw (IO::IOException, std::exception)
 Reads the input stream and notifies registered listeners according to the object type found in the stream. More...
 
virtual void readStream (int maxRecord) throw (IO::IOException, std::exception)
 Reads maxRecord from the input stream and notifies registered listeners according to the object type found in the stream. More...
 
- Public Member Functions inherited from IO::LCReader
virtual ~LCReader ()
 Destructor.
 

Protected Member Functions

void setUpHandlers ()
 
void readRecord () throw (IO::IOException , IO::EndOfDataException , std::exception)
 
void postProcessEvent ()
 
void getEventMap ()
 
void recreateEventMap ()
 

Protected Attributes

SIO_record * _dummyRecord
 
SIO_stream * _stream
 
SIORunHeaderHandler_runHandler
 
SIOEventHandler_evtHandler
 

Additional Inherited Members

- Static Public Attributes inherited from IO::LCReader
static const int directAccess = 0x00000001 << 0
 Configuration flags for the LCReader instance - to be used with LCFactory::createLCReader(). More...
 

Detailed Description

Concrete implementation of LCWriter using SIO.

Author
gaede
Version
Id:
SIOReader.h,v 1.29 2011-03-03 16:00:12 gaede Exp

Member Function Documentation

void SIO::SIOReader::close ( )
throw (IO::IOException,
std::exception
)
virtual

Closes the output file/stream etc.

Exceptions
IOException

Implements IO::LCReader.

References SIO::LCIORandomAccessMgr::clear().

void SIO::SIOReader::getEvents ( EVENT::IntVec events)
virtual

Return the run and event numbers of the events in the file - the file has to be open.

In case several input files are specified in the open() method - the run and event numbers of the events in the file that is currently open are returned. The size of the vector events will be twice the number of events, where i-th run number will be in events[2*i] and the i-th event number in events[2*i+].

Implements IO::LCReader.

References SIO::LCIORandomAccessMgr::getEventMap(), getNumberOfEvents(), and getNumberOfRuns().

int SIO::SIOReader::getNumberOfEvents ( )
throw (IO::IOException,
std::exception
)
virtual

Return the number of events in the file - the file has to be open.

In case several input files are specified in the open() method - the number of events in the file that is currently open is returned.

Implements IO::LCReader.

References SIO::LCIORandomAccessMgr::getEventMap().

Referenced by getEvents().

int SIO::SIOReader::getNumberOfRuns ( )
throw (IO::IOException,
std::exception
)
virtual

Return the number of runs (run headers) in the file - the file has to be open.

In case several input files are specified in the open() method - the number of runs (run headers) in the file that is currently open is returned.

Implements IO::LCReader.

References SIO::LCIORandomAccessMgr::getEventMap().

Referenced by getEvents(), and getRuns().

void SIO::SIOReader::getRuns ( EVENT::IntVec runs)
virtual

Return the run numbers of the runs (run headers) in the file - the file has to be open.

In case several input files are specified in the open() method - the run numbers of the runs (run headers) in the file that is currently open is returned.

Implements IO::LCReader.

References SIO::LCIORandomAccessMgr::getEventMap(), and getNumberOfRuns().

void SIO::SIOReader::open ( const std::vector< std::string > &  filenames)
throw (IO::IOException,
std::exception
)
virtual

Opens a list of files for reading (read-only).

All subsequent read operations will operate on the list, i.e. if an EOF is encountered the next file in the list will be opened and read transparently to the user.

Exceptions
IOException

Implements IO::LCReader.

void SIO::SIOReader::open ( const std::string &  filename)
throw (IO::IOException,
std::exception
)
virtual

Opens a file for reading (read-only).

Exceptions
IOException

Implements IO::LCReader.

References SIO::LCSIO::getValidSIOName().

EVENT::LCEvent * SIO::SIOReader::readEvent ( int  runNumber,
int  evtNumber 
)
throw (IO::IOException,
std::exception
)
virtual

Reads the specified event from file.

Returns NULL if the specified event hasn't been found in the file.

Exceptions
IOException

Implements IO::LCReader.

EVENT::LCEvent * SIO::SIOReader::readEvent ( int  runNumber,
int  evtNumber,
int  accessMode 
)
throw (IO::IOException,
std::exception
)
virtual

Same as LCEvent* readEvent(int runNumber, int evtNumber allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.

Exceptions
IOException

Implements IO::LCReader.

LCEvent * SIO::SIOReader::readNextEvent ( )
throw (IO::IOException,
std::exception
)
virtual

Reads the next event from the file.

Exceptions
IOException

Implements IO::LCReader.

LCEvent * SIO::SIOReader::readNextEvent ( int  accessMode)
throw (IO::IOException,
std::exception
)
virtual

Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.

Exceptions
IOException

Implements IO::LCReader.

LCRunHeader * SIO::SIOReader::readNextRunHeader ( )
throw (IO::IOException,
std::exception
)
virtual

Reads the next run header from the file.

Exceptions
IOException

Implements IO::LCReader.

LCRunHeader * SIO::SIOReader::readNextRunHeader ( int  accessMode)
throw (IO::IOException,
std::exception
)
virtual

Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.

Exceptions
IOException

Implements IO::LCReader.

EVENT::LCRunHeader * SIO::SIOReader::readRunHeader ( int  runNumber)
throw (IO::IOException ,
std::exception
)
virtual

Reads the specified runHeader from file.

Returns NULL if the specified runHeader hasn't been found in the file.

Exceptions
IOException

Implements IO::LCReader.

EVENT::LCRunHeader * SIO::SIOReader::readRunHeader ( int  runNumber,
int  accessMode 
)
throw (IO::IOException ,
std::exception
)
virtual

Same as LCEvent* readRunHeader(int runNumber) allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.

Exceptions
IOException

Implements IO::LCReader.

void SIO::SIOReader::readStream ( )
throw (IO::IOException,
std::exception
)
virtual

Reads the input stream and notifies registered listeners according to the object type found in the stream.

Exceptions
IOException
EndOfException

Implements IO::LCReader.

void SIO::SIOReader::readStream ( int  maxRecord)
throw (IO::IOException,
std::exception
)
virtual

Reads maxRecord from the input stream and notifies registered listeners according to the object type found in the stream.

Throws EndOfException if less than maxRecord records are found in the stream.

Exceptions
IOException
EndOfException

Implements IO::LCReader.

void SIO::SIOReader::setReadCollectionNames ( const std::vector< std::string > &  colnames)
virtual

Limit the collection names that are going to be read to the subset given in the vector - all other collection will be ignored.

This might improve the reading performance considerably in cases where only a small subset of the collections in the event is needed.

Implements IO::LCReader.

void SIO::SIOReader::skipNEvents ( int  n)
throw (IO::IOException,
std::exception
)
virtual

Skips the next n events from the current position.

In fact simply reads the next n event headers so that the next event read is the (n+1)-th event.

Implements IO::LCReader.


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