10#ifndef INCLUDE_GUARD_BELLE2_MVA_OPTIONS_HEADER
11#define INCLUDE_GUARD_BELLE2_MVA_OPTIONS_HEADER
13#include <boost/program_options.hpp>
14#include <boost/program_options/errors.hpp>
15#include <boost/property_tree/ptree_fwd.hpp>
21namespace po = boost::program_options;
40 virtual void load(
const boost::property_tree::ptree& pt) = 0;
46 virtual void save(boost::property_tree::ptree& pt)
const = 0;
69 virtual void load(
const boost::property_tree::ptree& pt)
override;
75 virtual void save(boost::property_tree::ptree& pt)
const override;
118 virtual void load(
const boost::property_tree::ptree& pt)
override;
124 virtual void save(boost::property_tree::ptree& pt)
const override;
151 std::function<void(T)> check_bounds(T min, T max,
const std::string& name)
153 return [name, min, max](T v) ->
void {
154 if (v <= min || v >= max)
156 throw po::validation_error(po::validation_error::invalid_option_value, name,
157 std::to_string(min) +
" <= " + name +
" <= " + std::to_string(max) +
": provided value " + std::to_string(v));
163 std::function<void(std::vector<T>)> check_bounds_vector(T min, T max,
const std::string& name)
165 return [name, min, max](
const std::vector<T>& vec) ->
void {
168 if (v <= min || v >= max) {
169 throw po::validation_error(po::validation_error::invalid_option_value, name,
170 std::to_string(min) +
" <= " + name +
" <= " + std::to_string(max) +
": provided value " + std::to_string(v));
General options which are shared by all MVA trainings.
std::vector< std::string > m_datafiles
Name of the datafiles containing the training data.
int m_signal_class
Signal class which is used as signal in a classification problem.
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
std::string m_weight_variable
Weight variable (branch name) defining the weights.
std::vector< std::string > m_spectators
Vector of all spectators (branch names) used in the training.
std::string m_method
Name of the MVA method to use.
unsigned int m_max_events
Maximum number of events to process, 0 means all.
virtual po::options_description getDescription() override
Returns a program options description for all available options.
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism (used by Weightfile) to load Options from a xml tree.
std::string m_treename
Name of the TTree inside the datafile containing the training data.
std::string m_target_variable
Target variable (branch name) defining the target.
unsigned int m_nClasses
Number of classes in a classification problem.
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism (used by Weightfile) to store Options in a xml tree.
std::string m_identifier
Identifier containing the finished training.
Abstract base class of all Options given to the MVA interface.
virtual ~Options()=default
Virtual default destructor.
virtual po::options_description getDescription()=0
Returns a program options description for all available options.
virtual void load(const boost::property_tree::ptree &pt)=0
Load mechanism (used by Weightfile) to load Options from a xml tree.
virtual void save(boost::property_tree::ptree &pt) const =0
Save mechanism (used by Weightfile) to store Options in a xml tree.
Specific Options, all method Options have to inherit from this class.
virtual std::string getMethod() const =0
Returns method name, used in the interface to register the method.
Abstract base class for different kinds of events.