LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::EmptyEvent Class Referencefinal
Inheritance diagram for art::EmptyEvent:
art::DecrepitRelicInputSourceImplementation art::InputSource

Classes

struct  Config
 

Public Types

using Parameters = WrappedTable< Config, Config::KeysToIgnore >
 
enum  ProcessingMode { Runs, RunsAndSubRuns, RunsSubRunsAndEvents }
 

Public Member Functions

 EmptyEvent (Parameters const &config, InputSourceDescription &desc)
 
unsigned int numberEventsInRun () const
 
unsigned int numberEventsInSubRun () const
 
unsigned int eventCreationDelay () const
 
unsigned int numberEventsInThisRun () const
 
unsigned int numberEventsInThisSubRun () const
 
input::ItemType nextItemType () override
 
std::unique_ptr< EventPrincipalreadEvent (cet::exempt_ptr< SubRunPrincipal const > srp) override
 
std::unique_ptr< EventPrincipalreadEvent (EventID const &) override
 Read a specific event. More...
 
std::unique_ptr< SubRunPrincipalreadSubRun (cet::exempt_ptr< RunPrincipal const > rp) override
 Read next subRun. More...
 
std::unique_ptr< RunPrincipalreadRun () override
 Read next run. More...
 
std::unique_ptr< FileBlockreadFile () override
 Read next file. More...
 
void closeFile () override
 close current file More...
 
void skipEvents (int offset) override
 
void rewind () override
 Begin again at the first event. More...
 
void issueReports (EventID const &eventID)
 issue an event report More...
 
void repeat_ ()
 Reset the remaining number of events/subRuns to the maximum number. More...
 
int maxEvents () const
 
int remainingEvents () const
 
int maxSubRuns () const
 
int remainingSubRuns () const
 
void doBeginJob () override
 Called by framework at beginning of job. More...
 
void doEndJob () override
 Called by framework at end of job. More...
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
ProcessingMode processingMode () const
 RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs. More...
 
auto const & moduleDescription () const
 
auto const & processConfiguration () const
 

Protected Member Functions

void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
input::ItemType state () const
 
virtual void finish ()
 
cet::exempt_ptr< RunPrincipalrunPrincipalExemptPtr ()
 
cet::exempt_ptr< SubRunPrincipalsubRunPrincipalExemptPtr ()
 
std::unique_ptr< RunPrincipalrunPrincipal ()
 
std::unique_ptr< SubRunPrincipalsubRunPrincipal ()
 
std::unique_ptr< EventPrincipaleventPrincipal ()
 
void setRunPrincipal (std::unique_ptr< RunPrincipal > &&rp)
 
void setSubRunPrincipal (std::unique_ptr< SubRunPrincipal > &&srp)
 
void setEventPrincipal (std::unique_ptr< EventPrincipal > &&ep)
 
void resetRunPrincipal ()
 
void resetSubRunPrincipal ()
 
void resetEventPrincipal ()
 
void reset ()
 

Private Member Functions

art::input::ItemType getNextItemType () override
 
void setRunAndEventInfo ()
 
std::unique_ptr< EventPrincipalreadEvent_ () override
 
std::unique_ptr< SubRunPrincipalreadSubRun_ () override
 
std::unique_ptr< RunPrincipalreadRun_ () override
 
std::unique_ptr< RangeSetHandlerrunRangeSetHandler () override
 
std::unique_ptr< RangeSetHandlersubRunRangeSetHandler () override
 
void skip (int offset) override
 
void rewind_ () override
 
void beginJob () override
 
void endJob () override
 
void reallyReadEvent (bool const lastEventInSubRun)
 
std::unique_ptr< EmptyEventTimestampPluginmakePlugin_ (OptionalDelegatedParameter const &maybeConfig)
 

Private Attributes

unsigned int numberEventsInRun_
 
unsigned int numberEventsInSubRun_
 
unsigned int eventCreationDelay_
 
unsigned int numberEventsInThisRun_ {}
 
unsigned int numberEventsInThisSubRun_ {}
 
EventID eventID_ {}
 
EventID origEventID_ {}
 
bool newRun_ {true}
 
bool newSubRun_ {true}
 
bool subRunSet_ {false}
 
bool eventSet_ {false}
 
bool skipEventIncrement_ {true}
 
bool resetEventOnSubRun_
 
std::unique_ptr< EventPrincipalep_ {}
 
cet::BasicPluginFactory pluginFactory_ {}
 
std::unique_ptr< EmptyEventTimestampPluginplugin_
 

Detailed Description

Definition at line 38 of file EmptyEvent_source.cc.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
Runs 
RunsAndSubRuns 
RunsSubRunsAndEvents 

Definition at line 52 of file InputSource.h.

Constructor & Destructor Documentation

art::EmptyEvent::EmptyEvent ( Parameters const &  config,
InputSourceDescription desc 
)
explicit

