1 #include "artdaq/Application/AggregatorApp.hh"
2 #include "artdaq/Application/AggregatorCore.hh"
3 #include "artdaq-core/Utilities/ExceptionHandler.hh"
21 if (aggregator_ptr_.get() == 0)
25 external_request_status_ = aggregator_ptr_->initialize(pset);
26 if (!external_request_status_)
28 report_string_ =
"Error initializing ";
29 report_string_.append(name_ +
" ");
30 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
33 return external_request_status_;
39 external_request_status_ = aggregator_ptr_->start(
id);
40 if (!external_request_status_)
42 report_string_ =
"Error starting ";
43 report_string_.append(name_ +
" ");
44 report_string_.append(
"for run number ");
45 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
46 report_string_.append(
".");
51 aggregator_ptr_.get());
53 return external_request_status_;
59 external_request_status_ = aggregator_ptr_->stop();
60 if (!external_request_status_)
62 report_string_ =
"Error stopping ";
63 report_string_.append(name_ +
".");
66 if (aggregator_future_.valid())
68 aggregator_future_.get();
70 return external_request_status_;
76 external_request_status_ = aggregator_ptr_->pause();
77 if (!external_request_status_)
79 report_string_ =
"Error pausing ";
80 report_string_.append(name_ +
".");
83 if (aggregator_future_.valid())
85 aggregator_future_.get();
87 return external_request_status_;
93 external_request_status_ = aggregator_ptr_->resume();
94 if (!external_request_status_)
96 report_string_ =
"Error resuming ";
97 report_string_.append(name_ +
".");
102 aggregator_ptr_.get());
104 return external_request_status_;
110 external_request_status_ = aggregator_ptr_->shutdown();
111 if (!external_request_status_)
113 report_string_ =
"Error shutting down ";
114 report_string_.append(name_ +
".");
117 return external_request_status_;
132 std::string resultString;
135 if (which ==
"transition_status")
137 if (report_string_.length() > 0) {
return report_string_; }
138 else {
return "Success"; }
150 if (aggregator_ptr_.get() != 0)
152 resultString.append(aggregator_ptr_->report(which));
156 resultString.append(
"This Aggregator has not yet been initialized and ");
157 resultString.append(
"therefore can not provide reporting.");
165 TLOG_DEBUG(name_) <<
"AggregatorApp::register_monitor called with argument \"" << info.to_string() <<
"\"" << TLOG_ENDL;
171 return aggregator_ptr_->register_monitor(info);
175 ExceptionHandler(ExceptionHandlerRethrow::no,
176 "Error in call to AggregatorCore's register_monitor function");
178 return "Error in artdaq::AggregatorApp::register_monitor: an exception was thrown in the call to AggregatorCore::register_monitor, possibly due to a problem with the argument";
183 return "Error in artdaq::AggregatorApp::register_monitor: AggregatorCore object wasn't initialized";
190 TLOG_DEBUG(name_) <<
"AggregatorApp::unregister_monitor called with argument \"" << label <<
"\"" << TLOG_ENDL;
196 return aggregator_ptr_->unregister_monitor(label);
200 ExceptionHandler(ExceptionHandlerRethrow::no,
201 "Error in call to AggregatorCore's unregister_monitor function");
203 return "Error in artdaq::AggregatorApp::unregister_monitor: an exception was thrown in the call to AggregatorCore::unregister_monitor, possibly due to a problem with the argument";
208 return "Error in artdaq::AggregatorApp::unregister_monitor: AggregatorCore object wasn't initialized";
bool do_reinitialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Reinitialize the AggregatorCore. No-Op.
std::string register_monitor(fhicl::ParameterSet const &info) override
Register an art Online Monitor to the AggregatorCore.
bool do_pause(uint64_t, uint64_t) override
Pause the AggregatorCore.
bool do_resume(uint64_t, uint64_t) override
Resume the AggregatorCore.
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the AggregatorCore.
AggregatorApp(int rank, std::string name)
AggregatorApp Constructor.
std::string report(std::string const &which) const override
If which is "transition_status", report the status of the last transition. Otherwise pass through to ...
bool do_stop(uint64_t, uint64_t) override
Stop the AggregatorCore.
bool do_shutdown(uint64_t) override
Shutdown the AggregatorCore.
std::string unregister_monitor(std::string const &label) override
Remove an art Online Monitor from the AggregatorCore.
AggregatorCore implements the state machine for the Aggregator artdaq application. AggregatorCore processes incoming events in one of three roles: Data Logger, Online Monitor, or Dispatcher.
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the AggregatorCore.
bool do_soft_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Soft-initialize the AggregatorCore. No-Op.
size_t process_fragments()
The main working loop of the AggregatorCore. Receives events from DataReceiverManager and processes t...