1 #include "artdaq/Application/EventBuilderApp.hh"
14 external_request_status_ =
true;
21 if (event_builder_ptr_.get() == 0)
24 external_request_status_ = event_builder_ptr_->initialize(pset);
26 if (! external_request_status_)
28 report_string_ =
"Error initializing an EventBuilderCore named";
29 report_string_.append(name_ +
" with ");
30 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
33 return external_request_status_;
39 external_request_status_ = event_builder_ptr_->start(
id);
40 if (! external_request_status_)
42 report_string_ =
"Error starting ";
43 report_string_.append(name_ +
" for run ");
44 report_string_.append(
"number ");
45 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
46 report_string_.append(
".");
49 event_building_future_ =
51 event_builder_ptr_.get());
53 return external_request_status_;
59 external_request_status_ = event_builder_ptr_->stop();
60 if (! external_request_status_)
62 report_string_ =
"Error stopping ";
63 report_string_.append(name_ +
".");
66 if (event_building_future_.valid())
68 event_building_future_.get();
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(name_ +
".");
83 if (event_building_future_.valid())
85 event_building_future_.get();
87 return external_request_status_;
93 external_request_status_ = event_builder_ptr_->resume();
94 if (! external_request_status_)
96 report_string_ =
"Error resuming ";
97 report_string_.append(name_ +
".");
100 event_building_future_ =
102 event_builder_ptr_.get());
104 return external_request_status_;
110 external_request_status_ = event_builder_ptr_->shutdown();
111 if (! external_request_status_)
113 report_string_ =
"Error shutting down ";
114 report_string_.append(name_ +
".");
116 return external_request_status_;
122 external_request_status_ = event_builder_ptr_->soft_initialize(pset);
123 if (! external_request_status_)
125 report_string_ =
"Error soft-initializing ";
126 report_string_.append(name_ +
" with ");
127 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
129 return external_request_status_;
135 external_request_status_ = event_builder_ptr_->reinitialize(pset);
136 if (! external_request_status_)
138 report_string_ =
"Error reinitializing ";
139 report_string_.append(name_ +
" with ");
140 report_string_.append(
"ParameterSet = \"" + pset.to_string() +
"\".");
142 return external_request_status_;
147 TLOG_DEBUG(name_ +
"App") <<
"Booted state entry action called." << TLOG_ENDL;
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.");
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.
EventBuilderApp(int rank, std::string name)
EventBuilderApp Constructor.
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the EventBuilderCore.
size_t process_fragments()
The main loop of the EventBuilderCore. Receives Fragment objects from DataReceiverManager and enqueue...
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the EventBuilderCore.
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.