Belle II Software  release-05-01-25
MVAExpert.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost, Jonas Wagner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
13 #include <tracking/trackFindingVXD/utilities/Named.h>
14 #include <mva/interface/Weightfile.h>
15 #include <mva/interface/Expert.h>
16 
17 #include <framework/database/DBObjPtr.h>
18 
19 
20 namespace Belle2 {
26  class DatabaseRepresentationOfWeightfile;
27  namespace MVA {
28  class Expert;
29  class Weightfile;
30  }
31 
35  class MVAExpert {
36  public:
43  MVAExpert(const std::string& identifier, std::vector<Named<float*>> namedVariables);
44 
46  void initialize();
47 
49  void beginRun();
50 
52  std::unique_ptr<MVA::Weightfile> getWeightFile();
53 
55  float predict();
56 
57  private:
59  std::vector<Named<float*>> m_allNamedVariables;
60 
62  std::vector<Named<float*>> m_selectedNamedVariables;
63 
65  std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile> > m_weightfileRepresentation;
66 
68  std::unique_ptr<MVA::Expert> m_expert;
69 
71  std::unique_ptr<MVA::Dataset> m_dataset;
72 
74  std::string m_identifier;
75  };
77 }
Belle2::MVAExpert::m_dataset
std::unique_ptr< MVA::Dataset > m_dataset
Pointer to the current dataset.
Definition: MVAExpert.h:79
Belle2::MVAExpert::MVAExpert
MVAExpert(const std::string &identifier, std::vector< Named< float * >> namedVariables)
Construct the Expert with the specified weight folder and the name of the training that was used in t...
Definition: MVAExpert.cc:22
Belle2::MVAExpert::getWeightFile
std::unique_ptr< MVA::Weightfile > getWeightFile()
Resolves the source of the weight file and unpacks it.
Definition: MVAExpert.cc:89
Belle2::MVAExpert::m_selectedNamedVariables
std::vector< Named< float * > > m_selectedNamedVariables
References to the selected named values from the source variable set.
Definition: MVAExpert.h:70
Belle2::MVAExpert::initialize
void initialize()
Initialise the mva method.
Definition: MVAExpert.cc:178
Belle2::MVAExpert::beginRun
void beginRun()
Update the mva method to the new run.
Definition: MVAExpert.cc:183
Belle2::MVAExpert::m_allNamedVariables
std::vector< Named< float * > > m_allNamedVariables
References to the named values from the source variable set.
Definition: MVAExpert.h:67
Belle2::Named< float * >
Belle2::MVAExpert::m_weightfileRepresentation
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfileRepresentation
Database pointer to the Database representation of the weightfile.
Definition: MVAExpert.h:73
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MVAExpert::m_expert
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
Definition: MVAExpert.h:76
Belle2::MVAExpert::m_identifier
std::string m_identifier
DB identifier of the expert or file name.
Definition: MVAExpert.h:82
Belle2::MVAExpert::predict
float predict()
Evaluate the MVA method and return the MVAOutput.
Definition: MVAExpert.cc:188