Belle II Software
release-05-02-19
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
h
i
l
m
n
p
r
s
t
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
test_prototype_module.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
# Thomas Keck 2016
4
5
from
b2test_utils
import
skip_test_if_light
6
skip_test_if_light()
# light builds don't contain generators; skip before trying to import
7
8
from
basf2
import
*
9
10
from
modularAnalysis
import
*
11
from
generators
import
add_evtgen_generator
12
13
import
tempfile
14
import
os
15
16
from
ROOT
import
Belle2
17
18
if
__name__ ==
"__main__"
:
19
20
path = create_path()
21
setupEventInfo(100, path)
22
add_evtgen_generator(path,
'signal'
,
Belle2.FileSystem.findFile
(
'analysis/examples/simulations/B2A101-Y4SEventGeneration.dec'
))
23
path.add_module(
'MVAPrototype'
, identifier=
'fake.xml'
)
24
25
with
tempfile.TemporaryDirectory()
as
tempdir:
26
os.chdir(tempdir)
27
28
# Create a fake weightfile
29
content =
"""
30
<?xml version="1.0" encoding="utf-8"?>
31
<method>Trivial</method>
32
<weightfile>fake.xml</weightfile>
33
<treename>tree</treename>
34
<target_variable>isSignal</target_variable>
35
<weight_variable>__weight__</weight_variable>
36
<signal_class>1</signal_class>
37
<max_events>0</max_events>
38
<number_feature_variables>1</number_feature_variables>
39
<variable0>M</variable0>
40
<number_spectator_variables>0</number_spectator_variables>
41
<number_data_files>1</number_data_files>
42
<datafile0>train.root</datafile0>
43
<Trivial_version>1</Trivial_version>
44
<Trivial_output>0</Trivial_output>
45
<signal_fraction>0.066082567</signal_fraction>
46
"""
47
with
open(
"fake.xml"
,
"w"
)
as
f:
48
f.write(content)
49
50
process(path)
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition:
FileSystem.cc:147
mva
tests
test_prototype_module.py
Generated on Tue Jan 4 2022 03:00:35 for Belle II Software by
1.8.17