1 #include "artdaq/DAQdata/Globals.hh"
2 #define TRACE_NAME (app_name + "_DataLoggerApp").c_str()
4 #include "artdaq/Application/DataLoggerApp.hh"
5 #include "artdaq/Application/DataLoggerCore.hh"
6 #include "artdaq-core/Utilities/ExceptionHandler.hh"
23 if (DataLogger_ptr_.get() == 0)
27 external_request_status_ = DataLogger_ptr_->initialize(pset);
28 if (!external_request_status_)
30 report_string_ =
"Error initializing ";
31 report_string_.append(app_name +
" ");
32 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
35 return external_request_status_;
41 external_request_status_ = DataLogger_ptr_->start(
id);
42 if (!external_request_status_)
44 report_string_ =
"Error starting ";
45 report_string_.append(app_name +
" ");
46 report_string_.append(
"for run number ");
47 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
48 report_string_.append(
".");
51 return external_request_status_;
57 external_request_status_ = DataLogger_ptr_->stop();
58 if (!external_request_status_)
60 report_string_ =
"Error stopping ";
61 report_string_.append(app_name +
".");
64 return external_request_status_;
70 external_request_status_ = DataLogger_ptr_->pause();
71 if (!external_request_status_)
73 report_string_ =
"Error pausing ";
74 report_string_.append(app_name +
".");
77 return external_request_status_;
83 external_request_status_ = DataLogger_ptr_->resume();
84 if (!external_request_status_)
86 report_string_ =
"Error resuming ";
87 report_string_.append(app_name +
".");
90 return external_request_status_;
96 external_request_status_ = DataLogger_ptr_->shutdown();
97 if (!external_request_status_)
99 report_string_ =
"Error shutting down ";
100 report_string_.append(app_name +
".");
103 return external_request_status_;
118 std::string resultString;
121 if (which ==
"transition_status")
123 if (report_string_.length() > 0) {
return report_string_; }
124 else {
return "Success"; }
136 if (DataLogger_ptr_.get() != 0)
138 resultString.append(DataLogger_ptr_->report(which));
142 resultString.append(
"This DataLogger has not yet been initialized and ");
143 resultString.append(
"therefore can not provide reporting.");
152 external_request_status_ = DataLogger_ptr_->add_config_archive_entry(key, value);
153 if (!external_request_status_)
155 report_string_ =
"Error adding config entry with key ";
156 report_string_.append(key +
" and value \"");
157 report_string_.append(value +
"\" in");
158 report_string_.append(app_name +
".");
161 return external_request_status_;
167 external_request_status_ = DataLogger_ptr_->clear_config_archive();
168 if (!external_request_status_)
170 report_string_ =
"Error clearing the configuration archive in ";
171 report_string_.append(app_name +
".");
174 return external_request_status_;
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the DataLoggerCore.
DataLoggerApp()
DataLoggerApp Constructor.
bool do_shutdown(uint64_t) override
Shutdown the DataLoggerCore.
bool do_soft_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Soft-initialize the DataLoggerCore. No-Op.
bool do_resume(uint64_t, uint64_t) override
Resume the DataLoggerCore.
bool do_pause(uint64_t, uint64_t) override
Pause the DataLoggerCore.
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_reinitialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Reinitialize the DataLoggerCore. No-Op.
bool do_clear_config_archive() override
Clear the configuration archive list in the DataLoggerCore.
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the DataLoggerCore.
bool do_add_config_archive_entry(std::string const &, std::string const &) override
Add the specified configuration archive entry to the DataLoggerCore.
bool do_stop(uint64_t, uint64_t) override
Stop the DataLoggerCore.
DataLoggerCore implements the state machine for the DataLogger artdaq application. DataLoggerCore processes incoming events in one of three roles: Data Logger, Online Monitor, or Dispatcher.