Project
Loading...
Searching...
No Matches
digi2raw.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#include <boost/program_options.hpp>
17#include <iostream>
19
20namespace bpo = boost::program_options;
21
22int main(int argc, char** argv)
23{
24 bpo::variables_map vm;
25 bpo::options_description opt_general("Usage:\n" + std::string(argv[0]) +
26 "Convert TOF digits to CRU raw data\n");
27 bpo::options_description opt_hidden("");
28 bpo::options_description opt_all;
29 bpo::positional_options_description opt_pos;
30
31 try {
32 auto add_option = opt_general.add_options();
33 add_option("help,h", "Print this help message");
34 add_option("output-dir,o", bpo::value<std::string>()->default_value("./"), "output directory for raw data");
35 add_option("file-for,f", bpo::value<std::string>()->default_value("cru"), "single file per: all,cru,link");
36 add_option("configKeyValues", bpo::value<std::string>()->default_value(""), "comma-separated configKeyValues");
37 //add_option("hbfutils-config,u", bpo::value<std::string>()->default_value(std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE)), "config file for HBFUtils (or none)");
38 add_option("hbfutils-config,u", bpo::value<std::string>()->default_value("none"), "config file for HBFUtils (or none)");
39 opt_all.add(opt_general).add(opt_hidden);
40 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
41
42 if (vm.count("help")) {
43 std::cout << opt_general << std::endl;
44 exit(0);
45 }
46
47 bpo::notify(vm);
48 } catch (bpo::error& e) {
49 std::cerr << "ERROR: " << e.what() << std::endl
50 << std::endl;
51 std::cerr << opt_general << std::endl;
52 exit(1);
53 } catch (std::exception& e) {
54 std::cerr << e.what() << ", application will now exit" << std::endl;
55 exit(2);
56 }
57
58 auto cmd = o2::utils::Str::concat_string("o2-tof-reco-workflow -b --output-type raw --tof-raw-outdir ", vm["output-dir"].as<std::string>(),
59 " --file-for ", vm["file-for"].as<std::string>(),
60 " --hbfutils-config ", vm["hbfutils-config"].as<std::string>(),
61 R"( --configKeyValues ")", vm["configKeyValues"].as<std::string>(), '"');
62 return system(cmd.c_str());
63}
static std::string concat_string(Ts const &... ts)
#define main