artdaq  v3_09_01
DataLoggerCore.cc
1 #include <bitset>
2 #include <cerrno>
3 #include <iomanip>
4 #include <sstream>
5 
6 #include <boost/algorithm/string.hpp>
7 #include <boost/filesystem.hpp>
8 #include <boost/tokenizer.hpp>
9 #include "art/Framework/Art/artapp.h"
10 #include "cetlib/BasicPluginFactory.h"
11 
12 #include "artdaq/DAQdata/Globals.hh" // include these 2 first -
13 #define TRACE_NAME (app_name + "_DataLoggerCore").c_str()
14 #include "artdaq-core/Core/SimpleMemoryReader.hh"
15 #include "artdaq-core/Data/RawEvent.hh"
16 #include "artdaq-core/Utilities/ExceptionHandler.hh"
17 
18 #include "artdaq/Application/DataLoggerCore.hh"
19 #include "artdaq/DAQrate/detail/FragCounter.hh"
20 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
21 
22 bool artdaq::DataLoggerCore::initialize(fhicl::ParameterSet const& pset)
23 {
24  TLOG(TLVL_DEBUG) << "initialize method called with DAQ "
25  << "ParameterSet = \"" << pset.to_string() << "\".";
26 
27  // pull out the relevant parts of the ParameterSet
28  fhicl::ParameterSet daq_pset;
29  try
30  {
31  daq_pset = pset.get<fhicl::ParameterSet>("daq");
32  }
33  catch (...)
34  {
35  TLOG(TLVL_ERROR)
36  << "Unable to find the DAQ parameters in the initialization "
37  << "ParameterSet: \"" + pset.to_string() + "\".";
38  return false;
39  }
40  fhicl::ParameterSet agg_pset;
41  try
42  {
43  agg_pset = daq_pset.get<fhicl::ParameterSet>("datalogger", daq_pset.get<fhicl::ParameterSet>("aggregator"));
44  }
45  catch (...)
46  {
47  TLOG(TLVL_ERROR)
48  << "Unable to find the DataLogger parameters in the DAQ "
49  << "initialization ParameterSet: \"" + daq_pset.to_string() + "\".";
50  return false;
51  }
52 
53  // initialize the MetricManager and the names of our metrics
54  fhicl::ParameterSet metric_pset;
55 
56  try
57  {
58  metric_pset = daq_pset.get<fhicl::ParameterSet>("metrics");
59  }
60  catch (...)
61  {} // OK if there's no metrics table defined in the FHiCL
62 
63  return initializeDataReceiver(pset, agg_pset, metric_pset);
64 }
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.