LCIO
02.17
|
Concrete implementation of LCWriter using SIO. More...
#include <SIOReader.h>
Public Member Functions | |
SIOReader (int lcReaderFlag=0) | |
Default constructor. More... | |
SIOReader (const SIOReader &)=delete | |
no copy constructor More... | |
SIOReader & | operator= (const SIOReader &)=delete |
no assignment operator More... | |
virtual | ~SIOReader () |
Destructor. More... | |
void | open (const std::vector< std::string > &filenames) override |
Opens a list of files for reading (read-only). More... | |
void | open (const std::string &filename) override |
Opens a file for reading (read-only). More... | |
EVENT::LCRunHeader * | readNextRunHeader () override |
Reads the next run header from the file. More... | |
EVENT::LCRunHeader * | readNextRunHeader (int accessMode) override |
Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More... | |
EVENT::LCEvent * | readNextEvent () override |
Reads the next event from the file. More... | |
EVENT::LCEvent * | readNextEvent (int accessMode) override |
Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More... | |
int | getNumberOfEvents () override |
Return the number of events in the file - the file has to be open. More... | |
int | getNumberOfRuns () override |
Return the number of runs (run headers) in the file - the file has to be open. More... | |
void | getRuns (EVENT::IntVec &runs) override |
Return the run numbers of the runs (run headers) in the file - the file has to be open. More... | |
void | getEvents (EVENT::IntVec &events) override |
Return the run and event numbers of the events in the file - the file has to be open. More... | |
void | skipNEvents (int n) override |
Skips the next n events from the current position. More... | |
void | setReadCollectionNames (const std::vector< std::string > &colnames) override |
Limit the collection names that are going to be read to the subset given in the vector - all other collection will be ignored. More... | |
EVENT::LCRunHeader * | readRunHeader (int runNumber) override |
Reads the specified runHeader from file. More... | |
EVENT::LCRunHeader * | readRunHeader (int runNumber, int accessMode) override |
Same as LCEvent* readRunHeader(int runNumber) allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More... | |
EVENT::LCEvent * | readEvent (int runNumber, int evtNumber) override |
Reads the specified event from file. More... | |
EVENT::LCEvent * | readEvent (int runNumber, int evtNumber, int accessMode) override |
Same as LCEvent* readEvent(int runNumber, int evtNumber allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update. More... | |
void | close () override |
Closes the output file/stream etc. More... | |
void | registerLCEventListener (IO::LCEventListener *ls) override |
Registers a listener for reading LCEvents from a stream. More... | |
void | removeLCEventListener (IO::LCEventListener *ls) override |
Remove a listener for reading LCEvents from a stream. More... | |
void | registerLCRunListener (IO::LCRunListener *ls) override |
Registers a listener for reading LCEventsLCRunHeaders from a stream. More... | |
void | removeLCRunListener (IO::LCRunListener *ls) override |
Remove a listener for reading LCRunHeaders from a stream. More... | |
void | readStream () override |
Reads the input stream and notifies registered listeners according to the object type found in the stream. More... | |
void | readStream (int maxRecord) override |
Reads maxRecord from the input stream and notifies registered listeners according to the object type found in the stream. More... | |
![]() | |
virtual | ~LCReader () |
Destructor. More... | |
Private Member Functions | |
void | processEvent (std::shared_ptr< EVENT::LCEvent > event) override |
void | processRunHeader (std::shared_ptr< EVENT::LCRunHeader > hdr) override |
![]() | |
virtual | ~LCReaderListener () |
Destructor. More... | |
virtual void | processEvent (LCEventPtr event)=0 |
process an event More... | |
virtual void | processRunHeader (LCRunHeaderPtr hdr)=0 |
process a run header More... | |
Private Attributes | |
MT::LCReader | _reader |
The underlying implementation of the LCReader. More... | |
std::set< IO::LCRunListener * > | _runListeners {} |
The run listeners. More... | |
std::set< IO::LCEventListener * > | _evtListeners {} |
The event listeners. More... | |
EVENT::LCEvent * | _currentEvent = nullptr |
pointer to current Event More... | |
EVENT::LCRunHeader * | _currentRun = nullptr |
pointer to current RunHeader More... | |
Additional Inherited Members | |
![]() | |
static const int | directAccess = 0x00000001 << 0 |
Configuration flags for the LCReader instance - to be used with LCFactory::createLCReader(). More... | |
Concrete implementation of LCWriter using SIO.
Definition at line 31 of file SIOReader.h.
SIO::SIOReader::SIOReader | ( | int | lcReaderFlag = 0 | ) |
Default constructor.
Definition at line 22 of file SIOReader.cc.
|
delete |
no copy constructor
|
virtual |
Destructor.
Definition at line 29 of file SIOReader.cc.
|
overridevirtual |
Closes the output file/stream etc.
IOException |
Implements IO::LCReader.
Definition at line 155 of file SIOReader.cc.
References _reader, and MT::LCReader::close().
|
overridevirtual |
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.
Definition at line 71 of file SIOReader.cc.
References _reader, and MT::LCReader::getEvents().
|
overridevirtual |
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.
Definition at line 53 of file SIOReader.cc.
References _reader, and MT::LCReader::getNumberOfEvents().
|
overridevirtual |
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.
Definition at line 59 of file SIOReader.cc.
References _reader, and MT::LCReader::getNumberOfRuns().
|
overridevirtual |
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.
Definition at line 65 of file SIOReader.cc.
References _reader, and MT::LCReader::getRuns().
|
overridevirtual |
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.
IOException |
Implements IO::LCReader.
Definition at line 41 of file SIOReader.cc.
References _reader, and MT::LCReader::open().
|
overridevirtual |
Opens a file for reading (read-only).
IOException |
Implements IO::LCReader.
Definition at line 47 of file SIOReader.cc.
References _reader, and MT::LCReader::open().
|
overrideprivate |
Definition at line 197 of file SIOReader.cc.
References _evtListeners, std::set< K >::begin(), and std::set< K >::end().
|
overrideprivate |
Definition at line 211 of file SIOReader.cc.
References _runListeners, std::set< K >::begin(), std::set< K >::end(), and std::shared_ptr::get().
|
overridevirtual |
Reads the specified event from file.
Returns NULL if the specified event hasn't been found in the file.
IOException |
Implements IO::LCReader.
Definition at line 137 of file SIOReader.cc.
|
overridevirtual |
Same as LCEvent* readEvent(int runNumber, int evtNumber allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
IOException |
Implements IO::LCReader.
Definition at line 143 of file SIOReader.cc.
References _currentEvent, _reader, and MT::LCReader::readEvent().
|
overridevirtual |
Reads the next event from the file.
IOException |
Implements IO::LCReader.
Definition at line 95 of file SIOReader.cc.
|
overridevirtual |
Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
IOException |
Implements IO::LCReader.
Definition at line 101 of file SIOReader.cc.
References _currentEvent, _reader, and MT::LCReader::readNextEvent().
|
overridevirtual |
Reads the next run header from the file.
IOException |
Implements IO::LCReader.
Definition at line 77 of file SIOReader.cc.
|
overridevirtual |
Same as readNextRunHeader() but allows to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
IOException |
Implements IO::LCReader.
Definition at line 83 of file SIOReader.cc.
References _currentRun, _reader, and MT::LCReader::readNextRunHeader().
|
overridevirtual |
Reads the specified runHeader from file.
Returns NULL if the specified runHeader hasn't been found in the file.
IOException |
Implements IO::LCReader.
Definition at line 119 of file SIOReader.cc.
|
overridevirtual |
Same as LCEvent* readRunHeader(int runNumber) allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
IOException |
Implements IO::LCReader.
Definition at line 125 of file SIOReader.cc.
References _currentRun, _reader, and MT::LCReader::readRunHeader().
|
overridevirtual |
Reads the input stream and notifies registered listeners according to the object type found in the stream.
IOException | |
EndOfException |
Implements IO::LCReader.
Definition at line 185 of file SIOReader.cc.
|
overridevirtual |
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.
IOException | |
EndOfException |
Implements IO::LCReader.
Definition at line 191 of file SIOReader.cc.
References _reader, and MT::LCReader::readStream().
|
overridevirtual |
Registers a listener for reading LCEvents from a stream.
Implements IO::LCReader.
Definition at line 161 of file SIOReader.cc.
References _evtListeners, std::set< K >::end(), and std::set< K >::insert().
|
overridevirtual |
Registers a listener for reading LCEventsLCRunHeaders from a stream.
Implements IO::LCReader.
Definition at line 173 of file SIOReader.cc.
References _runListeners, std::set< K >::end(), and std::set< K >::insert().
|
overridevirtual |
Remove a listener for reading LCEvents from a stream.
Implements IO::LCReader.
Definition at line 167 of file SIOReader.cc.
References _evtListeners, std::set< K >::erase(), and std::set< K >::find().
|
overridevirtual |
Remove a listener for reading LCRunHeaders from a stream.
Implements IO::LCReader.
Definition at line 179 of file SIOReader.cc.
References _runListeners, std::set< K >::erase(), and std::set< K >::find().
|
overridevirtual |
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.
Definition at line 35 of file SIOReader.cc.
References _reader, and MT::LCReader::setReadCollectionNames().
|
overridevirtual |
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.
Definition at line 113 of file SIOReader.cc.
References _reader, and MT::LCReader::skipNEvents().
|
private |
pointer to current Event
Definition at line 213 of file SIOReader.h.
Referenced by readEvent(), and readNextEvent().
|
private |
pointer to current RunHeader
Definition at line 215 of file SIOReader.h.
Referenced by readNextRunHeader(), and readRunHeader().
|
private |
The event listeners.
Definition at line 211 of file SIOReader.h.
Referenced by processEvent(), registerLCEventListener(), and removeLCEventListener().
|
private |
The underlying implementation of the LCReader.
Definition at line 207 of file SIOReader.h.
Referenced by close(), getEvents(), getNumberOfEvents(), getNumberOfRuns(), getRuns(), open(), readEvent(), readNextEvent(), readNextRunHeader(), readRunHeader(), readStream(), setReadCollectionNames(), and skipNEvents().
|
private |
The run listeners.
Definition at line 209 of file SIOReader.h.
Referenced by processRunHeader(), registerLCRunListener(), and removeLCRunListener().