Belle II Software  release-06-01-15
GeneralOptions Class Reference

General options which are shared by all MVA trainings. More...

#include <Options.h>

Inheritance diagram for GeneralOptions:
Collaboration diagram for GeneralOptions:

Public Member Functions

virtual void load (const boost::property_tree::ptree &pt) override
 Load mechanism (used by Weightfile) to load Options from a xml tree. More...
 
virtual void save (boost::property_tree::ptree &pt) const override
 Save mechanism (used by Weightfile) to store Options in a xml tree. More...
 
virtual po::options_description getDescription () override
 Returns a program options description for all available options.
 

Public Attributes

std::string m_method
 Name of the MVA method to use.
 
std::string m_identifier
 Identifier containing the finished training.
 
std::vector< std::string > m_datafiles
 Name of the datafiles containing the training data.
 
std::string m_treename = "ntuple"
 Name of the TTree inside the datafile containing the training data.
 
std::vector< std::string > m_variables
 Vector of all variables (branch names) used in the training.
 
std::vector< std::string > m_spectators
 Vector of all spectators (branch names) used in the training.
 
int m_signal_class = 1
 Signal class which is used as signal in a classification problem.
 
std::string m_target_variable = "isSignal"
 Target variable (branch name) defining the target.
 
std::string m_weight_variable = "__weight__"
 Weight variable (branch name) defining the weights.
 
unsigned int m_max_events = 0
 Maximum number of events to process, 0 means all.
 

Detailed Description

General options which are shared by all MVA trainings.

Definition at line 62 of file Options.h.

Member Function Documentation

◆ load()

void load ( const boost::property_tree::ptree &  pt)
overridevirtual

Load mechanism (used by Weightfile) to load Options from a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 42 of file Options.cc.

43  {
44  m_method = pt.get<std::string>("method");
45  m_identifier = pt.get<std::string>("weightfile");
46  m_treename = pt.get<std::string>("treename");
47  m_target_variable = pt.get<std::string>("target_variable");
48  m_weight_variable = pt.get<std::string>("weight_variable");
49  m_signal_class = pt.get<int>("signal_class");
50  m_max_events = pt.get<unsigned int>("max_events", 0u);
51 
52  unsigned int numberOfFiles = pt.get<unsigned int>("number_data_files", 0);
53  m_datafiles.resize(numberOfFiles);
54  for (unsigned int i = 0; i < numberOfFiles; ++i) {
55  m_datafiles[i] = pt.get<std::string>(std::string("datafile") + std::to_string(i));
56  }
57 
58  unsigned int numberOfSpectators = pt.get<unsigned int>("number_spectator_variables", 0u);
59  m_spectators.resize(numberOfSpectators);
60  for (unsigned int i = 0; i < numberOfSpectators; ++i) {
61  m_spectators[i] = pt.get<std::string>(std::string("spectator") + std::to_string(i));
62  }
63 
64  auto numberOfFeatures = pt.get<unsigned int>("number_feature_variables");
65  m_variables.resize(numberOfFeatures);
66  for (unsigned int i = 0; i < numberOfFeatures; ++i) {
67  m_variables[i] = pt.get<std::string>(std::string("variable") + std::to_string(i));
68  }
69  }
std::vector< std::string > m_datafiles
Name of the datafiles containing the training data.
Definition: Options.h:84
int m_signal_class
Signal class which is used as signal in a classification problem.
Definition: Options.h:88
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
Definition: Options.h:86
std::string m_weight_variable
Weight variable (branch name) defining the weights.
Definition: Options.h:90
std::vector< std::string > m_spectators
Vector of all spectators (branch names) used in the training.
Definition: Options.h:87
std::string m_method
Name of the MVA method to use.
Definition: Options.h:82
unsigned int m_max_events
Maximum number of events to process, 0 means all.
Definition: Options.h:91
std::string m_treename
Name of the TTree inside the datafile containing the training data.
Definition: Options.h:85
std::string m_target_variable
Target variable (branch name) defining the target.
Definition: Options.h:89
std::string m_identifier
Identifier containing the finished training.
Definition: Options.h:83

◆ save()

void save ( boost::property_tree::ptree &  pt) const
overridevirtual

Save mechanism (used by Weightfile) to store Options in a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 71 of file Options.cc.


The documentation for this class was generated from the following files: