36 using namespace fhicl;
39 using std::chrono::steady_clock;
51 drisi_config().maxEvents()};
53 drisi_config().maxSubRuns()};
57 "If specified, the 'maxTime' parameter indicates the maximum " 59 "wall-clock time (in seconds) for which new events may be created.\n" 60 "This option is mutually exclusive with the 'maxEvents' and " 62 "configuration parameters."),
65 Name(
"eventCreationDelay"),
66 Comment(
"The 'eventCreationDelay' parameter is an integral value\n" 67 "in the range [0, 1000000), corresponding to microseconds.\n" 68 "If specified, the input source will sleep for the specified " 70 "of time before each new event, subrun, or run is created.\n"),
77 Name(
"timestampPlugin"),
79 "The 'timestampPlugin' parameter must be a FHiCL table\n" 81 " timestampPlugin: {\n" 82 " plugin_type: <plugin specification>\n" 85 "See the notes in art/Framework/Core/EmptyEventTimestampPlugin.h\n" 86 "for more details.")};
92 return {
"module_label"};
107 unique_ptr<RangeSetHandler> runRangeSetHandler()
override;
108 unique_ptr<RangeSetHandler> subRunRangeSetHandler()
override;
110 unique_ptr<RunPrincipal> readRun_()
override;
111 unique_ptr<SubRunPrincipal> readSubRun_(
113 unique_ptr<EventPrincipal> readEvent_()
override;
114 unique_ptr<EmptyEventTimestampPlugin> makePlugin_(
117 void endJob()
override;
118 void skip(
int offset)
override;
119 void rewind_()
override;
126 unsigned numberEventsInThisRun_{};
127 unsigned numberEventsInThisSubRun_{};
130 bool firstTime_{
true};
133 bool newSubRun_{
true};
136 unique_ptr<EmptyEventTimestampPlugin>
plugin_;
155 auto const& pset =
config.get_PSet();
156 if (pset.has_key(
"maxTime") &&
157 (pset.has_key(
"maxEvents") || pset.has_key(
"maxSubRuns"))) {
160 "An error occurred while configuring the EmptyEvent source.\n"}
161 <<
"The 'maxTime' parameter cannot be used with the 'maxEvents' or " 162 "'maxSubRuns' parameters.\n" 163 "Type 'art --print-description EmptyEvent' for the allowed " 174 SubRunID firstSubRunID = haveFirstSubRun ?
271 unique_ptr<art::RunPrincipal>
274 unique_ptr<RunPrincipal>
result;
280 assert(result.get() !=
nullptr);
289 unique_ptr<art::SubRunPrincipal>
292 unique_ptr<SubRunPrincipal>
result;
302 assert(result.get() !=
nullptr);
303 result->setRunPrincipal(rp);
312 unique_ptr<art::EventPrincipal>
315 unique_ptr<EventPrincipal>
result;
323 result = make_unique<EventPrincipal>(eventAux,
326 make_unique<History>(),
327 make_unique<NoDelayedReader>(),
330 assert(result.get() !=
nullptr);
334 unique_ptr<art::RangeSetHandler>
337 return make_unique<OpenRangeSetHandler>(
eventID_.
run());
340 unique_ptr<art::RangeSetHandler>
343 return make_unique<OpenRangeSetHandler>(
eventID_.
run());
362 std::unique_ptr<art::EmptyEventTimestampPlugin>
365 std::unique_ptr<EmptyEventTimestampPlugin>
result;
376 <<
"unrecognized plugin type " << pluginType <<
"for plugin " 383 <<
"Exception caught while processing plugin spec.\n";
391 for (; offset < 0; ++offset) {
394 for (; offset > 0; --offset) {
RunID const & runID() const
OptionalAtom< EventNumber_t > firstEvent
SubRunID const & subRunID() const
std::chrono::microseconds const eventCreationDelay_
std::optional< T > get_if_present() const
EmptyEvent(Parameters const &config, InputSourceDescription &desc)
unique_ptr< SubRunPrincipal > readSubRun_(cet::exempt_ptr< RunPrincipal const >) override
Atom< bool > resetEventOnSubRun
OptionalAtom< RunNumber_t > firstRun
TableFragment< DRISI::Config > drisi_config
unsigned numberEventsInThisRun_
unique_ptr< EmptyEventTimestampPlugin > makePlugin_(OptionalDelegatedParameter const &maybeConfig)
unsigned const numberEventsInRun_
ChannelGroupService::Name Name
std::enable_if_t<!std::is_function_v< RESULT_TYPE >, RESULT_TYPE > makePlugin(std::string const &libspec, ARGS &&...args) const
OptionalAtom< SubRunNumber_t > firstSubRun
ModuleType module_type(std::string const &full_key)
microsecond microseconds
Alias for common language habits.
unique_ptr< RangeSetHandler > runRangeSetHandler() override
steady_clock::time_point const beginTime_
static constexpr double ms
second seconds
Alias for common language habits.
unsigned const numberEventsInSubRun_
std::chrono::seconds const maxTime_
T get(std::string const &key) const
cet::BasicPluginFactory pluginFactory_
IDNumber_t< Level::SubRun > SubRunNumber_t
void skip(int offset) override
EventID nextSubRun(EventNumber_t first=IDNumber< Level::Event >::first()) const
Atom< int > numberEventsInSubRun
unique_ptr< EmptyEventTimestampPlugin > plugin_
static int max(int a, int b)
static SubRunID firstSubRun()
unique_ptr< EventPrincipal > readEvent_() override
static constexpr Timestamp invalidTimestamp()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Atom< int > numberEventsInRun
std::string pluginType(std::string const &libspec) const
std::set< std::string > operator()() const
IDNumber_t< Level::Event > EventNumber_t
unique_ptr< RunPrincipal > readRun_() override
EventNumber_t event() const
SubRunNumber_t subRun() const
bool const resetEventOnSubRun_
static EventID firstEvent()
static constexpr double sr
Atom< uint32_t > eventCreationDelay
SubRunNumber_t subRun() const
cet::coded_exception< error, detail::translate > exception
unsigned numberEventsInThisSubRun_
unique_ptr< RangeSetHandler > subRunRangeSetHandler() override
input::ItemType getNextItemType() override
IDNumber_t< Level::Run > RunNumber_t