LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::Schedule Class Reference

#include "Schedule.h"

Public Member Functions

 Schedule (ScheduleID, PathManager &, fhicl::ParameterSet const &, TriggerNamesService const &, MasterProductRegistry &, ProductDescriptions &, ActionTable &, ActivityRegistry &)
 
template<typename T >
void process (typename T::MyPrincipal &)
 
void beginJob ()
 
void endJob ()
 
void respondToOpenInputFile (FileBlock const &)
 
void respondToCloseInputFile (FileBlock const &)
 
void respondToOpenOutputFiles (FileBlock const &)
 
void respondToCloseOutputFiles (FileBlock const &)
 

Private Member Functions

void makeTriggerResultsInserter_ (fhicl::ParameterSet const &trig_pset, MasterProductRegistry &mpr, ProductDescriptions &productsToProduce, ActivityRegistry &areg)
 
template<typename T >
bool runTriggerPaths_ (typename T::MyPrincipal &)
 
template<class F >
void doForAllWorkers_ (F functor)
 
template<class F >
void doForAllEnabledPaths_ (F functor)
 

Private Attributes

ScheduleID const sID_
 
fhicl::ParameterSet process_pset_
 
ActionTableact_table_
 
std::string processName_
 
PathsInfotriggerPathsInfo_
 
std::vector< unsigned char > pathsEnabled_
 
std::unique_ptr< Workerresults_inserter_ {nullptr}
 

Detailed Description

Definition at line 62 of file Schedule.h.

Constructor & Destructor Documentation

art::Schedule::Schedule ( ScheduleID  sID,
PathManager pm,
fhicl::ParameterSet const &  proc_pset,
TriggerNamesService const &  tns,
MasterProductRegistry mpr,
ProductDescriptions productsToProduce,
ActionTable actions,
ActivityRegistry areg 
)

Definition at line 29 of file Schedule.cc.

References act_table_, makeTriggerResultsInserter_(), art::PathsInfo::pathPtrs(), pathsEnabled_, process_pset_, processName_, sID_, and triggerPathsInfo_.

37  : sID_{sID}
38  , process_pset_{proc_pset}
39  , act_table_{&actions}
40  , processName_{tns.getProcessName()}
41  , triggerPathsInfo_{pm.triggerPathsInfo(sID_)}
42  , pathsEnabled_(triggerPathsInfo_.pathPtrs().size(), true)
43 {
44  if (!triggerPathsInfo_.pathPtrs().empty()) {
46  tns.getTriggerPSet(), mpr, productsToProduce, areg);
47  }
48 }
std::vector< unsigned char > pathsEnabled_
Definition: Schedule.h:113
ScheduleID const sID_
Definition: Schedule.h:108
std::string processName_
Definition: Schedule.h:111
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
fhicl::ParameterSet process_pset_
Definition: Schedule.h:109
void makeTriggerResultsInserter_(fhicl::ParameterSet const &trig_pset, MasterProductRegistry &mpr, ProductDescriptions &productsToProduce, ActivityRegistry &areg)
Definition: Schedule.cc:110
ActionTable * act_table_
Definition: Schedule.h:110
PathPtrs const & pathPtrs() const
Definition: PathsInfo.h:87

Member Function Documentation

void art::Schedule::beginJob ( )

Definition at line 104 of file Schedule.cc.

References doForAllWorkers_(), and w.

105 {
106  doForAllWorkers_([](auto w) { w->beginJob(); });
107 }
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t w
Definition: plot.C:23
template<class F >
void art::Schedule::doForAllEnabledPaths_ ( functor)
private

Definition at line 175 of file Schedule.h.

References art::PathsInfo::pathPtrs(), pathsEnabled_, and triggerPathsInfo_.

Referenced by runTriggerPaths_().

176  {
177  size_t path_index = 0;
178  for (auto const& path : triggerPathsInfo_.pathPtrs()) {
179  if (pathsEnabled_[path_index++]) {
180  functor(path.get());
181  }
182  }
183  }
std::vector< unsigned char > pathsEnabled_
Definition: Schedule.h:113
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
PathPtrs const & pathPtrs() const
Definition: PathsInfo.h:87
template<class F >
void art::Schedule::doForAllWorkers_ ( functor)
private

Definition at line 162 of file Schedule.h.

