Project
Loading...
Searching...
No Matches
rawReaderCRU.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
19
20namespace bpo = boost::program_options;
21using namespace o2::tpc;
23
24int main(int argc, char** argv)
25{
26 bpo::variables_map vm;
27 bpo::options_description opt_general("Usage:\n " + std::string(argv[0]) +
28 " <cmds/options>\n"
29 " Tool will decode the GBTx data for SAMPA 0\n"
30 "Commands / Options");
31 bpo::options_description opt_hidden("");
32 bpo::options_description opt_all;
33 bpo::positional_options_description opt_pos;
34
35 try {
36 auto add_option = opt_general.add_options();
37 add_option("help,h", "Print this help message");
38 add_option("verbose,v", bpo::value<uint32_t>()->default_value(0), "Select verbosity level [0 = no output]");
39 add_option("version", "Print version information");
40 add_option("input-file,i", bpo::value<std::string>()->required(), "Specifies input file.");
41 add_option("output-file,o", bpo::value<std::string>(), "Specify output file prefix (defaults to (dirname+basename) of input-file)");
42 add_option("timebins,t", bpo::value<uint32_t>()->default_value(0), "Number of timebins to decode [0 = complete file]");
43 add_option("debug,d", bpo::value<uint32_t>()->default_value(0), "Select debug output level [0 = no debug output]");
44 add_option("stream,s", bpo::value<uint32_t>()->default_value(0), "Stream to decode [default = 0]");
45 add_option("link,l", bpo::value<uint32_t>()->default_value(0), "GBT link to decode [default = 0]");
46 add_option("json", "Output results as json (if applicable)");
47
48 opt_all.add(opt_general).add(opt_hidden);
49 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
50
51 if (vm.count("help") || argc == 1) {
52 std::cout << opt_general << std::endl;
53 exit(0);
54 }
55
56 if (vm.count("version")) {
57 //std::cout << GitInfo();
58 exit(0);
59 }
60
61 bpo::notify(vm);
62 } catch (bpo::error& e) {
63 std::cerr << "ERROR: " << e.what() << std::endl
64 << std::endl;
65 std::cerr << opt_general << std::endl;
66 exit(1);
67 } catch (std::exception& e) {
68 std::cerr << e.what() << ", application will now exit" << std::endl;
69 exit(2);
70 }
71
73 vm["input-file"].as<std::string>(),
74 vm["timebins"].as<uint32_t>(),
75 vm["link"].as<uint32_t>(),
76 vm["stream"].as<uint32_t>(),
77 vm["debug"].as<uint32_t>(),
78 vm["verbose"].as<uint32_t>(),
79 vm.count("output-file") ? vm["output-file"].as<std::string>() : "");
80
81 return 0;
82}
Reader for RAW TPC data.
static void processFile(const std::string_view inputFile, uint32_t timeBins=0, uint32_t linkMask=0, uint32_t stream=0, uint32_t debugLevel=0, uint32_t verbosity=0, const std::string_view outputFilePrefix="")
Global TPC definitions and constants.
Definition SimTraits.h:167
#define main