artdaq  v3_07_02
DataReceiverCore.hh
1 #ifndef artdaq_Application_MPI2_DataReceiverCore_hh
2 #define artdaq_Application_MPI2_DataReceiverCore_hh
3 
4 #include <atomic>
5 #include <map>
6 #include <string>
7 
8 #include "canvas/Persistency/Provenance/RunID.h"
9 #include "fhiclcpp/ParameterSet.h"
10 
11 #include "artdaq-utilities/Plugins/MetricManager.hh"
12 
13 #include "artdaq/DAQrate/DataReceiverManager.hh"
14 #include "artdaq/DAQrate/StatisticsHelper.hh"
15 
16 namespace artdaq {
17 class DataReceiverCore;
18 }
19 
25 {
26 public:
31 
35  DataReceiverCore(DataReceiverCore const&) = delete;
36 
40  virtual ~DataReceiverCore();
41 
47 
67  virtual bool initialize(fhicl::ParameterSet const& pset) = 0;
68 
74  bool start(art::RunID id);
75 
80  bool stop();
81 
86  bool pause();
87 
92  bool resume();
93 
98  bool shutdown();
99 
105  bool soft_initialize(fhicl::ParameterSet const& pset);
106 
112  bool reinitialize(fhicl::ParameterSet const& pset);
113 
120  bool rollover_subrun(uint64_t eventNum, uint32_t subrun);
121 
133  std::string report(std::string const& which) const;
134 
141  bool add_config_archive_entry(std::string const& key, std::string const& value)
142  {
143  config_archive_entries_[key] = value;
144  return true;
145  }
146 
152  {
153  config_archive_entries_.clear();
154  return config_archive_entries_.empty();
155  }
156 
157 protected:
165  bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
166 
167  std::unique_ptr<DataReceiverManager> receiver_ptr_;
168  std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
169  std::atomic<bool> stop_requested_;
170  std::atomic<bool> pause_requested_;
171  std::atomic<bool> run_is_paused_;
172  bool verbose_;
173 
174  fhicl::ParameterSet art_pset_;
175  std::map<std::string, std::string> config_archive_entries_;
176 };
177 
178 #endif /* artdaq_Application_MPI2_DataReceiverCore_hh */
DataReceiverCore()
DataReceiverCore Constructor.
std::shared_ptr< SharedMemoryEventManager > event_store_ptr_
Pointer to the SharedMemoryEventManager.
bool soft_initialize(fhicl::ParameterSet const &pset)
Soft-Initializes the DataReceiverCore. No-Op.
DataReceiverCore implements the state machine for the DataReceiver artdaq application. DataReceiverCore receives Fragment objects from the DataReceiverManager, and sends them to the EventStore.
bool resume()
Resumes the DataReceiverCore.
bool shutdown()
Shuts Down the DataReceiverCore.
bool start(art::RunID id)
Start the DataReceiverCore.
fhicl::ParameterSet art_pset_
ParameterSet sent to art process.
std::unique_ptr< DataReceiverManager > receiver_ptr_
Pointer to the DataReceiverManager.
bool stop()
Stops the DataReceiverCore.
std::string report(std::string const &which) const
Send a report on a given run-time quantity.
std::map< std::string, std::string > config_archive_entries_
Additional strings to archive as part of the art configuration.
bool verbose_
Whether to log transition messages.
bool pause()
Pauses the DataReceiverCore.
bool rollover_subrun(uint64_t eventNum, uint32_t subrun)
Rollover the subrun after the given event.
std::atomic< bool > run_is_paused_
Pause has been successfully completed?
DataReceiverCore & operator=(DataReceiverCore const &)=delete
Copy Assignment operator is deleted.
bool add_config_archive_entry(std::string const &key, std::string const &value)
Add the specified key and value to the configuration archive list.
bool initializeDataReceiver(fhicl::ParameterSet const &pset, fhicl::ParameterSet const &data_pset, fhicl::ParameterSet const &metric_pset)
Initialize the DataReceiverCore (should be called from initialize() overrides.
std::atomic< bool > pause_requested_
Pause has been requested?
bool clear_config_archive()
Clear the configuration archive list.
std::atomic< bool > stop_requested_
Stop has been requested?
bool reinitialize(fhicl::ParameterSet const &pset)
Reinitializes the DataReceiverCore.
virtual bool initialize(fhicl::ParameterSet const &pset)=0
Processes the initialize request.