LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ProcessingLimits.cc
Go to the documentation of this file.
6 
7 namespace art {
8 
10  Config const& config,
11  std::function<input::ItemType()> nextItemType)
12  : processingMode_{InputSource::mode(config.processingMode())}
13  , remainingEvents_{config.maxEvents()}
14  , remainingSubRuns_{config.maxSubRuns()}
16  , nextItemType_{std::move(nextItemType)}
17  {
18  if (reportFrequency_ < 0) {
20  << "reportFrequency has a negative value, which is not meaningful.";
21  }
22  }
23 
26  {
27  if (remainingEvents_ == 0 || remainingSubRuns_ == 0) {
28  return input::IsStop;
29  }
30 
31  auto item_type = nextItemType_();
32  while (not allowed_(item_type)) {
33  item_type = nextItemType_();
34  }
35  return item_type;
36  }
37 
40  {
41  return processingMode_;
42  }
43 
44  int
46  {
47  return remainingEvents_;
48  }
49 
50  int
52  {
53  return remainingSubRuns_;
54  }
55 
56  void
58  {
59  if (remainingSubRuns_ > 0) {
61  }
62  }
63 
64  void
66  {
67  if (remainingEvents_ > 0) {
69  }
73  }
74  }
75 
76  bool
77  ProcessingLimits::allowed_(input::ItemType item_type) const noexcept
78  {
80  return true;
81  }
82 
83  // Events no longer allowed
84  if (item_type == input::IsEvent) {
85  return false;
86  }
88  return true;
89  }
90 
91  // SubRuns no longer allowed
92  return item_type != input::IsSubRun;
93  }
94 }
InputSource::ProcessingMode processingMode_
fhicl::Atom< int > reportFrequency
input::ItemType nextItemType()
fhicl::Atom< std::string > processingMode
ProcessingLimits(Config const &config, std::function< input::ItemType()> nextItemType)
bool allowed_(input::ItemType) const noexcept
void issue_reports(unsigned count, EventID const &id)
std::function< input::ItemType()> nextItemType_
int remainingSubRuns() const noexcept
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Definition: MVAAlg.h:12
InputSource::ProcessingMode processingMode() const noexcept
static ProcessingMode mode(std::string const &modeString)
Definition: InputSource.cc:9
int remainingEvents() const noexcept
void update(EventID const &id)