Definition at line 149 of file EmptyEvent_source.cc.

References eventCreationDelay_, eventID_, art::EventID::firstEvent(), art::RunID::firstRun(), art::SubRunID::firstSubRun(), makePlugin_(), art::InputSourceDescription::moduleDescription, numberEventsInRun_, numberEventsInSubRun_, origEventID_, plugin_, resetEventOnSubRun_, art::SubRunID::run(), art::RunID::run(), and art::SubRunID::subRun().

151  : DecrepitRelicInputSourceImplementation{config().drisi_config,
152  desc.moduleDescription}
153  , numberEventsInRun_{static_cast<uint32_t>(config().numberEventsInRun())}
154  , numberEventsInSubRun_{static_cast<uint32_t>(
155  config().numberEventsInSubRun())}
156  , eventCreationDelay_{config().eventCreationDelay()}
157  , resetEventOnSubRun_{config().resetEventOnSubRun()}
158  , plugin_{makePlugin_(config().timestampPlugin)}
159 {
160 
161  RunNumber_t firstRun{};
162  bool haveFirstRun = config().firstRun(firstRun);
163  SubRunNumber_t firstSubRun{};
164  bool haveFirstSubRun = config().firstSubRun(firstSubRun);
165  EventNumber_t firstEvent{};
166  bool haveFirstEvent = config().firstEvent(firstEvent);
167  RunID firstRunID = haveFirstRun ? RunID(firstRun) : RunID::firstRun();
168  SubRunID firstSubRunID = haveFirstSubRun ?
169  SubRunID(firstRunID.run(), firstSubRun) :
170  SubRunID::firstSubRun(firstRunID);
171  origEventID_ =
172  haveFirstEvent ?
173  EventID(firstSubRunID.run(), firstSubRunID.subRun(), firstEvent) :
174  EventID::firstEvent(firstSubRunID);
176 }
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
std::unique_ptr< EmptyEventTimestampPlugin > makePlugin_(OptionalDelegatedParameter const &maybeConfig)
RunNumber_t run() const
Definition: RunID.h:63
unsigned int numberEventsInRun_
RunNumber_t run() const
Definition: SubRunID.h:84
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:118
unsigned int eventCreationDelay_
static SubRunID firstSubRun()
Definition: SubRunID.h:152
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
ModuleDescription const & moduleDescription
SubRunNumber_t subRun() const
Definition: SubRunID.h:90
static EventID firstEvent()
Definition: EventID.h:191
unsigned int numberEventsInSubRun_
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119

Member Function Documentation

void art::EmptyEvent::beginJob ( )
overrideprivatevirtual

Reimplemented from art::DecrepitRelicInputSourceImplementation.

Definition at line 235 of file EmptyEvent_source.cc.

References plugin_.

236 {
237  if (plugin_) {
238  plugin_->doBeginJob();
239  }
240 }
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
void art::DecrepitRelicInputSourceImplementation::closeFile ( )
overridevirtualinherited
void art::DecrepitRelicInputSourceImplementation::doBeginJob ( )
overridevirtualinherited
void art::DecrepitRelicInputSourceImplementation::doEndJob ( )
overridevirtualinherited
void art::EmptyEvent::endJob ( )
overrideprivatevirtual

Reimplemented from art::DecrepitRelicInputSourceImplementation.

Definition at line 243 of file EmptyEvent_source.cc.

References plugin_.

244 {
245  if (plugin_) {
246  plugin_->doEndJob();
247  }
248 }
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
unsigned int art::EmptyEvent::eventCreationDelay ( ) const
inline

Definition at line 89 of file EmptyEvent_source.cc.

90  {
91  return eventCreationDelay_;
92  }
unsigned int eventCreationDelay_
virtual void art::DecrepitRelicInputSourceImplementation::finish ( )
inlineprotectedvirtualinherited
art::input::ItemType art::EmptyEvent::getNextItemType ( )
overrideprivatevirtual

Implements art::DecrepitRelicInputSourceImplementation.

Definition at line 325 of file EmptyEvent_source.cc.

References ep_, eventID_, eventSet_, art::input::IsEvent, art::input::IsRun, art::input::IsStop, art::input::IsSubRun, art::RunID::isValid(), newRun_, newSubRun_, numberEventsInSubRun_, numberEventsInThisRun_, numberEventsInThisSubRun_, art::DecrepitRelicInputSourceImplementation::processingMode(), reallyReadEvent(), art::DecrepitRelicInputSourceImplementation::resetRunPrincipal(), art::DecrepitRelicInputSourceImplementation::resetSubRunPrincipal(), art::EventID::runID(), art::InputSource::Runs, setRunAndEventInfo(), art::EventID::subRunID(), and subRunSet_.

