Belle II Software  release-05-01-25
basf2_mva_expert.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Keck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <iostream>
12 #include <vector>
13 
14 #include <mva/utility/Utility.h>
15 
16 namespace po = boost::program_options;
17 using namespace Belle2::MVA;
18 
19 int main(int argc, char* argv[])
20 {
21 
22  std::vector<std::string> filenames;
23  std::vector<std::string> datafiles;
24  std::string treename = "variables";
25  std::string outputfile;
26  bool copy_target = true;
27 
28  po::options_description description("Options");
29  description.add_options()
30  ("help", "print this message")
31  ("identifiers", po::value<std::vector<std::string>>(&filenames)->multitoken(), "Identifiers of the trained methods")
32  ("datafiles", po::value<std::vector<std::string>>(&datafiles)->multitoken()->required(),
33  "ROOT files containing the dataset")
34  ("treename", po::value<std::string>(&treename), "Name of tree in ROOT datafile")
35  ("outputfile", po::value<std::string>(&outputfile)->required(), "ROOT file containing the results")
36  ("copy_target", po::value<bool>(&copy_target), "defines if the target variable should be copied");
37 
38  po::variables_map vm;
39 
40  try {
41  po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).run();
42  po::store(parsed, vm);
43 
44  if (vm.count("help")) {
45  std::cout << description << std::endl;
46  return 1;
47  }
48  po::notify(vm);
49  } catch (po::error& err) {
50  std::cerr << "Error: " << err.what() << "\n";
51  return 1;
52  }
53 
54  Belle2::MVA::expert(filenames, datafiles, treename, outputfile, 0, 0, 0, copy_target);
55  return 0;
56 
57 }
58 
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77