EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommandLineArguments.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CommandLineArguments.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include "CommandLineArguments.h"
10 
12 
13 #include <fstream>
14 #include <iostream>
15 
16 #include <boost/program_options.hpp>
17 #include <boost/type_erasure/any_cast.hpp>
18 
19 namespace po = boost::program_options;
20 
21 void CommandLineArguments::parse(int argc, char** argv) {
22  po::options_description optionsDescription("Allowed options");
23  optionsDescription.add_options()("help,h", "Print usage message.")(
24  "FILE,f", po::value<std::string>()->default_value(""),
25  "Provide path for input file.")(
26  "NUM,n", po::value<unsigned int>()->default_value(500),
27  "Number of groups to iterate in seed finding.")(
28  "DEVICE,d", po::value<std::string>()->default_value(""),
29  "Provide a substring of the preferred device.")(
30  "LIST,l", "List available SYCL platforms and devices.")(
31  "GPU,G", po::bool_switch(), "Execute code only on gpu. Default is 0.")(
32  "ALL,a", po::bool_switch(), "Analyze all groups. Default is 0.")(
33  "MATCH,m", po::bool_switch(), "Count seed matches. Default is 0.")(
34  "CSV,c", po::bool_switch(), "Output results in csv format");
35 
36  po::variables_map vm;
37  po::store(po::parse_command_line(argc, argv, optionsDescription), vm);
38  po::notify(vm);
39 
40  if (vm.count("help") != 0) {
41  std::cout << optionsDescription << "\n";
42  exit(0);
43  }
44 
45  if (vm.count("LIST") != 0) {
47  exit(0);
48  }
49 
50  onlyGpu = vm["GPU"].as<bool>();
51  matches = vm["MATCH"].as<bool>();
52  groups = vm["NUM"].as<unsigned int>();
53  deviceName = vm["DEVICE"].as<std::string>();
54  allgroup = vm["ALL"].as<bool>();
55  csvFormat = vm["CSV"].as<bool>();
56  inpFileName = vm["FILE"].as<std::string>();
57  std::ifstream s(inpFileName);
58  inpFileExists = s.good();
59 }