 |
Belle II Software
release-05-02-19
|
12 #ifndef INCLUDE_GUARD_BELLE2_MVA_OPTIONS_HEADER
13 #define INCLUDE_GUARD_BELLE2_MVA_OPTIONS_HEADER
15 #include <boost/program_options.hpp>
16 #include <boost/program_options/errors.hpp>
17 #include <boost/property_tree/ptree_fwd.hpp>
23 namespace po = boost::program_options;
42 virtual void load(
const boost::property_tree::ptree& pt) = 0;
48 virtual void save(boost::property_tree::ptree& pt)
const = 0;
71 virtual void load(
const boost::property_tree::ptree& pt)
override;
77 virtual void save(boost::property_tree::ptree& pt)
const override;
105 virtual std::string
getMethod()
const = 0;
119 virtual void load(
const boost::property_tree::ptree& pt)
override;
125 virtual void save(boost::property_tree::ptree& pt)
const override;
152 std::function<void(T)> check_bounds(T min, T max,
const std::string& name)
154 return [name, min, max](T v) ->
void {
155 if (v <= min || v >= max)
157 throw po::validation_error(po::validation_error::invalid_option_value, name,
158 std::to_string(min) +
" <= " + name +
" <= " + std::to_string(max) +
": provided value " + std::to_string(v));
164 std::function<void(std::vector<T>)> check_bounds_vector(T min, T max,
const std::string& name)
166 return [name, min, max](
const std::vector<T>& vec) ->
void {
169 if (v <= min || v >= max) {
170 throw po::validation_error(po::validation_error::invalid_option_value, name,
171 std::to_string(min) +
" <= " + name +
" <= " + std::to_string(max) +
": provided value " + std::to_string(v));
std::string m_identifier
Identifier containing the finished training.
virtual po::options_description getDescription()=0
Returns a program options description for all available options.
virtual void save(boost::property_tree::ptree &pt) const =0
Save mechanism (used by Weightfile) to store Options in a xml tree.
unsigned int m_max_events
Maximum number of events to process, 0 means all.
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_weight_variable
Weight variable (branch name) defining the weights.
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Specific Options, all mehtod Options have to inherit from this class.
std::string m_treename
Name of the TTree inside the datafile containing the training data.
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.
Abstract base class of all Options given to the MVA interface.
Abstract base class for different kinds of events.
std::string m_target_variable
Target variable (branch name) defining the target.
int m_signal_class
Signal class which is used as signal in a classification problem.
virtual ~Options()=default
Virtual default destructor.
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
General options which are shared by all MVA trainings.
std::vector< std::string > m_datafiles
Name of the datafiles containing the training data.
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism (used by Weightfile) to store Options in a xml tree.
virtual std::string getMethod() const =0
Returns method name, used in the interface to register the method.
virtual void load(const boost::property_tree::ptree &pt)=0
Load mechanism (used by Weightfile) to load Options from a xml tree.