References results_inserter_, triggerPathsInfo_, and art::PathsInfo::workers().

Referenced by beginJob(), endJob(), process(), respondToCloseInputFile(), respondToCloseOutputFiles(), respondToOpenInputFile(), and respondToOpenOutputFiles().

163  {
164  for (auto const& val : triggerPathsInfo_.workers()) {
165  functor(val.second.get());
166  }
167  if (results_inserter_) {
168  // Do this last -- not part of main list.
169  functor(results_inserter_.get());
170  }
171  }
WorkerMap const & workers() const
Definition: PathsInfo.h:81
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
std::unique_ptr< Worker > results_inserter_
Definition: Schedule.h:114
void art::Schedule::endJob ( )

Definition at line 51 of file Schedule.cc.

References doForAllWorkers_(), e, art::Worker::endJob(), art::errors::EndJobFailure, and w.

52 {
53  bool failure = false;
55  doForAllWorkers_([&failure, &error](Worker* w) {
56  try {
57  w->endJob();
58  }
59  catch (cet::exception& e) {
60  error << "cet::exception caught in Schedule::endJob\n"
61  << e.explain_self();
62  failure = true;
63  }
64  catch (std::exception& e) {
65  error << "Standard library exception caught in Schedule::endJob\n"
66  << e.what();
67  failure = true;
68  }
69  catch (...) {
70  error << "Unknown exception caught in Schedule::endJob\n";
71  failure = true;
72  }
73  });
74  if (failure) {
75  throw error;
76  }
77 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t e
Definition: plot.C:34
Float_t w
Definition: plot.C:23
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::Schedule::makeTriggerResultsInserter_ ( fhicl::ParameterSet const &  trig_pset,
MasterProductRegistry mpr,
ProductDescriptions productsToProduce,
ActivityRegistry areg 
)
private

Definition at line 110 of file Schedule.cc.

References act_table_, art::getReleaseVersion(), fhicl::ParameterSet::id(), art::PathsInfo::pathResults(), process_pset_, processName_, results_inserter_, art::ActivityRegistry::sPostModuleConstruction, art::ActivityRegistry::sPreModuleConstruction, and triggerPathsInfo_.

Referenced by Schedule().

115 {
116  WorkerParams const work_args{process_pset_,
117  trig_pset,
118  mpr,
119  productsToProduce,
120  *act_table_,
121  processName_};
122  ModuleDescription md(trig_pset.id(),
123  "TriggerResultInserter",
124  "TriggerResults",
125  ProcessConfiguration(processName_,
126  process_pset_.id(),
127  getReleaseVersion()));
128  areg.sPreModuleConstruction.invoke(md);
129  auto producer = std::make_unique<TriggerResultInserter>(
130  trig_pset, triggerPathsInfo_.pathResults());
132  std::make_unique<WorkerT<EDProducer>>(std::move(producer), md, work_args);
133  areg.sPostModuleConstruction.invoke(md);
134  results_inserter_->setActivityRegistry(cet::make_exempt_ptr(&areg));
135 }
std::string const & getReleaseVersion()
ParameterSetID id() const
std::string processName_
Definition: Schedule.h:111
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
std::unique_ptr< Worker > results_inserter_
Definition: Schedule.h:114
HLTGlobalStatus & pathResults()
Definition: PathsInfo.h:63
fhicl::ParameterSet process_pset_
Definition: Schedule.h:109
ActionTable * act_table_
Definition: Schedule.h:110
template<typename T >
void art::Schedule::process ( typename T::MyPrincipal &  principal)

Definition at line 119 of file Schedule.h.

References act_table_, art::PathsInfo::addEvent(), art::PathsInfo::addPass(), doForAllWorkers_(), e, art::Event, art::actions::FailModule, art::actions::FailPath, art::ActionTable::find(), art::actions::IgnoreCompletely, art::PathsInfo::pathResults(), art::HLTGlobalStatus::reset(), results_inserter_, art::actions::Rethrow, art::actions::SkipEvent, triggerPathsInfo_, and w.

120  {
121  doForAllWorkers_([](auto w) { w->reset(); });
123  if (T::level == Level::Event) {
125  }
126  try {
127  if (runTriggerPaths_<T>(principal) && T::level == Level::Event) {
129  }
130  if (results_inserter_.get()) {
131  results_inserter_->doWork<T>(principal, 0);
132  }
133  }
134  catch (cet::exception& e) {
135  actions::ActionCodes const action = {T::level == Level::Event ?
136  act_table_->find(e.root_cause()) :
138  assert(action != actions::IgnoreCompletely);
139  assert(action != actions::FailPath);
140  assert(action != actions::FailModule);
141  if (action == actions::SkipEvent) {
142  mf::LogWarning(e.category())
143  << "an exception occurred and all paths for "
144  "the event are being skipped: \n"
145  << cet::trim_right_copy(e.what(), " \n");
146  } else {
147  throw;
148  }
149  }
150  }
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:87
void addPass()
Definition: PathsInfo.h:75
void addEvent()
Definition: PathsInfo.h:69
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
std::unique_ptr< Worker > results_inserter_
Definition: Schedule.h:114
HLTGlobalStatus & pathResults()
Definition: PathsInfo.h:63
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t e
Definition: plot.C:34
Float_t w
Definition: plot.C:23
ActionTable * act_table_
Definition: Schedule.h:110
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::Schedule::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 86 of file Schedule.cc.

References doForAllWorkers_(), and w.

87 {
88  doForAllWorkers_([&fb](auto w) { w->respondToCloseInputFile(fb); });
89 }
TFile fb("Li6.root")
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t w
Definition: plot.C:23
void art::Schedule::respondToCloseOutputFiles ( FileBlock const &  fb)

Definition at line 98 of file Schedule.cc.

References doForAllWorkers_(), and w.

99 {
100  doForAllWorkers_([&fb](auto w) { w->respondToCloseOutputFiles(fb); });
101 }
TFile fb("Li6.root")
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t w
Definition: plot.C:23
void art::Schedule::respondToOpenInputFile ( FileBlock const &  fb)

Definition at line 80 of file Schedule.cc.

References doForAllWorkers_(), and w.

81 {
82  doForAllWorkers_([&fb](auto w) { w->respondToOpenInputFile(fb); });
83 }
TFile fb("Li6.root")
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t w
Definition: plot.C:23
void art::Schedule::respondToOpenOutputFiles ( FileBlock const &  fb)

Definition at line 92 of file Schedule.cc.

References doForAllWorkers_(), and w.

93 {
94  doForAllWorkers_([&fb](auto w) { w->respondToOpenOutputFiles(fb); });
95 }
TFile fb("Li6.root")
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
Float_t w
Definition: plot.C:23
template<typename T >
bool art::Schedule::runTriggerPaths_ ( typename T::MyPrincipal &  ep)
inlineprivate

Definition at line 154 of file Schedule.h.

References art::HLTGlobalStatus::accept(), doForAllEnabledPaths_(), art::PathsInfo::pathResults(), and triggerPathsInfo_.

155  {
156  doForAllEnabledPaths_([&ep](auto p) { p->template process<T>(ep); });
158  }
void doForAllEnabledPaths_(F functor)
Definition: Schedule.h:175
PathsInfo & triggerPathsInfo_
Definition: Schedule.h:112
HLTGlobalStatus & pathResults()
Definition: PathsInfo.h:63
bool accept() const

Member Data Documentation

ActionTable* art::Schedule::act_table_
private

Definition at line 110 of file Schedule.h.

Referenced by makeTriggerResultsInserter_(), process(), and Schedule().

std::vector<unsigned char> art::Schedule::pathsEnabled_
private

Definition at line 113 of file Schedule.h.

Referenced by doForAllEnabledPaths_(), and Schedule().

fhicl::ParameterSet art::Schedule::process_pset_
private

Definition at line 109 of file Schedule.h.

Referenced by makeTriggerResultsInserter_(), and Schedule().

std::string art::Schedule::processName_
private

Definition at line 111 of file Schedule.h.

Referenced by makeTriggerResultsInserter_(), and Schedule().

std::unique_ptr<Worker> art::Schedule::results_inserter_ {nullptr}
private

Definition at line 114 of file Schedule.h.

Referenced by doForAllWorkers_(), makeTriggerResultsInserter_(), and process().

ScheduleID const art::Schedule::sID_
private

Definition at line 108 of file Schedule.h.

Referenced by Schedule().

PathsInfo& art::Schedule::triggerPathsInfo_
private

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