326 {
327  if (newRun_) {
328  if (!eventID_.runID().isValid()) {
329  ep_.reset();
330  return input::IsStop;
331  }
332  return input::IsRun;
333  }
334  if (newSubRun_) {
335  return input::IsSubRun;
336  }
337  if (ep_.get() != nullptr)
338  return input::IsEvent;
339  EventID oldEventID = eventID_;
340  if (!eventSet_) {
341  subRunSet_ = false;
343  eventSet_ = true;
344  }
345  if (!eventID_.runID().isValid()) {
346  ep_.reset();
347  return input::IsStop;
348  }
349  if (oldEventID.runID() != eventID_.runID()) {
350  // New Run
351  // reset these since this event is in the new run
354  newRun_ = newSubRun_ = true;
357  return input::IsRun;
358  }
359  // Same Run
360  if (oldEventID.subRunID() != eventID_.subRunID()) {
361  // New Subrun
363  newSubRun_ = true;
365  if (processingMode() != Runs) {
366  return input::IsSubRun;
367  }
368  }
371  bool const lastEventInSubRun =
373  reallyReadEvent(lastEventInSubRun);
374  if (ep_.get() == nullptr) {
375  return input::IsStop;
376  }
377  eventSet_ = false;
378  return input::IsEvent;
379 }
RunID const & runID() const
Definition: EventID.h:93
SubRunID const & subRunID() const
Definition: EventID.h:105
unsigned int numberEventsInThisRun_
void reallyReadEvent(bool const lastEventInSubRun)
std::unique_ptr< EventPrincipal > ep_
bool isValid() const
Definition: RunID.h:69
ProcessingMode processingMode() const
RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs.
unsigned int numberEventsInThisSubRun_
unsigned int numberEventsInSubRun_
void art::DecrepitRelicInputSourceImplementation::issueReports ( EventID const &  eventID)
inherited

issue an event report

Definition at line 313 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::readCount_.

Referenced by art::DecrepitRelicInputSourceImplementation::readEvent(), and art::DecrepitRelicInputSourceImplementation::rewind().

