Belle II Software  release-05-02-19
MVAExpertModule.h
1 /* BASF2 (Belle Analysis Framework 2) *
2  * Copyright(C) 2016 - Belle II Collaboration *
3  * *
4  * Author: The Belle II Collaboration *
5  * Contributors: Thomas Keck *
6  * *
7  * This software is provided "as is" without any warranty. *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 
14 #include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
15 #include <mva/interface/Weightfile.h>
16 #include <mva/interface/Expert.h>
17 
18 #include <framework/database/DBObjPtr.h>
19 
20 #include <analysis/VariableManager/Manager.h>
21 
22 #include <vector>
23 #include <string>
24 #include <memory>
25 
26 namespace Belle2 {
32  class Particle;
33 
41  class MVAExpertModule : public Module {
42  public:
43 
48 
52  virtual void initialize() override;
53 
57  virtual void beginRun() override;
58 
62  virtual void event() override;
63 
67  virtual void terminate() override
68  {
69  m_expert.reset();
70  m_dataset.reset();
71  }
72 
73  private:
77  float analyse(Particle*);
78 
83  void init_mva(MVA::Weightfile& weightfile);
84 
85 
86  private:
87 
88  std::vector<std::string> m_listNames;
89  std::string m_identifier;
90  std::string m_extraInfoName;
93  std::vector<const Variable::Manager::Var*> m_feature_variables;
95  std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile>>
97  std::unique_ptr<MVA::Expert> m_expert;
98  std::unique_ptr<MVA::SingleDataset> m_dataset;
99  };
100 
102 } // Belle2 namespace
103 
Belle2::MVAExpertModule
This module adds an ExtraInfo to the Particle objects in a given ParticleList.
Definition: MVAExpertModule.h:41
Belle2::MVAExpertModule::m_identifier
std::string m_identifier
weight-file
Definition: MVAExpertModule.h:89
Belle2::MVAExpertModule::m_extraInfoName
std::string m_extraInfoName
Name under which the SignalProbability is stored in the extraInfo of the Particle object.
Definition: MVAExpertModule.h:90
Belle2::MVA::Weightfile
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:40
Belle2::MVAExpertModule::m_expert
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
Definition: MVAExpertModule.h:97
Belle2::MVAExpertModule::MVAExpertModule
MVAExpertModule()
Constructor.
Definition: MVAExpertModule.cc:43
Belle2::MVAExpertModule::m_listNames
std::vector< std::string > m_listNames
input particle list names
Definition: MVAExpertModule.h:88
Belle2::MVAExpertModule::initialize
virtual void initialize() override
Initialize the module.
Definition: MVAExpertModule.cc:59
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::MVAExpertModule::init_mva
void init_mva(MVA::Weightfile &weightfile)
Initialize mva expert, dataset and features Called everytime the weightfile in the database changes i...
Definition: MVAExpertModule.cc:99
Belle2::MVAExpertModule::m_weightfile_representation
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
Definition: MVAExpertModule.h:96
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MVAExpertModule::terminate
virtual void terminate() override
Called at the end of the event processing.
Definition: MVAExpertModule.h:67
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::MVAExpertModule::m_signal_fraction_override
double m_signal_fraction_override
Signal Fraction which should be used.
Definition: MVAExpertModule.h:91
Belle2::MVAExpertModule::analyse
float analyse(Particle *)
Calculates expert output for given Particle pointer.
Definition: MVAExpertModule.cc:125
Belle2::MVAExpertModule::m_dataset
std::unique_ptr< MVA::SingleDataset > m_dataset
Pointer to the current dataset.
Definition: MVAExpertModule.h:98
Belle2::MVAExpertModule::beginRun
virtual void beginRun() override
Called at the beginning of a new run.
Definition: MVAExpertModule.cc:83
Belle2::MVAExpertModule::event
virtual void event() override
Called for each event.
Definition: MVAExpertModule.cc:138
Belle2::MVAExpertModule::m_feature_variables
std::vector< const Variable::Manager::Var * > m_feature_variables
Pointers to the feature variables.
Definition: MVAExpertModule.h:93