Belle II Software  release-06-02-00
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/methods/FastBDT.h>
18 
19 //Root Includes
20 #include "TFile.h"
21 #include "TTree.h"
22 
23 namespace Belle2 {
28  namespace CurlTagger {
29 
31  class SelectorMVA : public Selector {
32 
33  public:
35  SelectorMVA(bool belleFlag, bool trainFlag);
36 
39 
41  virtual float getResponse(Particle* iPart, Particle* jPart) override;
42 
44  virtual std::vector<float> getVariables(Particle* iPart, Particle* jPart) override;
45 
47  virtual void initialize() override;
48 
50  virtual void collectTrainingInfo(Particle* iPart, Particle* jPart) override;
51 
53  virtual void finalize() override;
54 
55  private:
56 
58  void updateVariables(Particle* iPart, Particle* jPart);
59 
62 
64  std::string m_TFileName;
65 
67  TFile* m_TFile;
68 
70  TTree* m_TTree;
71 
74 
77 
78 
79  // General Options data - just use same names
81  std::string m_identifier;
82 
84  std::vector<std::string> m_datafiles;
85 
87  std::vector<std::string> m_variables;
88 
90  std::string m_target_variable;
91 
92 
93  // MVA Variables
95  Float_t m_PPhi;
96 
98  Float_t m_ChargeProduct;
99 
101  Float_t m_PtDiffEW;
102 
104  Float_t m_PzDiffEW;
105 
108 
111 
114 
117 
120 
122  Float_t m_IsCurl;
123  }; //selectorMVA class
124 
125  } // curlTagger Module namespace
127 }// Belle 2 namespace
128 
MVA based selector for tagging curl tracks in Belle and Belle II.
Definition: SelectorMVA.h:31
std::vector< std::string > m_datafiles
name of datafile
Definition: SelectorMVA.h:84
void updateVariables(Particle *iPart, Particle *jPart)
updates the value of the MVA variable
Definition: SelectorMVA.cc:36
virtual std::vector< float > getVariables(Particle *iPart, Particle *jPart) override
returns vector of variables used by this selector.
Definition: SelectorMVA.cc:59
Float_t m_TrackTanLambdaDiffEW
error weighted track tan lambda diff difference
Definition: SelectorMVA.h:113
std::vector< std::string > m_variables
names of variables used by mva
Definition: SelectorMVA.h:87
Float_t m_TrackZ0DiffEW
error weighted track Z0 difference
Definition: SelectorMVA.h:110
virtual void initialize() override
initialize whatever needs to be initialized (root file etc)
Definition: SelectorMVA.cc:71
Float_t m_IsCurl
isCurl Truth
Definition: SelectorMVA.h:122
Float_t m_PtDiffEW
error weighted particle Pt difference
Definition: SelectorMVA.h:101
Float_t m_PPhi
angle between particle momentum vectors
Definition: SelectorMVA.h:95
Float_t m_TrackPhi0DiffEW
error weighted track Phi0 difference
Definition: SelectorMVA.h:116
TFile * m_TFile
output file for training data
Definition: SelectorMVA.h:67
Float_t m_PzDiffEW
error weighted particle Pz difference
Definition: SelectorMVA.h:104
Float_t m_TrackD0DiffEW
error weighted track D0 difference
Definition: SelectorMVA.h:107
SelectorMVA(bool belleFlag, bool trainFlag)
Constructor.
Definition: SelectorMVA.cc:21
virtual void finalize() override
finalize whatever needs to be finalized (train the MVA)
Definition: SelectorMVA.cc:100
Float_t m_ChargeProduct
charge(p1) * charge(p2)
Definition: SelectorMVA.h:98
bool m_TrainFlag
applying mva or training it
Definition: SelectorMVA.h:61
MVA::FastBDTExpert m_expert
mva expert
Definition: SelectorMVA.h:76
virtual void collectTrainingInfo(Particle *iPart, Particle *jPart) override
collect training data and save to a root file
Definition: SelectorMVA.cc:65
std::string m_TFileName
name of output file for training data
Definition: SelectorMVA.h:64
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:132
MVA::GeneralOptions m_generalOptions
mva general options (for the expert)
Definition: SelectorMVA.h:73
std::string m_target_variable
name of target variable (isCurl)
Definition: SelectorMVA.h:90
Float_t m_TrackOmegaDiffEW
error weighted track Omega difference
Definition: SelectorMVA.h:119
TTree * m_TTree
training data tree
Definition: SelectorMVA.h:70
std::string m_identifier
mva identifier
Definition: SelectorMVA.h:81
Abstract base class for curl track selectors.
Definition: Selector.h:22
Expert for the FastBDT MVA method.
Definition: FastBDT.h:122
General options which are shared by all MVA trainings.
Definition: Options.h:62
Class to store reconstructed particles.
Definition: Particle.h:74
Abstract base class for different kinds of events.