Project
Loading...
Searching...
No Matches
populateCCDB.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
12// executable to populate the CCDB emulating the rates that we expect for
13// Run 3, as read (in terms of size and rate) from an external file
14
15#include "populateCCDB.C"
16#include <TRandom.h>
17#include <boost/program_options.hpp>
18#include <iostream>
19
20namespace bpo = boost::program_options;
21
22bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv[], bpo::variables_map& vm)
23{
24 options.add_options()(
25 "ccdb-server,s", bpo::value<std::string>()->default_value("http://ccdb-test.cern.ch:8080"), "CCDB server")(
26 "in-file-name,n", bpo::value<std::string>()->default_value("cdbSizeV0.txt"), "File name with list of CCDB entries to upload")(
27 "help,h", "Produce help message.");
28
29 try {
30 bpo::store(parse_command_line(argc, argv, options), vm);
31
32 // help
33 if (vm.count("help")) {
34 std::cout << options << std::endl;
35 return false;
36 }
37
38 bpo::notify(vm);
39 } catch (const bpo::error& e) {
40 std::cerr << e.what() << "\n\n";
41 std::cerr << "Error parsing command line arguments; Available options:\n";
42
43 std::cerr << options << std::endl;
44 return false;
45 }
46 return true;
47}
48
49int main(int argc, char* argv[])
50{
51 bpo::options_description options("Allowed options");
52 bpo::variables_map vm;
53 if (!initOptionsAndParse(options, argc, argv, vm)) {
54 return -1;
55 }
56
57 // call populate "macro"
58 auto& inputFile = vm["in-file-name"].as<std::string>();
59 auto& ccdbHost = vm["ccdb-server"].as<std::string>();
60 populateCCDB(inputFile, ccdbHost);
61
62 return (0);
63}
bool initOptionsAndParse(bpo::options_description &options, int argc, char *argv[], bpo::variables_map &vm)
#define main