314  {
315  time_t t = time(0);
316  char ts[] = "dd-Mon-yyyy hh:mm:ss TZN ";
317  strftime(ts, strlen(ts) + 1, "%d-%b-%Y %H:%M:%S %Z", localtime(&t));
318  mf::LogVerbatim("ArtReport")
319  << "Begin processing the " << readCount_ << suffix(readCount_)
320  << " record. " << eventID << " at " << ts;
321  // At some point we may want to initiate checkpointing here
322  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::unique_ptr< art::EmptyEventTimestampPlugin > art::EmptyEvent::makePlugin_ ( OptionalDelegatedParameter const &  maybeConfig)
private

Definition at line 270 of file EmptyEvent_source.cc.

References art::errors::Configuration, e, fhicl::ParameterSet::get(), fhicl::OptionalDelegatedParameter::get_if_present(), pluginFactory_, and fhicl::detail::atom::value().

Referenced by EmptyEvent().

271 {
272  std::unique_ptr<art::EmptyEventTimestampPlugin> result;
273  try {
274  ParameterSet pset;
275  if (maybeConfig.get_if_present(pset)) {
276  auto const libspec = pset.get<std::string>("plugin_type");
277  auto const pluginType = pluginFactory_.pluginType(libspec);
278  if (pluginType ==
280  result =
281  pluginFactory_.makePlugin<std::unique_ptr<EmptyEventTimestampPlugin>>(
282  libspec, pset);
283  } else {
284  throw Exception(errors::Configuration, "EmptyEvent: ")
285  << "unrecognized plugin type " << pluginType << "for plugin "
286  << libspec << ".\n";
287  }
288  }
289  }
290  catch (cet::exception& e) {
291  throw Exception(errors::Configuration, "EmptyEvent: ", e)
292  << "Exception caught while processing plugin spec.\n";
293  }
294  return result;
295 }
T get(std::string const &key) const
Definition: ParameterSet.h:231
cet::BasicPluginFactory pluginFactory_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string value(boost::any const &)
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int art::DecrepitRelicInputSourceImplementation::maxEvents ( ) const
inlineinherited

Accessor for maximum number of events to be read. -1 is used for unlimited.

Definition at line 153 of file DecrepitRelicInputSourceImplementation.h.

References art::DecrepitRelicInputSourceImplementation::maxEvents_.

int art::DecrepitRelicInputSourceImplementation::maxSubRuns ( ) const
inlineinherited

Accessor for maximum number of subRuns to be read. -1 is used for unlimited.

Definition at line 169 of file DecrepitRelicInputSourceImplementation.h.

References art::DecrepitRelicInputSourceImplementation::maxSubRuns_.

auto const& art::InputSource::moduleDescription ( ) const
inlineinherited

Definition at line 59 of file InputSource.h.

Referenced by readRun_(), and readSubRun_().

60  {
61  return moduleDescription_;
62  }
ModuleDescription moduleDescription_
Definition: InputSource.h:100
input::ItemType art::DecrepitRelicInputSourceImplementation::nextItemType ( )
overridevirtualinherited

Implements art::InputSource.

Reimplemented in art::RootInput.

Definition at line 140 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::doneReadAhead_, art::DecrepitRelicInputSourceImplementation::eventLimitReached(), art::DecrepitRelicInputSourceImplementation::finish(), art::input::IsEvent, art::input::IsFile, art::input::IsInvalid, art::input::IsRun, art::input::IsStop, art::input::IsSubRun, art::DecrepitRelicInputSourceImplementation::nextItemType_(), art::DecrepitRelicInputSourceImplementation::processingMode(), art::DecrepitRelicInputSourceImplementation::readRun_(), art::DecrepitRelicInputSourceImplementation::readSubRun_(), art::DecrepitRelicInputSourceImplementation::runPrincipal_, art::InputSource::Runs, art::InputSource::RunsSubRunsAndEvents, art::DecrepitRelicInputSourceImplementation::state_, art::DecrepitRelicInputSourceImplementation::subRunLimitReached(), and art::DecrepitRelicInputSourceImplementation::subRunPrincipal_.

Referenced by art::RootInput::nextItemType().

141  {
142  if (doneReadAhead_) {
143  return state_;
144  }
145  doneReadAhead_ = true;
146  input::ItemType oldState = state_;
147  if (eventLimitReached()) {
148  // If the maximum event limit has been reached, stop.
150  } else if (subRunLimitReached()) {
151  // If the maximum subRun limit has been reached, stop
152  // when reaching a new file, run, or subRun.
153  if (oldState == input::IsInvalid || oldState == input::IsFile ||
154  oldState == input::IsRun ||
157  } else {
158  input::ItemType newState = nextItemType_();
159  if (newState == input::IsEvent) {
162  } else {
164  }
165  }
166  } else {
167  input::ItemType newState = nextItemType_();
168  if (newState == input::IsStop) {
170  } else if (newState == input::IsFile || oldState == input::IsInvalid) {
172  } else if (newState == input::IsRun || oldState == input::IsFile) {
175  } else if (newState == input::IsSubRun || oldState == input::IsRun) {
176  assert(processingMode() != Runs);
179  } else {
182  }
183  }
184  if (state_ == input::IsStop) {
185  subRunPrincipal_.reset();
186  runPrincipal_.reset();
187  // FIXME: upon the advent of a catalog system which can do
188  // something intelligent with the difference between whole-file
189  // success, partial-file success, partial-file failure and
190  // whole-file failure (such as file-open failure), we will need to
191  // communicate that difference here. The file disposition options
192  // as they are now (and the mapping to any concrete implementation
193  // we are are aware of currently) are not sufficient to the task,
194  // so we deliberately do not distinguish here between partial-file
195  // and whole-file success in particular.
196  finish();
197  }
198  return state_;
199  }
virtual std::unique_ptr< SubRunPrincipal > readSubRun_()=0
virtual std::unique_ptr< RunPrincipal > readRun_()=0
ProcessingMode processingMode() const
RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs.
unsigned int art::EmptyEvent::numberEventsInRun ( ) const
inline

Definition at line 79 of file EmptyEvent_source.cc.

80  {
81  return numberEventsInRun_;
82  }
unsigned int numberEventsInRun_
unsigned int art::EmptyEvent::numberEventsInSubRun ( ) const
inline

Definition at line 84 of file EmptyEvent_source.cc.

85  {
86  return numberEventsInSubRun_;
87  }
unsigned int numberEventsInSubRun_
unsigned int art::EmptyEvent::numberEventsInThisRun ( ) const
inline

Definition at line 94 of file EmptyEvent_source.cc.

95  {
97  }
unsigned int numberEventsInThisRun_
unsigned int art::EmptyEvent::numberEventsInThisSubRun ( ) const
inline

Definition at line 99 of file EmptyEvent_source.cc.

References breakpoints::beginJob().

100  {
102  }
unsigned int numberEventsInThisSubRun_
auto const& art::InputSource::processConfiguration ( ) const
inlineinherited

Definition at line 64 of file InputSource.h.

References n.

Referenced by readRun_(), readSubRun_(), reallyReadEvent(), and art::RootInput::RootInput().

65  {
67  }
ModuleDescription moduleDescription_
Definition: InputSource.h:100
ProcessConfiguration const & processConfiguration() const
std::unique_ptr< EventPrincipal > art::DecrepitRelicInputSourceImplementation::readEvent ( cet::exempt_ptr< SubRunPrincipal const >  srp)
overridevirtualinherited

Read next event Indicate inability to get a new event by returning a null unique_ptr.

Implements art::InputSource.

Reimplemented in art::RootInput.

Definition at line 273 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::doneReadAhead_, art::DecrepitRelicInputSourceImplementation::eventLimitReached(), art::DecrepitRelicInputSourceImplementation::eventPrincipal_, art::input::IsEvent, art::DecrepitRelicInputSourceImplementation::issueReports(), art::DecrepitRelicInputSourceImplementation::readCount_, art::DecrepitRelicInputSourceImplementation::readEvent_(), art::DecrepitRelicInputSourceImplementation::remainingEvents_, art::DecrepitRelicInputSourceImplementation::reportFrequency_, art::DecrepitRelicInputSourceImplementation::setTimestamp(), and art::DecrepitRelicInputSourceImplementation::state_.

Referenced by art::RootInput::readEvent_().

275  {
276  assert(doneReadAhead_);
277  assert(state_ == input::IsEvent);
278  assert(!eventLimitReached());
279  doneReadAhead_ = false;
280 
282  assert(srp->run() == eventPrincipal_->run());
283  assert(srp->subRun() == eventPrincipal_->subRun());
284  eventPrincipal_->setSubRunPrincipal(srp);
285  if (eventPrincipal_.get() != nullptr) {
286  if (remainingEvents_ > 0)
288  ++readCount_;
289  setTimestamp(eventPrincipal_->time());
290  if ((reportFrequency_ > 0) && !(readCount_ % reportFrequency_)) {
292  }
293  }
294  return std::move(eventPrincipal_);
295  }
void issueReports(EventID const &eventID)
issue an event report
virtual std::unique_ptr< EventPrincipal > readEvent_()=0
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
std::unique_ptr< EventPrincipal > art::DecrepitRelicInputSourceImplementation::readEvent ( EventID const &  )
overridevirtualinherited

Read a specific event.

Reimplemented from art::InputSource.

Definition at line 298 of file DecrepitRelicInputSourceImplementation.cc.

References art::errors::LogicError.

299  {
301  << "DecrepitRelicInputSourceImplementation::readEvent()\n"
302  << "Random access is not implemented for this type of Input Source\n"
303  << "Contact a Framework Developer\n";
304  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::unique_ptr< EventPrincipal > EmptyEvent::readEvent_ ( )
overrideprivatevirtual

Implements art::DecrepitRelicInputSourceImplementation.

Definition at line 228 of file EmptyEvent_source.cc.

References ep_, art::DecrepitRelicInputSourceImplementation::processingMode(), and art::InputSource::RunsSubRunsAndEvents.

229 {
230  assert(ep_.get() != nullptr || processingMode() != RunsSubRunsAndEvents);
231  return std::move(ep_);
232 }
std::unique_ptr< EventPrincipal > ep_
ProcessingMode processingMode() const
RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs.
std::unique_ptr< RunPrincipal > art::DecrepitRelicInputSourceImplementation::readRun ( )
overridevirtualinherited

Read next run.

Implements art::InputSource.

Reimplemented in art::RootInput.

Definition at line 241 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::cachedRunPrincipal_, art::DecrepitRelicInputSourceImplementation::doneReadAhead_, art::input::IsRun, art::DecrepitRelicInputSourceImplementation::limitReached(), art::DecrepitRelicInputSourceImplementation::runPrincipal_, and art::DecrepitRelicInputSourceImplementation::state_.

Referenced by art::RootInput::readRun().

242  {
243  // Note: For the moment, we do not support saving and restoring the state of
244  // the random number generator if random numbers are generated during
245  // processing of runs (e.g. beginRun(), endRun())
246  assert(doneReadAhead_);
247  assert(state_ == input::IsRun);
248  assert(!limitReached());
249  doneReadAhead_ = false;
251  return std::move(runPrincipal_);
252  }
std::unique_ptr< RunPrincipal > art::EmptyEvent::readRun_ ( )
overrideprivatevirtual

Implements art::DecrepitRelicInputSourceImplementation.

Definition at line 179 of file EmptyEvent_source.cc.

References eventID_, art::Timestamp::invalidTimestamp(), art::InputSource::moduleDescription(), newRun_, art::Consumer::non_module_context(), plugin_, art::InputSource::processConfiguration(), and art::EventID::runID().

180 {
181  auto ts = plugin_ ? plugin_->doBeginRunTimestamp(eventID_.runID()) :
183  RunAuxiliary const runAux{
185  newRun_ = false;
186  auto rp_ptr =
187  std::make_unique<RunPrincipal>(runAux, processConfiguration(), nullptr);
188  if (plugin_) {
189  Run const r{*rp_ptr, moduleDescription(), Consumer::non_module_context()};
190  plugin_->doBeginRun(r);
191  }
192  return rp_ptr;
193 }
RunID const & runID() const
Definition: EventID.h:93
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
auto const & moduleDescription() const
Definition: InputSource.h:59
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
Definition: Run.h:30
auto const & processConfiguration() const
Definition: InputSource.h:64
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
std::unique_ptr< SubRunPrincipal > art::DecrepitRelicInputSourceImplementation::readSubRun ( cet::exempt_ptr< RunPrincipal const >  rp)
overridevirtualinherited

Read next subRun.

Implements art::InputSource.

Reimplemented in art::RootInput.

Definition at line 255 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::cachedSubRunPrincipal_, art::DecrepitRelicInputSourceImplementation::doneReadAhead_, art::input::IsSubRun, art::DecrepitRelicInputSourceImplementation::limitReached(), art::DecrepitRelicInputSourceImplementation::remainingSubRuns_, art::DecrepitRelicInputSourceImplementation::state_, and art::DecrepitRelicInputSourceImplementation::subRunPrincipal_.

Referenced by art::RootInput::readSubRun().

257  {
258  // Note: For the moment, we do not support saving and restoring the state of
259  // the random number generator if random numbers are generated during
260  // processing of subRuns (e.g. beginSubRun(), endSubRun())
261  assert(doneReadAhead_);
262  assert(state_ == input::IsSubRun);
263  assert(!limitReached());
264  doneReadAhead_ = false;
266  assert(subRunPrincipal_->run() == rp->run());
267  subRunPrincipal_->setRunPrincipal(rp);
269  return std::move(subRunPrincipal_);
270  }
std::unique_ptr< SubRunPrincipal > EmptyEvent::readSubRun_ ( )
overrideprivatevirtual

Implements art::DecrepitRelicInputSourceImplementation.

Definition at line 202 of file EmptyEvent_source.cc.

References eventID_, art::Timestamp::invalidTimestamp(), art::InputSource::moduleDescription(), newSubRun_, art::Consumer::non_module_context(), plugin_, art::InputSource::processConfiguration(), art::DecrepitRelicInputSourceImplementation::processingMode(), art::InputSource::Runs, and art::EventID::subRunID().

203 {
204  if (processingMode() == Runs)
205  return std::unique_ptr<SubRunPrincipal>{nullptr};
206  auto ts = plugin_ ? plugin_->doBeginSubRunTimestamp(eventID_.subRunID()) :
208  SubRunAuxiliary const subRunAux{
210  auto srp_ptr = std::make_unique<SubRunPrincipal>(
211  subRunAux, processConfiguration(), nullptr);
212  if (plugin_) {
213  SubRun const sr{
215  plugin_->doBeginSubRun(sr);
216  }
217  newSubRun_ = false;
218  return srp_ptr;
219 }
SubRunID const & subRunID() const
Definition: EventID.h:105
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
auto const & moduleDescription() const
Definition: InputSource.h:59
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
auto const & processConfiguration() const
Definition: InputSource.h:64
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
ProcessingMode processingMode() const
RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs.
void art::EmptyEvent::reallyReadEvent ( bool const  lastEventInSubRun)
private

Definition at line 251 of file EmptyEvent_source.cc.

References art::EventAuxiliary::Any, ep_, eventID_, art::Timestamp::invalidTimestamp(), plugin_, art::InputSource::processConfiguration(), art::DecrepitRelicInputSourceImplementation::processingMode(), art::InputSource::RunsSubRunsAndEvents, and art::DecrepitRelicInputSourceImplementation::timestamp().

Referenced by getNextItemType().

252 {
254  return;
255  auto timestamp = plugin_ ? plugin_->doEventTimestamp(eventID_) :
257  EventAuxiliary const eventAux{
259 
260  ep_ = std::make_unique<EventPrincipal>(eventAux,
262  nullptr,
263  std::make_shared<History>(),
264  std::make_unique<BranchMapper>(),
265  std::make_unique<NoDelayedReader>(),
266  lastEventInSubRun);
267 }
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
Timestamp const & timestamp() const
Accessor for the current time, as seen by the input source.
std::unique_ptr< EventPrincipal > ep_
auto const & processConfiguration() const
Definition: InputSource.h:64
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
ProcessingMode processingMode() const
RunsSubRunsAndEvents (default), RunsAndSubRuns, or Runs.
int art::DecrepitRelicInputSourceImplementation::remainingEvents ( ) const
inlineinherited

Accessor for remaining number of events to be read. -1 is used for unlimited.

Definition at line 161 of file DecrepitRelicInputSourceImplementation.h.

References art::DecrepitRelicInputSourceImplementation::remainingEvents_.

int art::DecrepitRelicInputSourceImplementation::remainingSubRuns ( ) const
inlineinherited
void art::DecrepitRelicInputSourceImplementation::resetEventPrincipal ( )
inlineprotectedinherited
void art::DecrepitRelicInputSourceImplementation::resetRunPrincipal ( )
inlineprotectedinherited
void art::DecrepitRelicInputSourceImplementation::resetSubRunPrincipal ( )
inlineprotectedinherited
void art::EmptyEvent::rewind_ ( )
overrideprivatevirtual

Reimplemented from art::DecrepitRelicInputSourceImplementation.

Definition at line 309 of file EmptyEvent_source.cc.

References eventID_, art::Timestamp::invalidTimestamp(), newRun_, newSubRun_, numberEventsInThisRun_, numberEventsInThisSubRun_, origEventID_, plugin_, art::DecrepitRelicInputSourceImplementation::resetRunPrincipal(), art::DecrepitRelicInputSourceImplementation::resetSubRunPrincipal(), art::DecrepitRelicInputSourceImplementation::setTimestamp(), and skipEventIncrement_.

310 {
311  if (plugin_) {
312  plugin_->doRewind();
313  }
316  skipEventIncrement_ = true;
319  newRun_ = newSubRun_ = true;
322 }
std::unique_ptr< EmptyEventTimestampPlugin > plugin_
unsigned int numberEventsInThisRun_
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
unsigned int numberEventsInThisSubRun_
std::unique_ptr<RunPrincipal> art::DecrepitRelicInputSourceImplementation::runPrincipal ( )
inlineprotectedinherited
cet::exempt_ptr<RunPrincipal> art::DecrepitRelicInputSourceImplementation::runPrincipalExemptPtr ( )
inlineprotectedinherited
std::unique_ptr< RangeSetHandler > art::EmptyEvent::runRangeSetHandler ( )
overrideprivatevirtual

Implements art::InputSource.

Definition at line 196 of file EmptyEvent_source.cc.

References eventID_, and art::EventID::run().

197 {
198  return std::make_unique<OpenRangeSetHandler>(eventID_.run());
199 }
RunNumber_t run() const
Definition: EventID.h:99
void art::DecrepitRelicInputSourceImplementation::setEventPrincipal ( std::unique_ptr< EventPrincipal > &&  ep)
protectedinherited
void art::EmptyEvent::setRunAndEventInfo ( )
private

Definition at line 382 of file EmptyEvent_source.cc.

References DEFINE_ART_INPUT_SOURCE, art::EventID::event(), eventCreationDelay_, eventID_, art::EventID::next(), art::EventID::nextRun(), art::EventID::nextSubRun(), numberEventsInRun_, numberEventsInSubRun_, numberEventsInThisRun_, numberEventsInThisSubRun_, origEventID_, resetEventOnSubRun_, art::EventID::run(), skipEventIncrement_, and art::EventID::subRun().

Referenced by getNextItemType().

383 {
384  // NOTE: numberEventsInRun < 0 means go forever in this run
386  // same run
387  if (!(numberEventsInSubRun_ < 1 ||
389  // new subrun
390  if (resetEventOnSubRun_) {
392  } else {
394  }
395  } else if (skipEventIncrement_) { // For first event, rewind etc.
396  skipEventIncrement_ = false;
397  } else {
398  eventID_ = eventID_.next();
399  }
400  } else {
401  // new run
402  eventID_ = EventID(
404  }
405  if (eventCreationDelay_ > 0) {
406  usleep(eventCreationDelay_);
407  }
408 }
EventID next() const
Definition: EventID.h:135
unsigned int numberEventsInThisRun_
RunNumber_t run() const
Definition: EventID.h:99
unsigned int numberEventsInRun_
EventID nextSubRun(EventNumber_t first=IDNumber< Level::Event >::first()) const
Definition: EventID.h:148
unsigned int eventCreationDelay_
EventNumber_t event() const
Definition: EventID.h:117
EventID nextRun() const
Definition: EventID.h:154
unsigned int numberEventsInThisSubRun_
unsigned int numberEventsInSubRun_
SubRunNumber_t subRun() const
Definition: EventID.h:111
void art::DecrepitRelicInputSourceImplementation::setRunPrincipal ( std::unique_ptr< RunPrincipal > &&  rp)
protectedinherited
void art::DecrepitRelicInputSourceImplementation::setSubRunPrincipal ( std::unique_ptr< SubRunPrincipal > &&  srp)
protectedinherited
void art::DecrepitRelicInputSourceImplementation::setTimestamp ( Timestamp const &  theTime)
inlineprotectedinherited

To set the current time, as seen by the input source.

Definition at line 205 of file DecrepitRelicInputSourceImplementation.h.

References art::DecrepitRelicInputSourceImplementation::time_.

Referenced by art::DecrepitRelicInputSourceImplementation::readEvent(), and rewind_().

void art::EmptyEvent::skip ( int  offset)
overrideprivatevirtual

Reimplemented from art::DecrepitRelicInputSourceImplementation.

Definition at line 298 of file EmptyEvent_source.cc.

References eventID_, art::EventID::next(), and art::EventID::previous().

299 {
300  for (; offset < 0; ++offset) {
302  }
303  for (; offset > 0; --offset) {
304  eventID_ = eventID_.next();
305  }
306 }
EventID previous() const
Definition: EventID.h:160
EventID next() const
Definition: EventID.h:135
void art::DecrepitRelicInputSourceImplementation::skipEvents ( int  offset)
overridevirtualinherited

Skip the number of events specified. Offset may be negative.

Reimplemented from art::InputSource.

Definition at line 307 of file DecrepitRelicInputSourceImplementation.cc.

References art::DecrepitRelicInputSourceImplementation::skip().

308  {
309  this->skip(offset);
310  }
input::ItemType art::DecrepitRelicInputSourceImplementation::state ( ) const
inlineprotectedinherited
std::unique_ptr<SubRunPrincipal> art::DecrepitRelicInputSourceImplementation::subRunPrincipal ( )
inlineprotectedinherited
cet::exempt_ptr<SubRunPrincipal> art::DecrepitRelicInputSourceImplementation::subRunPrincipalExemptPtr ( )
inlineprotectedinherited
std::unique_ptr< RangeSetHandler > art::EmptyEvent::subRunRangeSetHandler ( )
overrideprivatevirtual

Implements art::InputSource.

Definition at line 222 of file EmptyEvent_source.cc.

References eventID_, and art::EventID::run().

223 {
224  return std::make_unique<OpenRangeSetHandler>(eventID_.run());
225 }
RunNumber_t run() const
Definition: EventID.h:99
Timestamp const& art::DecrepitRelicInputSourceImplementation::timestamp ( ) const
inlineinherited

Accessor for the current time, as seen by the input source.

Definition at line 190 of file DecrepitRelicInputSourceImplementation.h.

References art::DecrepitRelicInputSourceImplementation::time_.

Referenced by reallyReadEvent().

Member Data Documentation

std::unique_ptr<EventPrincipal> art::EmptyEvent::ep_ {}
private

Definition at line 139 of file EmptyEvent_source.cc.

Referenced by getNextItemType(), readEvent_(), and reallyReadEvent().

unsigned int art::EmptyEvent::eventCreationDelay_
private

Definition at line 127 of file EmptyEvent_source.cc.

Referenced by EmptyEvent(), and setRunAndEventInfo().

bool art::EmptyEvent::eventSet_ {false}
private

Definition at line 136 of file EmptyEvent_source.cc.

Referenced by getNextItemType().

bool art::EmptyEvent::newRun_ {true}
private

Definition at line 133 of file EmptyEvent_source.cc.

Referenced by getNextItemType(), readRun_(), and rewind_().

bool art::EmptyEvent::newSubRun_ {true}
private

Definition at line 134 of file EmptyEvent_source.cc.

Referenced by getNextItemType(), readSubRun_(), and rewind_().

unsigned int art::EmptyEvent::numberEventsInRun_
private

Definition at line 125 of file EmptyEvent_source.cc.

Referenced by EmptyEvent(), and setRunAndEventInfo().

unsigned int art::EmptyEvent::numberEventsInSubRun_
private

Definition at line 126 of file EmptyEvent_source.cc.

Referenced by EmptyEvent(), getNextItemType(), and setRunAndEventInfo().

unsigned int art::EmptyEvent::numberEventsInThisRun_ {}
private

Definition at line 129 of file EmptyEvent_source.cc.

Referenced by getNextItemType(), rewind_(), and setRunAndEventInfo().

unsigned int art::EmptyEvent::numberEventsInThisSubRun_ {}
private

Definition at line 130 of file EmptyEvent_source.cc.

Referenced by getNextItemType(), rewind_(), and setRunAndEventInfo().

EventID art::EmptyEvent::origEventID_ {}
private

Definition at line 132 of file EmptyEvent_source.cc.

Referenced by EmptyEvent(), rewind_(), and setRunAndEventInfo().

std::unique_ptr<EmptyEventTimestampPlugin> art::EmptyEvent::plugin_
private
cet::BasicPluginFactory art::EmptyEvent::pluginFactory_ {}
private

Definition at line 141 of file EmptyEvent_source.cc.

Referenced by makePlugin_().

bool art::EmptyEvent::resetEventOnSubRun_
private

Definition at line 138 of file EmptyEvent_source.cc.

Referenced by EmptyEvent(), and setRunAndEventInfo().

bool art::EmptyEvent::skipEventIncrement_ {true}
private

Definition at line 137 of file EmptyEvent_source.cc.

Referenced by rewind_(), and setRunAndEventInfo().

bool art::EmptyEvent::subRunSet_ {false}
private

Definition at line 135 of file EmptyEvent_source.cc.

Referenced by getNextItemType().


The documentation for this class was generated from the following file: