Belle II Software  release-08-00-10
basf2_mva_expert.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <iostream>
10 #include <vector>
11 
12 #include <mva/utility/Utility.h>
13 
14 namespace po = boost::program_options;
15 using namespace Belle2::MVA;
16 
17 int main(int argc, char* argv[])
18 {
19 
20  std::vector<std::string> filenames;
21  std::vector<std::string> datafiles;
22  std::string treename = "variables";
23  std::string outputfile;
24  bool copy_target = true;
25 
26  po::options_description description("Options");
27  description.add_options()
28  ("help", "print this message")
29  ("identifiers", po::value<std::vector<std::string>>(&filenames)->multitoken(), "Identifiers of the trained methods")
30  ("datafiles", po::value<std::vector<std::string>>(&datafiles)->multitoken()->required(),
31  "ROOT files containing the dataset")
32  ("treename", po::value<std::string>(&treename), "Name of tree in ROOT datafile")
33  ("outputfile", po::value<std::string>(&outputfile)->required(), "ROOT file containing the results")
34  ("copy_target", po::value<bool>(&copy_target), "defines if the target variable should be copied");
35 
36  po::variables_map vm;
37 
38  try {
39  po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).run();
40  po::store(parsed, vm);
41 
42  if (vm.count("help")) {
43  std::cout << description << std::endl;
44  return 1;
45  }
46  po::notify(vm);
47  } catch (po::error& err) {
48  std::cerr << "Error: " << err.what() << "\n";
49  return 1;
50  }
51 
52  Belle2::MVA::Utility::expert(filenames, datafiles, treename, outputfile, 0, 0, 0, copy_target);
53  return 0;
54 
55 }
56 
static void expert(const std::vector< std::string > &filenames, const std::vector< std::string > &datafiles, const std::string &treename, const std::string &outputfile, int experiment=0, int run=0, int event=0, bool copy_target=true)
Convenience function applies experts on given data.
Definition: Utility.cc:138
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91