Belle II Software light-2406-ragdoll
Utility.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <mva/interface/Interface.h>
12#include <mva/interface/Options.h>
13#include <mva/interface/Weightfile.h>
14
15namespace Belle2::MVA {
16
20 class Utility {
21
22 public:
23
32 static void download(const std::string& identifier, const std::string& filename, int experiment = 0, int run = 0, int event = 0);
33
43 static void upload(const std::string& filename, const std::string& identifier, int exp1 = 0, int run1 = 0, int exp2 = -1,
44 int run2 = -1);
45
55 static void upload_array(const std::vector<std::string>& filenames, const std::string& identifier, int exp1 = 0, int run1 = 0,
56 int exp2 = -1, int run2 = -1);
57
65 static bool available(const std::string& filename, int experiment = 0, int run = 0, int event = 0);
66
72 static void extract(const std::string& filename, const std::string& directory);
73
78 static std::string info(const std::string& filename);
79
87 static void save_custom_weightfile(const GeneralOptions& general_options, const SpecificOptions& specific_options,
88 const std::string& custom_weightfile, const std::string& output_identifier = "");
89
96 static void teacher(const GeneralOptions& general_options, const SpecificOptions& specific_options,
97 const MetaOptions& meta_options = MetaOptions());
98
111 static void expert(const std::vector<std::string>& filenames, const std::vector<std::string>& datafiles,
112 const std::string& treename,
113 const std::string& outputfile, int experiment = 0, int run = 0, int event = 0, bool copy_target = true);
114
121 static std::unique_ptr<Belle2::MVA::Expert> teacher_dataset(GeneralOptions general_options, const SpecificOptions& specific_options,
122 Dataset& data);
123
130 static std::unique_ptr<Belle2::MVA::Expert> teacher_splot(const GeneralOptions& general_options,
131 const SpecificOptions& specific_options,
132 const MetaOptions& meta_options);
133
140 static std::unique_ptr<Belle2::MVA::Expert> teacher_sideband_subtraction(const GeneralOptions& general_options,
141 const SpecificOptions& specific_options,
142 const MetaOptions& meta_options);
143
150 static std::unique_ptr<Belle2::MVA::Expert> teacher_reweighting(const GeneralOptions& general_options,
151 const SpecificOptions& specific_options,
152 const MetaOptions& meta_options);
153
154 };
155
156}
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:33
General options which are shared by all MVA trainings.
Definition: Options.h:62
Meta Options which modify the underlying training by doing sPlot, Multiclass and HyperparameterSearch...
Definition: Options.h:111
Specific Options, all method Options have to inherit from this class.
Definition: Options.h:98
Wrapper class for some utility functions.
Definition: Utility.h:20
static void expert(const std::vector< std::string > &filenames, const std::vector< std::string > &datafiles, const std::string &treename, const std::string &outputfile, int experiment=0, int run=0, int event=0, bool copy_target=true)
Convenience function applies experts on given data.
Definition: Utility.cc:138
static void upload_array(const std::vector< std::string > &filenames, const std::string &identifier, int exp1=0, int run1=0, int exp2=-1, int run2=-1)
Convenience function which uploads an array of weightfiles to the database.
Definition: Utility.cc:61
static void upload(const std::string &filename, const std::string &identifier, int exp1=0, int run1=0, int exp2=-1, int run2=-1)
Convenience function which uploads a given weightfile to the database.
Definition: Utility.cc:46
static void download(const std::string &identifier, const std::string &filename, int experiment=0, int run=0, int event=0)
Convenience function which downloads a given weightfile from the database.
Definition: Utility.cc:32
static std::unique_ptr< Belle2::MVA::Expert > teacher_sideband_subtraction(const GeneralOptions &general_options, const SpecificOptions &specific_options, const MetaOptions &meta_options)
Performs a sideband subtraction training, convenience function.
Definition: Utility.cc:477
static std::unique_ptr< Belle2::MVA::Expert > teacher_reweighting(const GeneralOptions &general_options, const SpecificOptions &specific_options, const MetaOptions &meta_options)
Performs a MC vs data pre-training and afterwards reweighted training, convenience function.
Definition: Utility.cc:424
static void teacher(const GeneralOptions &general_options, const SpecificOptions &specific_options, const MetaOptions &meta_options=MetaOptions())
Convenience function which performs a training with the given options.
Definition: Utility.cc:253
static void extract(const std::string &filename, const std::string &directory)
Convenience function which extracts the expertise in a given weightfile into a temporary directory.
Definition: Utility.cc:83
static std::unique_ptr< Belle2::MVA::Expert > teacher_dataset(GeneralOptions general_options, const SpecificOptions &specific_options, Dataset &data)
Convenience function which performs a training on a dataset.
Definition: Utility.cc:282
static std::string info(const std::string &filename)
Print information about the classifier stored in the given weightfile.
Definition: Utility.cc:98
static void save_custom_weightfile(const GeneralOptions &general_options, const SpecificOptions &specific_options, const std::string &custom_weightfile, const std::string &output_identifier="")
Convenience function which saves a pre-existing weightfile in a mva package-compliant format.
Definition: Utility.cc:232
static std::unique_ptr< Belle2::MVA::Expert > teacher_splot(const GeneralOptions &general_options, const SpecificOptions &specific_options, const MetaOptions &meta_options)
Performs an splot training, convenience function.
Definition: Utility.cc:313
static bool available(const std::string &filename, int experiment=0, int run=0, int event=0)
Convenience function which checks if an experise is available.
Definition: Utility.cc:126