Belle II Software light-2406-ragdoll
SelectorMVA.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 <analysis/modules/CurlTagger/Selector.h>
12
13#include <analysis/dataobjects/Particle.h>
14#include <vector>
15#include <string>
16
17#include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
18#include <mva/methods/FastBDT.h>
19#include <mva/interface/Interface.h>
20#include <framework/database/DBObjPtr.h>
21
22//Root Includes
23#include "TFile.h"
24#include "TTree.h"
25
26namespace Belle2 {
31 namespace CurlTagger {
32
34 class SelectorMVA : public Selector {
35
36 public:
38 SelectorMVA(bool belleFlag, bool trainFlag, std::string tFileName);
39
42
44 virtual float getResponse(Particle* iPart, Particle* jPart) override;
45
47 virtual float getOptimalResponseCut() override;
48
50 virtual std::vector<float> getVariables(Particle* iPart, Particle* jPart) override;
51
53 virtual void initialize() override;
54
56 virtual void collectTrainingInfo(Particle* iPart, Particle* jPart) override;
57
59 virtual void finalize() override;
60
62 void initializeMVA();
63
64 private:
65
67 void updateVariables(Particle* iPart, Particle* jPart);
68
71
73 std::string m_TFileName;
74
76 TFile* m_TFile;
77
79 TTree* m_TTree;
80
82 std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile>> m_weightfile_representation;
83
86
89
92
93 // General Options data - just use same names
95 std::string m_identifier;
96
98 std::vector<std::string> m_datafiles;
99
101 std::vector<std::string> m_variables;
102
104 std::string m_target_variable;
105
106
107 // MVA Variables
109 Float_t m_PPhi;
110
113
115 Float_t m_PtDiffEW;
116
118 Float_t m_PzDiffEW;
119
122
125
128
131
134
136 Bool_t m_IsCurl;
137
138 }; //selectorMVA class
139
140 } // curlTagger Module namespace
142}// Belle 2 namespace
143
MVA based selector for tagging curl tracks in Belle and Belle II.
Definition: SelectorMVA.h:34
std::vector< std::string > m_datafiles
name of datafile
Definition: SelectorMVA.h:98
void updateVariables(Particle *iPart, Particle *jPart)
updates the value of the MVA variable
Definition: SelectorMVA.cc:31
virtual std::vector< float > getVariables(Particle *iPart, Particle *jPart) override
returns vector of variables used by this selector.
Definition: SelectorMVA.cc:63
Float_t m_TrackTanLambdaDiffEW
error weighted track tan lambda diff difference
Definition: SelectorMVA.h:127
virtual float getOptimalResponseCut() override
returns optimal cut to use with selector
Definition: SelectorMVA.cc:120
std::vector< std::string > m_variables
names of variables used by mva
Definition: SelectorMVA.h:101
Float_t m_TrackZ0DiffEW
error weighted track Z0 difference
Definition: SelectorMVA.h:124
virtual void initialize() override
initialize whatever needs to be initialized (root file etc)
Definition: SelectorMVA.cc:77
Float_t m_PtDiffEW
error weighted particle Pt difference
Definition: SelectorMVA.h:115
Float_t m_PPhi
angle between particle momentum vectors
Definition: SelectorMVA.h:109
Float_t m_TrackPhi0DiffEW
error weighted track Phi0 difference
Definition: SelectorMVA.h:130
TFile * m_TFile
output file for training data
Definition: SelectorMVA.h:76
Float_t m_PzDiffEW
error weighted particle Pz difference
Definition: SelectorMVA.h:118
MVA::Weightfile m_weightfile
mva weightfile
Definition: SelectorMVA.h:85
Float_t m_TrackD0DiffEW
error weighted track D0 difference
Definition: SelectorMVA.h:121
virtual void finalize() override
finalize whatever needs to be finalized (train the MVA)
Definition: SelectorMVA.cc:133
Float_t m_ChargeProduct
charge(p1) * charge(p2)
Definition: SelectorMVA.h:112
void initializeMVA()
initialize the MVA Expert
Definition: SelectorMVA.cc:111
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
Definition: SelectorMVA.h:82
bool m_TrainFlag
applying mva or training it
Definition: SelectorMVA.h:70
MVA::FastBDTExpert m_expert
mva expert
Definition: SelectorMVA.h:91
virtual void collectTrainingInfo(Particle *iPart, Particle *jPart) override
collect training data and save to a root file
Definition: SelectorMVA.cc:71
std::string m_TFileName
name of output file for training data
Definition: SelectorMVA.h:73
virtual float getResponse(Particle *iPart, Particle *jPart) override
Selector response that this pair of particles come from the same mc/actual particle.
Definition: SelectorMVA.cc:143
Bool_t m_IsCurl
isCurl Truth
Definition: SelectorMVA.h:136
MVA::GeneralOptions m_generalOptions
mva general options (for the expert)
Definition: SelectorMVA.h:88
std::string m_target_variable
name of target variable (isCurl)
Definition: SelectorMVA.h:104
Float_t m_TrackOmegaDiffEW
error weighted track Omega difference
Definition: SelectorMVA.h:133
TTree * m_TTree
training data tree
Definition: SelectorMVA.h:79
std::string m_identifier
mva identifier
Definition: SelectorMVA.h:95
Abstract base class for curl track selectors.
Definition: Selector.h:22
Expert for the FastBDT MVA method.
Definition: FastBDT.h:104
General options which are shared by all MVA trainings.
Definition: Options.h:62
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
Class to store reconstructed particles.
Definition: Particle.h:75
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24