11 #include <mva/interface/Interface.h>
12 #include <mva/interface/Options.h>
13 #include <mva/utility/Utility.h>
19 namespace po = boost::program_options;
20 using namespace Belle2::MVA;
22 int main(
int argc,
char* argv[])
28 po::options_description general_description(general_options.getDescription());
31 po::options_description meta_description(meta_options.getDescription());
38 std::map<std::string, std::unique_ptr<SpecificOptions>> specific_options;
41 specific_options.emplace(interface.second->getName(), interface.second->getOptions());
47 po::options_description cmdline_description;
48 cmdline_description.add(general_description);
49 cmdline_description.add(meta_description);
51 po::parsed_options parsed = po::command_line_parser(argc, argv).options(cmdline_description).allow_unregistered().run();
52 po::store(parsed, vm);
54 if (vm.count(
"help")) {
55 if (vm.count(
"method")) {
56 std::string method = vm[
"method"].as<std::string>();
57 if (specific_options.find(method) != specific_options.end()) {
58 std::cout << specific_options[method]->getDescription() << std::endl;
60 std::cerr <<
"Provided method is unkown" << std::endl;
63 std::cout << general_description << std::endl;
64 std::cout << meta_description << std::endl;
70 if (vm.count(
"method")) {
71 std::string method = vm[
"method"].as<std::string>();
72 if (specific_options.find(method) != specific_options.end()) {
73 cmdline_description.add(specific_options[method]->getDescription());
74 po::parsed_options specific_parsed = po::command_line_parser(argc, argv).options(cmdline_description).run();
75 po::store(specific_parsed, vm);
78 std::cerr <<
"Provided method is unkown" << std::endl;
82 std::cerr <<
"You must provide a method" << std::endl;
85 }
catch (po::error& err) {
86 std::cerr <<
"Error: " << err.what() <<
"\n";
91 if (specific_options.find(general_options.m_method) == specific_options.end()) {
92 std::cerr <<
"Unkown method " << general_options.m_method << std::endl;
95 Belle2::MVA::teacher(general_options, *specific_options[general_options.m_method], meta_options);