LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Schedule.cc
Go to the documentation of this file.
2 // vim: set sw=2:
3 
4 //
5 // Controls the execution of paths and endpaths.
6 //
7 
21 #include "cetlib/exempt_ptr.h"
22 
23 #include <algorithm>
24 #include <cassert>
25 #include <cstdlib>
26 
28 
30  PathManager& pm,
31  ParameterSet const& proc_pset,
32  TriggerNamesService const& tns,
34  ProductDescriptions& productsToProduce,
35  ActionTable& actions,
36  ActivityRegistry& areg)
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 }
49 
50 void
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 }
78 
79 void
81 {
82  doForAllWorkers_([&fb](auto w) { w->respondToOpenInputFile(fb); });
83 }
84 
85 void
87 {
88  doForAllWorkers_([&fb](auto w) { w->respondToCloseInputFile(fb); });
89 }
90 
91 void
93 {
94  doForAllWorkers_([&fb](auto w) { w->respondToOpenOutputFiles(fb); });
95 }
96 
97 void
99 {
100  doForAllWorkers_([&fb](auto w) { w->respondToCloseOutputFiles(fb); });
101 }
102 
103 void
105 {
106  doForAllWorkers_([](auto w) { w->beginJob(); });
107 }
108 
109 void
111  fhicl::ParameterSet const& trig_pset,
113  ProductDescriptions& productsToProduce,
114  ActivityRegistry& areg)
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 }
void endJob()
Definition: Schedule.cc:51
void endJob()
Definition: Worker.cc:68
std::vector< unsigned char > pathsEnabled_
Definition: Schedule.h:113
void respondToCloseOutputFiles(FileBlock const &)
Definition: Schedule.cc:98
Schedule(ScheduleID, PathManager &, fhicl::ParameterSet const &, TriggerNamesService const &, MasterProductRegistry &, ProductDescriptions &, ActionTable &, ActivityRegistry &)
Definition: Schedule.cc:29
void respondToCloseInputFile(FileBlock const &)
Definition: Schedule.cc:86
ScheduleID const sID_
Definition: Schedule.h:108
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleConstruction
std::vector< BranchDescription > ProductDescriptions
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleConstruction
void beginJob()
Definition: Schedule.cc:104
TFile fb("Li6.root")
std::string const & getReleaseVersion()
ParameterSetID id() const
void respondToOpenOutputFiles(FileBlock const &)
Definition: Schedule.cc:92
std::string processName_
Definition: Schedule.h:111
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
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
void doForAllWorkers_(F functor)
Definition: Schedule.h:162
void makeTriggerResultsInserter_(fhicl::ParameterSet const &trig_pset, MasterProductRegistry &mpr, ProductDescriptions &productsToProduce, ActivityRegistry &areg)
Definition: Schedule.cc:110
Float_t e
Definition: plot.C:34
void respondToOpenInputFile(FileBlock const &)
Definition: Schedule.cc:80
Float_t w
Definition: plot.C:23
ActionTable * act_table_
Definition: Schedule.h:110
PathPtrs const & pathPtrs() const
Definition: PathsInfo.h:87
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33