19 #include "cetlib/BasicPluginFactory.h" 34 using namespace fhicl;
45 drisi_config().maxEvents()};
47 drisi_config().maxSubRuns()};
54 Name(
"timestampPlugin"),
56 "The 'timestampPlugin' parameter must be a FHiCL table\n" 58 " timestampPlugin: {\n" 59 " plugin_type: <plugin specification>\n" 62 "See the notes in art/Framework/Core/EmptyEventTimestampPlugin.h\n" 63 "for more details.")};
69 return {
"module_label"};
81 return numberEventsInRun_;
86 return numberEventsInSubRun_;
91 return eventCreationDelay_;
96 return numberEventsInThisRun_;
101 return numberEventsInThisSubRun_;
106 void setRunAndEventInfo();
107 std::unique_ptr<EventPrincipal> readEvent_()
override;
108 std::unique_ptr<SubRunPrincipal> readSubRun_()
override;
109 std::unique_ptr<RunPrincipal> readRun_()
override;
111 std::unique_ptr<RangeSetHandler> runRangeSetHandler()
override;
112 std::unique_ptr<RangeSetHandler> subRunRangeSetHandler()
override;
114 void skip(
int offset)
override;
115 void rewind_()
override;
118 void endJob()
override;
120 void reallyReadEvent(
bool const lastEventInSubRun);
122 std::unique_ptr<EmptyEventTimestampPlugin> makePlugin_(
129 unsigned int numberEventsInThisRun_{};
130 unsigned int numberEventsInThisSubRun_{};
134 bool newSubRun_{
true};
135 bool subRunSet_{
false};
136 bool eventSet_{
false};
137 bool skipEventIncrement_{
true};
139 std::unique_ptr<EventPrincipal> ep_{};
141 cet::BasicPluginFactory pluginFactory_{};
142 std::unique_ptr<EmptyEventTimestampPlugin>
plugin_;
155 config().numberEventsInSubRun())}
162 bool haveFirstRun = config().firstRun(firstRun);
164 bool haveFirstSubRun = config().firstSubRun(firstSubRun);
166 bool haveFirstEvent = config().firstEvent(firstEvent);
168 SubRunID firstSubRunID = haveFirstSubRun ?
178 std::unique_ptr<RunPrincipal>
195 std::unique_ptr<RangeSetHandler>
198 return std::make_unique<OpenRangeSetHandler>(
eventID_.
run());
201 std::unique_ptr<SubRunPrincipal>
205 return std::unique_ptr<SubRunPrincipal>{
nullptr};
210 auto srp_ptr = std::make_unique<SubRunPrincipal>(
221 std::unique_ptr<RangeSetHandler>
224 return std::make_unique<OpenRangeSetHandler>(
eventID_.
run());
227 std::unique_ptr<EventPrincipal>
231 return std::move(
ep_);
260 ep_ = std::make_unique<EventPrincipal>(eventAux,
263 std::make_shared<History>(),
264 std::make_unique<BranchMapper>(),
265 std::make_unique<NoDelayedReader>(),
269 std::unique_ptr<art::EmptyEventTimestampPlugin>
272 std::unique_ptr<art::EmptyEventTimestampPlugin> result;
276 auto const libspec = pset.
get<std::string>(
"plugin_type");
281 pluginFactory_.makePlugin<std::unique_ptr<EmptyEventTimestampPlugin>>(
285 <<
"unrecognized plugin type " << pluginType <<
"for plugin " 292 <<
"Exception caught while processing plugin spec.\n";
300 for (; offset < 0; ++offset) {
303 for (; offset > 0; --offset) {
337 if (
ep_.get() !=
nullptr)
371 bool const lastEventInSubRun =
374 if (
ep_.get() ==
nullptr) {
RunID const & runID() const
SubRunID const & subRunID() const
std::unique_ptr< EventPrincipal > readEvent_() override
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
EmptyEvent(Parameters const &config, InputSourceDescription &desc)
TableFragment< DRISI::Config > drisi_config
unsigned int numberEventsInThisRun_
void reallyReadEvent(bool const lastEventInSubRun)
std::unique_ptr< RunPrincipal > readRun_() override
std::unique_ptr< EmptyEventTimestampPlugin > makePlugin_(OptionalDelegatedParameter const &maybeConfig)
static cet::exempt_ptr< Consumer > non_module_context()
void setRunAndEventInfo()
unsigned int numberEventsInSubRun() const
std::unique_ptr< EventPrincipal > ep_
unsigned int numberEventsInThisRun() const
unsigned int numberEventsInRun_
unsigned int numberEventsInRun() const
std::unique_ptr< SubRunPrincipal > readSubRun_() override
std::unique_ptr< RangeSetHandler > runRangeSetHandler() override
T get(std::string const &key) const
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler() override
cet::BasicPluginFactory pluginFactory_
IDNumber_t< Level::SubRun > SubRunNumber_t
void skip(int offset) override
EventID nextSubRun(EventNumber_t first=IDNumber< Level::Event >::first()) const
unsigned int eventCreationDelay_
static SubRunID firstSubRun()
static constexpr Timestamp invalidTimestamp()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string value(boost::any const &)
bool get_if_present(T &t) const
std::set< std::string > operator()() const
IDNumber_t< Level::Event > EventNumber_t
unsigned int eventCreationDelay() const
unsigned int numberEventsInThisSubRun() const
EventNumber_t event() const
SubRunNumber_t subRun() const
unsigned int numberEventsInThisSubRun_
static EventID firstEvent()
unsigned int numberEventsInSubRun_
SubRunNumber_t subRun() const
cet::coded_exception< error, detail::translate > exception
art::input::ItemType getNextItemType() override
IDNumber_t< Level::Run > RunNumber_t