SeekToEventClient_service.cc
Go to the documentation of this file.
8 
9 #include <cassert>
10 #include <iostream>
11 
14  : nextEventsToProcess_{config().nextEventsToProcess()}
15 {
16  r.sPostBeginJobWorkers.watch(this, &SeekToEventClient::postBeginJobWorkers);
17  r.sPostProcessEvent.watch(this, &SeekToEventClient::preProcessEvent);
18  r.sPostProcessEvent.watch(this, &SeekToEventClient::postProcessEvent);
19 }
20 
21 void
23  art::InputSource* input_source,
24  std::vector<art::Worker*> const&)
25 {
26  if (nextEventsToProcess_.empty())
27  return;
28 
29  input_ = dynamic_cast<art::RootInput*>(input_source);
30  if (!input_)
32  << "The SeekToEventClient service can be used only with\n"
33  << "the RootInput source.\n";
34 }
35 
36 void
39 {
40  // Check to make sure SubRuns and Runs are appropriately filled.
41  // Exception will be thrown if not. Discard return value.
42  e.getSubRun();
43  e.getRun();
44 }
45 
46 void
49 {
50  if (nextEventsToProcess_.empty())
51  return;
52  input_->seekToEvent(nextEventsToProcess_[0]);
54 }
55 
cet::exempt_ptr< art::RootInput > input_
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:88
void postBeginJobWorkers(art::InputSource *input_source, std::vector< art::Worker * > const &)
void postProcessEvent(art::Event const &, art::ScheduleContext)
const double e
Run const & getRun() const
Definition: Event.cc:53
SeekToEventClient(Parameters const &, art::ActivityRegistry &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::vector< art::EventID > nextEventsToProcess_
SubRun const & getSubRun() const
Definition: Event.cc:43
void preProcessEvent(art::Event const &, art::ScheduleContext)