Line data Source code
1 : #include "artdaq/Application/LoadParameterSet.hh"
2 : #include "proto/artdaqapp.hh"
3 :
4 0 : int main(int argc, char* argv[])
5 : try
6 : {
7 : struct Config
8 : {
9 : fhicl::TableFragment<artdaq::artdaqapp::Config> artdaqapp_config;
10 : fhicl::Atom<std::string> app_type{fhicl::Name{"app_type"}, fhicl::Comment{"Type of the artdaq application to run"}, ""};
11 : };
12 :
13 0 : fhicl::ParameterSet config_ps = LoadParameterSet<Config>(argc, argv, "artdaq", "This meta-application may be configured to run any of the core artdaq processes through the \"app_type\" configuration parameter.");
14 0 : artdaq::detail::TaskType task = artdaq::detail::UnknownTask;
15 :
16 0 : if (config_ps.has_key("app_type"))
17 : {
18 0 : task = artdaq::detail::StringToTaskType(config_ps.get<std::string>("app_type", ""));
19 0 : if (task == artdaq::detail::TaskType::UnknownTask)
20 : {
21 0 : task = artdaq::detail::IntToTaskType(config_ps.get<int>("app_type"));
22 : }
23 : }
24 0 : else if (config_ps.has_key("application_type"))
25 : {
26 0 : task = artdaq::detail::StringToTaskType(config_ps.get<std::string>("application_type", ""));
27 0 : if (task == artdaq::detail::TaskType::UnknownTask)
28 : {
29 0 : task = artdaq::detail::IntToTaskType(config_ps.get<int>("application_type"));
30 : }
31 : }
32 0 : artdaq::artdaqapp::runArtdaqApp(task, config_ps);
33 :
34 0 : return 0;
35 0 : }
36 0 : catch (std::exception& ex)
37 : {
38 0 : std::cerr << "Exception caught: " << ex.what() << std::endl;
39 0 : return -1;
40 0 : }
41 0 : catch (...)
42 : {
43 0 : return -1;
44 0 : }
|