artdaq  v3_09_04
EventBuilderCore.cc
1 #include "art/Framework/Art/artapp.h"
2 #include "canvas/Utilities/Exception.h"
3 
4 #include "artdaq/DAQdata/Globals.hh" // include these 2 first -
5 #define TRACE_NAME (app_name + "_EventBuilderCore").c_str()
6 #include "artdaq-core/Utilities/ExceptionHandler.hh"
7 
8 #include "artdaq/Application/EventBuilderCore.hh"
9 #include "artdaq/TransferPlugins/TransferInterface.hh"
10 
11 #include <iomanip>
12 
13 bool artdaq::EventBuilderCore::initialize(fhicl::ParameterSet const& pset)
14 {
15  TLOG(TLVL_DEBUG) << "initialize method called with DAQ "
16  << "ParameterSet = \"" << pset.to_string() << "\".";
17 
18  // pull out the relevant parts of the ParameterSet
19  fhicl::ParameterSet daq_pset;
20  try
21  {
22  daq_pset = pset.get<fhicl::ParameterSet>("daq");
23  }
24  catch (...)
25  {
26  TLOG(TLVL_ERROR)
27  << "Unable to find the DAQ parameters in the initialization "
28  << "ParameterSet: \"" + pset.to_string() + "\".";
29  return false;
30  }
31  fhicl::ParameterSet evb_pset;
32  try
33  {
34  evb_pset = daq_pset.get<fhicl::ParameterSet>("event_builder");
35 
36  // We are going to change the default from true to false for the "send_init_fragments" parameter
37  // EventBuilders almost always do NOT receive init Fragments from upstream to send to art
38  if (!evb_pset.has_key("send_init_fragments"))
39  {
40  evb_pset.put<bool>("send_init_fragments", false);
41  }
42  }
43  catch (...)
44  {
45  TLOG(TLVL_ERROR)
46  << "Unable to find the event_builder parameters in the DAQ "
47  << "initialization ParameterSet: \"" + daq_pset.to_string() + "\".";
48  return false;
49  }
50 
51  fhicl::ParameterSet metric_pset;
52  try
53  {
54  metric_pset = daq_pset.get<fhicl::ParameterSet>("metrics");
55  }
56  catch (...)
57  {} // OK if there's no metrics table defined in the FHiCL
58 
59  return initializeDataReceiver(pset, evb_pset, metric_pset);
60 }
bool initialize(fhicl::ParameterSet const &pset) override
Processes the initialize request.
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.