Belle II Software  release-08-01-10
MVAPrototypeModule.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 <framework/core/Module.h>
12 
13 #include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
14 #include <mva/interface/Weightfile.h>
15 #include <mva/interface/Expert.h>
16 
17 #include <framework/database/DBObjPtr.h>
18 
19 #include <vector>
20 #include <string>
21 #include <memory>
22 
23 namespace Belle2 {
36  class MVAPrototypeModule : public Module {
37  public:
38 
43 
47  virtual void initialize() override;
48 
52  virtual void beginRun() override;
53 
57  virtual void event() override;
58 
59  private:
64  void init_mva(MVA::Weightfile& weightfile);
65 
66  private:
67 
68  std::string m_identifier;
71  std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile>>
73  std::unique_ptr<MVA::Expert> m_expert;
74  std::unique_ptr<MVA::SingleDataset> m_dataset;
75  };
76 
78 } // Belle2 namespace
79 
This module can be used as a prototype for your own module which uses MVA weightfiles.
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 ...
std::string m_identifier
database identifier or filename of the weightfile
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
Base class for Modules.
Definition: Module.h:72
Abstract base class for different kinds of events.