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