Belle II Software  light-2205-abys
MVAMultipleExpertsModule.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 <analysis/VariableManager/Manager.h>
20 
21 #include <vector>
22 #include <string>
23 #include <memory>
24 
25 namespace Belle2 {
31  class Particle;
32 
41  public:
42 
47 
51  virtual void initialize() override;
52 
56  virtual void beginRun() override;
57 
61  virtual void event() override;
62 
66  virtual void terminate() override;
67 
68  private:
72  std::vector<float> analyse(Particle*);
73 
78  void init_mva(MVA::Weightfile& weightfile, unsigned int i);
79 
80 
81  private:
82 
83  std::vector<std::string> m_listNames;
84  std::vector<std::string> m_identifiers;
85  std::vector<std::string>
89  std::vector<std::vector<const Variable::Manager::Var*>>
92 // std::vector<const Variable::Manager::Var*> m_feature_variables;
93 
94  std::map<const Variable::Manager::Var*, float>
97  std::vector<std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile>>>
100  std::vector<std::unique_ptr<MVA::Expert>> m_experts;
102  std::vector<std::unique_ptr<MVA::SingleDataset>> m_datasets;
104  std::vector<bool>
106  std::vector<bool> m_existGivenExtraInfo;
107  };
108 
110 } // Belle2 namespace
111 
This module adds an ExtraInfo to the Particle objects in a given ParticleList.
void init_mva(MVA::Weightfile &weightfile, unsigned int i)
Initialize mva expert, dataset and features Called every time the weightfile in the database changes ...
std::vector< std::unique_ptr< MVA::Expert > > m_experts
Vector of pointers to the current MVA Experts.
virtual void initialize() override
Initialize the module.
std::vector< std::unique_ptr< MVA::SingleDataset > > m_datasets
Vector of pointers to the current input datasets.
std::vector< float > analyse(Particle *)
Calculates expert output for given Particle pointer.
virtual void event() override
Called for each event.
std::vector< bool > m_existGivenExtraInfo
check if the given extraInfo is already defined.
std::vector< std::vector< const Variable::Manager::Var * > > m_individual_feature_variables
Vector of pointers to the feature variables for each expert.
virtual void terminate() override
Called at the end of the event processing.
double m_signal_fraction_override
Signal Fraction which should be used.
std::vector< std::string > m_identifiers
weight-files
std::vector< std::string > m_listNames
input particle list names
virtual void beginRun() override
Called at the beginning of a new run.
std::map< const Variable::Manager::Var *, float > m_feature_variables
Map containing the values of all needed feature variables.
std::vector< std::string > m_extraInfoNames
Names under which the SignalProbability is stored in the extraInfo of the Particle object.
std::vector< std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > > m_weightfile_representations
Vector of database pointers to the Database representation of the weightfile.
std::vector< bool > m_overwriteExistingExtraInfo
if true, when the given extraInfo is already defined, the old extraInfo value is overwritten
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
Class to store reconstructed particles.
Definition: Particle.h:74
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:23