Belle II Software development
ECLChargedPIDMVAModule.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//FRAMEWORK
12#include <framework/core/Module.h>
13#include <framework/datastore/StoreArray.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <framework/database/DBObjPtr.h>
16#include <framework/dataobjects/EventMetaData.h>
17
18// MVA
19#include <mva/interface/Expert.h>
20#include <mva/interface/Dataset.h>
21
22//MDST
23#include <mdst/dataobjects/Track.h>
24
25//ECL
26#include <ecl/dataobjects/ECLPidLikelihood.h>
27#include <ecl/dbobjects/ECLChargedPIDMVAWeights.h>
28
29
30namespace Belle2 {
35
36
43
45
46 public:
47
52
56 virtual ~ECLChargedPIDMVAModule() override;
57
64 virtual void initialize() override;
65
71 virtual void beginRun() override;
72
78 virtual void event() override;
79
83 void checkDBPayloads();
84
88 void initializeMVA();
89
96 static float logTransformation(const float value, const float offset, const float max);
97
103 static float gaussTransformation(const float value, const TH1F* cdf);
104
111 static std::vector<float> decorrTransformation(const std::vector<float>& scores, const std::vector<float>* decorrelationMatrix);
112
113
114 private:
115
119 float evaluateVariable(const Variable::Manager::Var* varobj, const Particle* particle);
120
124 std::string m_payload_name;
125
130
135
140
144 std::unique_ptr<DBObjPtr<ECLChargedPIDMVAWeights>> m_mvaWeights;
145
150 std::unordered_map<unsigned int, std::unique_ptr<MVA::Expert>> m_experts;
151
167 static constexpr float c_dummyLogL = -87.3365;
168
172 std::vector<const Variable::Manager::Var*> m_binningVariables;
173
178 std::unordered_map<unsigned int, std::vector<const Variable::Manager::Var*>> m_variables;
179
184 std::unordered_map<unsigned int, std::unique_ptr<MVA::SingleDataset>> m_datasets;
185
189 static constexpr double c_sqrt2 = 1.41421356237309504880;
190
191 }; // class
192
193} // Belle2 namespace
std::unordered_map< unsigned int, std::unique_ptr< MVA::Expert > > m_experts
unordered map of MVA experts.
std::vector< const Variable::Manager::Var * > m_binningVariables
Vector of variables used to define the regions in which the MVAs are trained.
virtual ~ECLChargedPIDMVAModule() override
Destructor.
static float gaussTransformation(const float value, const TH1F *cdf)
gaussian transformation.
void checkDBPayloads()
Check payloads for consistency.
static float logTransformation(const float value, const float offset, const float max)
log transformation.
virtual void initialize() override
Use this to initialize resources or memory your module needs.
virtual void event() override
Called once for each event.
std::unordered_map< unsigned int, std::unique_ptr< MVA::SingleDataset > > m_datasets
MVA dataset to be passed to the expert.
static constexpr double c_sqrt2
Definition of sqrt(2)
StoreObjPtr< EventMetaData > m_eventMetaData
The event information.
void initializeMVA()
Initialise the multiclass MVAs.
float evaluateVariable(const Variable::Manager::Var *varobj, const Particle *particle)
evaluate the variable for the particle and convert the return value float.
static constexpr float c_dummyLogL
Dummy value of log Likelihood for a particle hypothesis.
virtual void beginRun() override
Called once before a new run begins.
std::unordered_map< unsigned int, std::vector< const Variable::Manager::Var * > > m_variables
Map of vectors containing the variables objects to be fed to the MVA.
StoreArray< Track > m_tracks
array of track objects.
static std::vector< float > decorrTransformation(const std::vector< float > &scores, const std::vector< float > *decorrelationMatrix)
decorrelation transformation.
std::unique_ptr< DBObjPtr< ECLChargedPIDMVAWeights > > m_mvaWeights
Interface to DB payloads containing MVA weightfiles and pdfs.
StoreArray< ECLPidLikelihood > m_eclPidLikelihoods
Array of ECLPidLikelihood objects.
std::string m_payload_name
The name of the database payload object with the MVA weights.
Module()
Constructor.
Definition Module.cc:30
Class to store reconstructed particles.
Definition Particle.h:76
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.
A variable returning a floating-point value for a given Particle.
Definition Manager.h:146