artdaq  v3_00_01
boardreader.cc
1 #include "artdaq/Application/TaskType.hh"
2 #include "artdaq/Application/BoardReaderApp.hh"
3 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh"
4 #include "artdaq/Application/LoadParameterSet.hh"
5 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
6 #include "artdaq/DAQdata/Globals.hh"
7 #include "cetlib_except/exception.h"
8 
9 #include <boost/program_options.hpp>
10 #include <boost/lexical_cast.hpp>
11 
12 #include <iostream>
13 #include <memory>
14 
15 int main(int argc, char* argv[])
16 {
17  artdaq::configureMessageFacility("boardreader");
18 
19  fhicl::ParameterSet config = LoadParameterSet(argc, argv);
20 
21  std::string name = config.get<std::string>("application_name", "BoardReader");
22  auto rank = config.get<int>("rank", 0);
23  TLOG_DEBUG(name + "Main") << "Setting application name to " << name << TLOG_ENDL;
24 
25  TLOG_DEBUG(name + "Main") << "artdaq version " <<
27  << ", built " <<
28  artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp() << TLOG_ENDL;
29 
30  artdaq::setMsgFacAppName(name, config.get<int>("id"));
31 
32  // create the BoardReaderApp
33  artdaq::BoardReaderApp br_app(rank, name);
34 
35 
36  auto auto_run = config.get<bool>("auto_run", false);
37  if (auto_run) {
38  int run = config.get<int>("run_number", 101);
39  uint64_t timeout = config.get<uint64_t>("transition_timeout", 30);
40  uint64_t timestamp = 0;
41 
42  br_app.do_initialize(config, timeout, timestamp);
43  br_app.do_start(art::RunID(run), timeout, timestamp);
44 
45  TLOG_INFO(name) << "Running XMLRPC Commander. To stop, either Control-C or " << std::endl
46  << "xmlrpc http://`hostname`:" << config.get<int>("id") << "/RPC2 daq.stop" << std::endl
47  << "xmlrpc http://`hostname`:" << config.get<int>("id") << "/RPC2 daq.shutdown" << TLOG_ENDL;
48  }
49 
50  auto commander = artdaq::MakeCommanderPlugin(config, br_app);
51  commander->run_server();
52 }
BoardReaderApp is an artdaq::Commandable derived class which controls the BoardReaderCore state machi...
static artdaq::PackageBuildInfo getPackageBuildInfo()
Gets the version number and build timestmap for artdaq.
std::unique_ptr< artdaq::CommanderInterface > MakeCommanderPlugin(const fhicl::ParameterSet &commander_pset, artdaq::Commandable &commandable)
Load a CommanderInterface plugin.