Belle II Software  release-05-01-25
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 64 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 52 of file Options.cc.

56  {
57  m_datafiles[i] = pt.get<std::string>(std::string("datafile") + std::to_string(i));
58  }
59 
60  unsigned int numberOfSpectators = pt.get<unsigned int>("number_spectator_variables", 0u);
61  m_spectators.resize(numberOfSpectators);
62  for (unsigned int i = 0; i < numberOfSpectators; ++i) {
63  m_spectators[i] = pt.get<std::string>(std::string("spectator") + std::to_string(i));
64  }
65 
66  auto numberOfFeatures = pt.get<unsigned int>("number_feature_variables");
67  m_variables.resize(numberOfFeatures);
68  for (unsigned int i = 0; i < numberOfFeatures; ++i) {
69  m_variables[i] = pt.get<std::string>(std::string("variable") + std::to_string(i));
70  }
71  }
72 
73  void GeneralOptions::save(boost::property_tree::ptree& pt) const
74  {
75  pt.put("method", m_method);
76  pt.put("weightfile", m_identifier);
77  pt.put("treename", m_treename);
78  pt.put("target_variable", m_target_variable);
79  pt.put("weight_variable", m_weight_variable);

◆ 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 81 of file Options.cc.


The documentation for this class was generated from the following files:
Belle2::MVA::GeneralOptions::m_identifier
std::string m_identifier
Identifier containing the finished training.
Definition: Options.h:85
Belle2::MVA::GeneralOptions::m_weight_variable
std::string m_weight_variable
Weight variable (branch name) defining the weights.
Definition: Options.h:92
Belle2::MVA::GeneralOptions::m_treename
std::string m_treename
Name of the TTree inside the datafile containing the training data.
Definition: Options.h:87
Belle2::MVA::GeneralOptions::m_spectators
std::vector< std::string > m_spectators
Vector of all spectators (branch names) used in the training.
Definition: Options.h:89
Belle2::MVA::GeneralOptions::m_method
std::string m_method
Name of the MVA method to use.
Definition: Options.h:84
Belle2::MVA::GeneralOptions::m_target_variable
std::string m_target_variable
Target variable (branch name) defining the target.
Definition: Options.h:91
Belle2::MVA::GeneralOptions::m_variables
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
Definition: Options.h:88
prepareAsicCrosstalkSimDB.u
u
merged u1 and u2
Definition: prepareAsicCrosstalkSimDB.py:46
Belle2::MVA::GeneralOptions::m_datafiles
std::vector< std::string > m_datafiles
Name of the datafiles containing the training data.
Definition: Options.h:86
Belle2::MVA::GeneralOptions::save
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism (used by Weightfile) to store Options in a xml tree.
Definition: Options.cc:81