1 #define TRACE_NAME (app_name + "_DataLoggerApp").c_str() // include these 2 first -
2 #include "artdaq/DAQdata/Globals.hh"
4 #include "artdaq/Application/EventBuilderApp.hh"
17 external_request_status_ =
true;
24 if (event_builder_ptr_.get() == 0)
27 external_request_status_ = event_builder_ptr_->initialize(pset);
29 if (! external_request_status_)
31 report_string_ =
"Error initializing an EventBuilderCore named";
32 report_string_.append(app_name +
" with ");
33 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
36 return external_request_status_;
42 external_request_status_ = event_builder_ptr_->start(
id);
43 if (! external_request_status_)
45 report_string_ =
"Error starting ";
46 report_string_.append(app_name +
" for run ");
47 report_string_.append(
"number ");
48 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
49 report_string_.append(
".");
52 return external_request_status_;
58 external_request_status_ = event_builder_ptr_->stop();
59 if (! external_request_status_)
61 report_string_ =
"Error stopping ";
62 report_string_.append(app_name +
".");
64 return external_request_status_;
70 external_request_status_ = event_builder_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_ = event_builder_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_ = event_builder_ptr_->shutdown();
97 if (! external_request_status_)
99 report_string_ =
"Error shutting down ";
100 report_string_.append(app_name +
".");
102 return external_request_status_;
108 external_request_status_ = event_builder_ptr_->soft_initialize(pset);
109 if (! external_request_status_)
111 report_string_ =
"Error soft-initializing ";
112 report_string_.append(app_name +
" with ");
113 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
115 return external_request_status_;
121 external_request_status_ = event_builder_ptr_->reinitialize(pset);
122 if (! external_request_status_)
124 report_string_ =
"Error reinitializing ";
125 report_string_.append(app_name +
" with ");
126 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
128 return external_request_status_;
133 TLOG(TLVL_DEBUG) <<
"do_rollover_subrun BEGIN boundary=" << boundary;
135 external_request_status_ = event_builder_ptr_->rollover_subrun(boundary);
136 if (!external_request_status_)
138 report_string_ =
"Error rolling over subrun in ";
139 report_string_.append(app_name +
"!");
141 TLOG(TLVL_DEBUG) <<
"do_rollover_subrun END sts=" << std::boolalpha << external_request_status_;
142 return external_request_status_;
147 TLOG_DEBUG(app_name +
"App") <<
"Booted state entry action called." ;
158 std::string resultString;
161 if (which ==
"transition_status")
163 if (report_string_.length() > 0) {
return report_string_; }
164 else {
return "Success"; }
176 if (event_builder_ptr_.get() !=
nullptr)
178 resultString.append(event_builder_ptr_->report(which));
182 resultString.append(
"This EventBuilder has not yet been initialized and ");
183 resultString.append(
"therefore can not provide reporting.");
192 external_request_status_ = event_builder_ptr_->add_config_archive_entry(key, value);
193 if (!external_request_status_)
195 report_string_ =
"Error adding config entry with key ";
196 report_string_.append(key +
" and value \"");
197 report_string_.append(value +
"\" in");
198 report_string_.append(app_name +
".");
201 return external_request_status_;
207 external_request_status_ = event_builder_ptr_->clear_config_archive();
208 if (!external_request_status_)
210 report_string_ =
"Error clearing the configuration archive in ";
211 report_string_.append(app_name +
".");
214 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 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.
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 eventNum) override
Rollover the subrun after the given event.
EventBuilderCore implements the state machine for the EventBuilder artdaq application. EventBuilderCore receives Fragment objects from the DataReceiverManager, and sends them to the EventStore.
bool do_stop(uint64_t, uint64_t) override
Stop the EventBuilderCore.