1 #include "TRACE/tracemf.h"
2 #include "artdaq/DAQdata/Globals.hh"
3 #define TRACE_NAME (app_name + "_DataLoggerApp").c_str()
5 #include "artdaq/Application/EventBuilderApp.hh"
7 #include "fhiclcpp/ParameterSet.h"
9 #include <boost/lexical_cast.hpp>
30 if (event_builder_ptr_ ==
nullptr)
32 event_builder_ptr_ = std::make_unique<EventBuilderCore>();
39 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
48 external_request_status_ = event_builder_ptr_->start(
id);
49 if (!external_request_status_)
51 report_string_ =
"Error starting ";
52 report_string_.append(app_name +
" for run ");
53 report_string_.append(
"number ");
54 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
55 report_string_.append(
".");
58 return external_request_status_;
64 external_request_status_ = event_builder_ptr_->stop();
65 if (!external_request_status_)
67 report_string_ =
"Error stopping ";
68 report_string_.append(app_name +
".");
70 return external_request_status_;
76 external_request_status_ = event_builder_ptr_->pause();
77 if (!external_request_status_)
79 report_string_ =
"Error pausing ";
80 report_string_.append(app_name +
".");
83 return external_request_status_;
89 external_request_status_ = event_builder_ptr_->resume();
90 if (!external_request_status_)
92 report_string_ =
"Error resuming ";
93 report_string_.append(app_name +
".");
96 return external_request_status_;
102 external_request_status_ = event_builder_ptr_->shutdown();
103 if (!external_request_status_)
105 report_string_ =
"Error shutting down ";
106 report_string_.append(app_name +
".");
108 return external_request_status_;
114 external_request_status_ = event_builder_ptr_->soft_initialize(pset);
115 if (!external_request_status_)
117 report_string_ =
"Error soft-initializing ";
118 report_string_.append(app_name +
" with ");
119 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
121 return external_request_status_;
127 external_request_status_ = event_builder_ptr_->reinitialize(pset);
128 if (!external_request_status_)
130 report_string_ =
"Error reinitializing ";
131 report_string_.append(app_name +
" with ");
132 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
134 return external_request_status_;
139 TLOG(TLVL_DEBUG + 32) <<
"do_rollover_subrun BEGIN boundary=" << boundary <<
", subrun=" << subrun;
141 external_request_status_ = event_builder_ptr_->rollover_subrun(boundary, subrun);
142 if (!external_request_status_)
144 report_string_ =
"Error rolling over subrun in ";
145 report_string_.append(app_name +
"!");
147 TLOG(TLVL_DEBUG + 32) <<
"do_rollover_subrun END sts=" << std::boolalpha << external_request_status_;
148 return external_request_status_;
153 TLOG(TLVL_DEBUG + 32, app_name +
"App") <<
"Booted state entry action called.";
164 std::string resultString;
167 if (which ==
"transition_status")
169 if (report_string_.length() > 0) {
return report_string_; }
183 if (event_builder_ptr_ !=
nullptr)
185 resultString.append(event_builder_ptr_->report(which));
189 resultString.append(
"This EventBuilder has not yet been initialized and ");
190 resultString.append(
"therefore can not provide reporting.");
199 external_request_status_ = event_builder_ptr_->add_config_archive_entry(key, value);
200 if (!external_request_status_)
202 report_string_ =
"Error adding config entry with key ";
203 report_string_.append(key +
" and value \"");
204 report_string_.append(value +
"\" in");
205 report_string_.append(app_name +
".");
208 return external_request_status_;
214 external_request_status_ = event_builder_ptr_->clear_config_archive();
215 if (!external_request_status_)
217 report_string_ =
"Error clearing the configuration archive in ";
218 report_string_.append(app_name +
".");
221 return external_request_status_;
bool do_resume(uint64_t, uint64_t) override
Resume the EventBuilderCore.
void BootedEnter() override
Action taken upon entering the "Booted" state.
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 &pset, uint64_t, uint64_t) override
Reinitialize the EventBuilderCore.
bool do_shutdown(uint64_t) override
Shutdown the EventBuilderCore.
bool external_request_status_
Whether the last command succeeded.
bool do_pause(uint64_t, uint64_t) override
Pause the EventBuilderCore.
bool do_soft_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Soft-Initialize the EventBuilderCore.
bool do_add_config_archive_entry(std::string const &, std::string const &) override
Add the specified configuration archive entry to the EventBuilderCore.
EventBuilderApp()
EventBuilderApp Constructor.
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the EventBuilderCore.
std::string report_string_
Status information about the last command.
bool do_clear_config_archive() override
Clear the configuration archive list in the EventBuilderCore.
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the EventBuilderCore.
bool do_rollover_subrun(uint64_t boundary, uint32_t subrunNum) override
Rollover the subrun after the given event.
bool do_stop(uint64_t, uint64_t) override
Stop the EventBuilderCore.