Belle II Software  release-08-01-10
basf2_mva_extract.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::string directory;
22 
23  po::options_description description("Options");
24  description.add_options()
25  ("help", "print this message")
26  ("identifiers", po::value<std::vector<std::string>>(&filenames)->multitoken(), "Identifiers of the trained methods")
27  ("directory", po::value<std::string>(&directory)->required(),
28  "Directory which will contain the temporary directories generated by the the mva package");
29 
30  po::variables_map vm;
31 
32  try {
33  po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).run();
34  po::store(parsed, vm);
35 
36  if (vm.count("help")) {
37  std::cout << description << std::endl;
38  return 1;
39  }
40  po::notify(vm);
41  } catch (po::error& err) {
42  std::cerr << "Error: " << err.what() << "\n";
43  return 1;
44  }
45 
46  for (const auto& filename : filenames)
47  Belle2::MVA::Utility::extract(filename, directory);
48  return 0;
49 
50 }
51 
static void extract(const std::string &filename, const std::string &directory)
Convenience function which extracts the expertise in a given weightfile into a temporary directory.
Definition: Utility.cc:83
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91