1 #ifndef MARLINMT_LCIOFILESOURCE_h 2 #define MARLINMT_LCIOFILESOURCE_h 1 15 #include <EVENT/LCEvent.h> 16 #include <EVENT/LCRunHeader.h> 17 #include <MT/LCReader.h> 18 #include <MT/LCReaderListener.h> 39 void initialize()
override ;
40 bool readOne()
override ;
43 void onLCEventRead( std::shared_ptr<EVENT::LCEvent> event ) ;
44 void onLCRunHeaderRead( std::shared_ptr<EVENT::LCRunHeader> rhdr ) ;
48 "The list of LCIO input files" } ;
51 "The maximum number of records to read", 0 } ;
54 "The number of events to skip on file open", 0 } ;
57 "An optional list of LCIO collections to read from event" } ;
60 "Set to true to perform a lazy unpacking after reading out an event",
false } ;
67 int _currentReadRecords {0} ;
73 LCIOFileSource::LCIOFileSource() :
75 setDescription(
"Read LCIO events and run headers from files on disk" ) ;
82 auto flag = FileReader::directAccess ;
84 flag |= FileReader::lazyUnpack ;
86 _fileReader = std::make_shared<FileReader>( flag ) ;
91 throw Exception(
"LCIOFileSource::init: LCIO input file list is empty" ) ;
95 log<WARNING>() <<
" --- Will skip first " <<
_skipNEvents <<
" event(s)" << std::endl ;
100 <<
" *********** Parameter LCIOReadCollectionNames given - will only read the following collections: **** " 103 log<WARNING>() <<
" " << collection << std::endl ;
106 <<
" *************************************************************************************************** " << std::endl ;
107 _fileReader->setReadCollectionNames( _readCollectionNames ) ;
121 catch( IO::EndOfDataException &e ) {
void initialize() override
Init data source.
void processRunHeader(std::shared_ptr< RunHeader > rhdr)
Must be called by daughter classes in readStream() to process an event in the framework.
std::shared_ptr< FileReader > FileReaderPtr
FileReaderPtr _fileReader
The current number of read records.
#define MARLINMT_DECLARE_DATASOURCE_NAME(Class, NameStr)
void processEvent(std::shared_ptr< EventStore > event)
Must be called by daughter classes in readStream() to process an event in the framework.
DataSourcePlugin class Responsible for reading/getting LCEvent and LCRunHeader in the framework for f...
void setDescription(const std::string &desc)
Set the component description.
void onEventRead(EventFunction func)
Set the callback function to process on event read.
IntParameter _maxRecordNumber
StringVectorParameter _readCollectionNames
BoolParameter _lazyUnpack
The LCIO file listener.
virtual void initialize() override
Init data source.
void onRunHeaderRead(RunHeaderFunction func)
Set the callback function to process on run info read.
StringVectorParameter _inputFileNames
IntParameter _skipNEvents
ReaderListener _listener
The LCIO file reader.
bool readOne() override
Read one record from the input stream.