12 #include <IMPL/LCEventImpl.h> 13 #include <IMPL/LCRunHeaderImpl.h> 14 #include <UTIL/LCStdHepRdr.h> 15 #include <UTIL/LCTOOLS.h> 35 void initialize()
override ;
36 bool readOne()
override ;
40 "The StdHep input file name" } ;
43 "The maximum number of events to read", 0 } ;
46 "The name of the MCParticle collection to add in the event",
"MCParticle" } ;
51 bool _isFirstEvent {
true} ;
53 int _currentReadEvents {0} ;
59 StdHepFileSource::StdHepFileSource() :
61 setDescription(
"Reads StdHep files as input and creates LCIO events with MCParticle collections" ) ;
77 auto rhdr = std::make_shared<RunHeader>() ;
78 rhdr->setDescription(
" Events read from stdhep input file: " +
_fileName.
get() ) ;
79 rhdr->setRunNumber( 0 ) ;
86 if(
nullptr == collection ) {
93 auto event = std::make_shared<IMPL::LCEventImpl>() ;
94 event->setRunNumber( 0 ) ;
97 auto store = std::make_shared<EventStore>() ;
98 store->setEvent( event ) ;
100 auto evtn =
event->getEventNumber() ;
101 auto runn =
event->getRunNumber() ;
102 unsigned char * c = (
unsigned char *) &evtn ;
104 c = (
unsigned char *) &runn ;
106 store->setUID( uid ) ;
std::shared_ptr< UTIL::LCStdHepRdr > FileReader
bool _isFirstEvent
The current number of read events.
void processRunHeader(std::shared_ptr< RunHeader > rhdr)
Must be called by daughter classes in readStream() to process an event in the framework.
bool readOne() override
Read one record from the input stream.
StringParameter _fileName
#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.
unsigned jenkins_hash(unsigned char *k, unsigned length, unsigned initval)
StringParameter _collectionName
The stdhep file reader.
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 initialize() override
Init data source.
virtual void initialize() override
Init data source.
IntParameter _maxRecordNumber
T get() const
Get the parameter value.
FileReader _fileReader
Whether we are processing the first event.