Belle II Software
release-05-01-25
basf2_mva.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
# Thomas Keck 2016
5
6
import
sys
7
8
9
from
ROOT
import
PyConfig
10
PyConfig.IgnoreCommandLineOptions =
True
11
12
# FEI uses multi-threading for parallel execution of tasks therefore
13
# the ROOT gui-thread is disabled, which otherwise interferes sometimes
14
PyConfig.StartGuiThread =
False
15
16
# First load the required shared library
17
from
ROOT
import
gSystem
18
gSystem.Load(
'libmva.so'
)
19
gSystem.Load(
'libframework.so'
)
20
gSystem.Load(
'libanalysis.so'
)
21
from
ROOT
import
Belle2
22
23
# For some strange reason we need to do this to makeROOTCompatible be available.
24
Belle2.Variable.Manager
25
Belle2.Variable.Manager.Instance
()
26
import
ROOT
27
28
29
class
ForwardBelle2MVANamespace
(object):
30
""" Class which forwards lookups to the Belle2.MVA namespace,
31
this makes the access to C++ functions/classes of the mva package more convenient """
32
33
def
__getattr__
(self, name):
34
""" Return attribute with the given name in the Belle2.MVA namespace """
35
return
getattr(
Belle2.MVA
, name)
36
37
def
vector
(self, *args):
38
""" Create an std::vector containing the passed args """
39
v = ROOT.std.vector(type(args[0]))()
40
for
x
in
args:
41
v.push_back(x)
42
return
v
43
44
Belle2.MVA.AbstractInterface.initSupportedInterfaces
()
45
ROOT.gROOT.SetBatch(
True
)
46
47
48
# This is a hack (recommended by Guido) to replace this module
49
# with an object of the ForwardBelle2MVANamespace class
50
# Hence we are effectively able to implement getattr for a module.
51
sys.modules[__name__] =
ForwardBelle2MVANamespace
()
basf2_mva.ForwardBelle2MVANamespace.vector
def vector(self, *args)
Definition:
basf2_mva.py:37
Belle2::MVA::AbstractInterface::initSupportedInterfaces
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
Definition:
Interface.cc:55
basf2_mva.ForwardBelle2MVANamespace
Definition:
basf2_mva.py:29
basf2_mva.ForwardBelle2MVANamespace.__getattr__
def __getattr__(self, name)
Definition:
basf2_mva.py:33
Belle2::MVA
Definition:
ECLClusterPSD.h:36
Belle2::Variable::Manager
Global list of available variables.
Definition:
Manager.h:108
Belle2::Variable::Manager::Instance
static Manager & Instance()
get singleton instance.
Definition:
Manager.cc:27
mva
scripts
basf2_mva.py
Generated on Fri Nov 5 2021 03:55:52 for Belle II Software by
1.8.17