Belle II Software  release-08-01-10
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.
 
unsigned int m_nClasses = 2
 Number of classes 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 44 of file Options.cc.

45  {
46  m_method = pt.get<std::string>("method");
47  m_identifier = pt.get<std::string>("weightfile");
48  m_treename = pt.get<std::string>("treename");
49  m_target_variable = pt.get<std::string>("target_variable");
50  m_weight_variable = pt.get<std::string>("weight_variable");
51  m_signal_class = pt.get<int>("signal_class");
52  m_max_events = pt.get<unsigned int>("max_events", 0u);
53  m_nClasses = pt.get<unsigned int>("nClasses", 2u);
54 
55  unsigned int numberOfFiles = pt.get<unsigned int>("number_data_files", 0);
56  m_datafiles.resize(numberOfFiles);
57  for (unsigned int i = 0; i < numberOfFiles; ++i) {
58  m_datafiles[i] = pt.get<std::string>(std::string("datafile") + std::to_string(i));
59  }
60 
61  unsigned int numberOfSpectators = pt.get<unsigned int>("number_spectator_variables", 0u);
62  m_spectators.resize(numberOfSpectators);
63  for (unsigned int i = 0; i < numberOfSpectators; ++i) {
64  m_spectators[i] = pt.get<std::string>(std::string("spectator") + std::to_string(i));
65  }
66 
67  auto numberOfFeatures = pt.get<unsigned int>("number_feature_variables");
68  m_variables.resize(numberOfFeatures);
69  for (unsigned int i = 0; i < numberOfFeatures; ++i) {
70  m_variables[i] = pt.get<std::string>(std::string("variable") + std::to_string(i));
71  }
72  }
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:91
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:92
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:90
unsigned int m_nClasses
Number of classes in a classification problem.
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 74 of file Options.cc.


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