![]() |
Belle II Software
light-2212-foldex
|
Proivdes a dataset from a ROOT file This is the usually used dataset providing training data to the mva methods. More...
#include <Dataset.h>


Public Member Functions | |
| ROOTDataset (const GeneralOptions &_general_options) | |
| Creates a new ROOTDataset. More... | |
| virtual unsigned int | getNumberOfFeatures () const override |
| Returns the number of features in this dataset. | |
| virtual unsigned int | getNumberOfSpectators () const override |
| Returns the number of features in this dataset. | |
| virtual unsigned int | getNumberOfEvents () const override |
| Returns the number of events in this dataset. | |
| virtual void | loadEvent (unsigned int event) override |
| Load the event number iEvent from the TTree. More... | |
| virtual std::vector< float > | getFeature (unsigned int iFeature) override |
| Returns all values of one feature in a std::vector<float> More... | |
| virtual std::vector< float > | getWeights () override |
| Returns all values of of the weights in a std::vector<float> | |
| virtual std::vector< float > | getSpectator (unsigned int iSpectator) override |
| Returns all values of one spectator in a std::vector<float> More... | |
| template<class T > | |
| std::vector< float > | getVectorFromTTree (std::string &variableType, std::string &branchName, T &memberVariableTarget) |
| Returns all values for a specified variableType and branchName. More... | |
| void | setRootInputType () |
| Tries to infer the data-type of a root file and sets m_isDoubleInputType. | |
| template<class T > | |
| void | setScalarVariableAddress (std::string &variableType, std::string &variableName, T &variableTarget) |
| sets the branch address for a scalar variable to a given target More... | |
| template<class T > | |
| void | setVectorVariableAddress (std::string &variableType, std::vector< std::string > &variableName, T &variableTargets) |
| sets the branch address for a vector variable to a given target More... | |
| void | setVectorVariableAddress (std::string &variableType, std::vector< std::string > &variableName, std::vector< Variable::Manager::VarVariant > &varVariantTargets) |
| sets the branch address for a vector of VarVariant to a given target More... | |
| void | setTargetRootInputType () |
| Determines the data type of the target variable and sets it to m_target_data_type. | |
| virtual | ~ROOTDataset () |
| Virtual destructor. | |
| virtual float | getSignalFraction () |
| Returns the signal fraction of the whole sample. | |
| virtual unsigned int | getFeatureIndex (const std::string &feature) |
| Return index of feature with the given name. More... | |
| virtual unsigned int | getSpectatorIndex (const std::string &spectator) |
| Return index of spectator with the given name. More... | |
| virtual std::vector< float > | getTargets () |
| Returns all targets. | |
| virtual std::vector< bool > | getSignals () |
| Returns all is Signals. | |
Public Attributes | |
| GeneralOptions | m_general_options |
| GeneralOptions passed to this dataset. | |
| std::vector< float > | m_input |
| Contains all feature values of the currently loaded event. | |
| std::vector< float > | m_spectators |
| Contains all spectators values of the currently loaded event. | |
| float | m_weight |
| Contains the weight of the currently loaded event. | |
| float | m_target |
| Contains the target value of the currently loaded event. | |
| bool | m_isSignal |
| Defines if the currently loaded event is signal or background. | |
Protected Attributes | |
| TChain * | m_tree = nullptr |
| Pointer to the TChain containing the data. | |
| bool | m_isFloatInputType = true |
| Defines the expected datatype in the ROOT file. | |
| std::vector< Variable::Manager::VarVariant > | m_input_variant |
| Contains all feature values of the currently loaded event. | |
| std::vector< Variable::Manager::VarVariant > | m_spectators_variant |
| Contains all spectators values of the currently loaded event. | |
| double | m_weight_double |
| Contains the weight of the currently loaded event. | |
| Variable::Manager::VariableDataType | m_target_data_type |
| Data type of target variable. More... | |
| double | m_target_double |
| Contains the target value of the currently loaded event. | |
| int | m_target_int |
| Contains the target value of the currently loaded event. | |
| bool | m_target_bool |
| Contains the target value of the currently loaded event. | |
Private Member Functions | |
| void | setBranchAddresses () |
| Sets the branch addresses of all features, weight and target again. | |
| bool | checkForBranch (TTree *, const std::string &) const |
| Checks if the given branchname exists in the TTree. More... | |
Proivdes a dataset from a ROOT file This is the usually used dataset providing training data to the mva methods.
|
explicit |
Creates a new ROOTDataset.
| _general_options | defines the rootfile, treename, branches, ... |
Definition at line 316 of file Dataset.cc.
|
private |
Checks if the given branchname exists in the TTree.
| tree | |
| branchname |
Definition at line 527 of file Dataset.cc.
|
overridevirtual |
Returns all values of one feature in a std::vector<float>
| iFeature | the position of the feature to return |
Reimplemented from Dataset.
Definition at line 443 of file Dataset.cc.
|
virtualinherited |
Return index of feature with the given name.
| feature | name of the feature |
Definition at line 50 of file Dataset.cc.
|
overridevirtual |
Returns all values of one spectator in a std::vector<float>
| iSpectator | the position of the spectator to return |
Reimplemented from Dataset.
Definition at line 465 of file Dataset.cc.
|
virtualinherited |
Return index of spectator with the given name.
| spectator | name of the spectator |
Definition at line 62 of file Dataset.cc.
| std::vector< float > getVectorFromTTree | ( | std::string & | variableType, |
| std::string & | branchName, | ||
| T & | memberVariableTarget | ||
| ) |
Returns all values for a specified variableType and branchName.
The values are read from a root file. The type is inferred from the given memberVariableTarget name.
| T | type memberVariable of this class which has to be updated (float, double) |
| variableType | defines {feature, weights, spectator, target} |
| branchName | name of the branch to read |
| memberVariableTarget | variable the branch address from the root file is set to |
Definition at line 494 of file Dataset.cc.
|
overridevirtual |
Load the event number iEvent from the TTree.
| event | event number to load |
Implements Dataset.
Definition at line 378 of file Dataset.cc.
| void setScalarVariableAddress | ( | std::string & | variableType, |
| std::string & | variableName, | ||
| T & | variableTarget | ||
| ) |
sets the branch address for a scalar variable to a given target
| T | target type (float, double) |
| variableType | defines {feature, weights, spectator, target} |
| variableName | name of the variable, usually defined in general_options |
| variableTarget | variable, the address is set to |
Definition at line 535 of file Dataset.cc.
| void setVectorVariableAddress | ( | std::string & | variableType, |
| std::vector< std::string > & | variableName, | ||
| std::vector< Variable::Manager::VarVariant > & | varVariantTargets | ||
| ) |
sets the branch address for a vector of VarVariant to a given target
| T | target type (std::vector<float>, std::vector<double>) |
| variableType | defines {feature, weights, spectator, target} |
| variableName | names of the variable, usually defined in general_options |
| varVariantTargets | variables, the address is set to |
Definition at line 564 of file Dataset.cc.
| void setVectorVariableAddress | ( | std::string & | variableType, |
| std::vector< std::string > & | variableName, | ||
| T & | variableTargets | ||
| ) |
sets the branch address for a vector variable to a given target
| T | target type (std::vector<float>, std::vector<double>) |
| variableType | defines {feature, weights, spectator, target} |
| variableName | names of the variable, usually defined in general_options |
| variableTargets | variables, the address is set to |
Definition at line 557 of file Dataset.cc.
|
protected |