10 #include <mva/modules/MVAExpert/MVAPrototypeModule.h>
11 #include <mva/interface/Interface.h>
13 #include <boost/algorithm/string/predicate.hpp>
22 setDescription(
"Prototype of a module which uses the MVA package");
31 addParam(
"identifier",
m_identifier,
"The database identifier or filename which is used to load the weights during the training.");
38 "signalFraction to calculate probability (if -1 the signalFraction of the training data is used)", -1.0);
62 std::stringstream ss((*m_weightfile_representation)->m_data);
89 m_expert = supported_interfaces[general_options.m_method]->getExpert();
96 std::vector<float> dummy(general_options.m_variables.size(), 0);
97 m_dataset = std::make_unique<MVA::SingleDataset>(general_options, dummy, 0);
107 B2ERROR(
"MVA Expert is not loaded! I will return 0");
113 for (
unsigned int i = 0; i <
m_dataset->getNumberOfFeatures(); ++i) {
122 B2INFO(
"The probability is " << probability);
std::unique_ptr< MVA::SingleDataset > m_dataset
Pointer to the current dataset.
virtual void initialize() override
Initialize the module.
virtual void event() override
Called for each event.
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
double m_signal_fraction_override
Signal Fraction which should be used.
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
virtual void beginRun() override
Called at the beginning of a new run.
void init_mva(MVA::Weightfile &weightfile)
Initialize mva expert, dataset and features Called every time the weightfile in the database changes ...
MVAPrototypeModule()
Constructor.
std::string m_identifier
database identifier or filename of the weightfile
static std::map< std::string, AbstractInterface * > getSupportedInterfaces()
Returns interfaces supported by the MVA Interface.
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
General options which are shared by all MVA trainings.
The Weightfile class serializes all information about a training into an xml tree.
static Weightfile loadFromStream(std::istream &stream)
Static function which deserializes a Weightfile from a stream.
void getOptions(Options &options) const
Fills an Option object from the xml tree.
static Weightfile loadFromFile(const std::string &filename)
Static function which loads a Weightfile from a file.
void addSignalFraction(float signal_fraction)
Saves the signal fraction in the xml tree.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.