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