Belle II Software
release-06-00-14
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
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
v
w
z
Typedefs
a
b
c
d
e
i
k
l
m
n
p
r
s
t
u
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_skims.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
11
12
"""Test skims by running them all as a single combined steering file."""
13
14
from
glob
import
glob
15
16
from
b2test_utils
import
clean_working_directory, require_file
17
import
basf2
as
b2
18
import
modularAnalysis
as
ma
19
from
skim
import
CombinedSkim
20
from
skim.WGs.fei
import
BaseFEISkim
21
from
skim.registry
import
Registry
22
23
# NOTE: Another way this test could have been written is to run the standalone steering
24
# file for every skim:
25
#
26
# for SkimName in Registry.names:
27
# b2.b2test_utils.check_error_free(
28
# "b2skim-run", f"Skim {SkimName}", "skim", toolopts=[SkimName, "-n", "10"]
29
# )
30
#
31
# I think what is written below is preferable, as it makes the overall running time of
32
# this test smaller.
33
34
35
def
is_fei_skim(skim):
36
return
isinstance(skim, BaseFEISkim)
37
38
39
def
is_combined_or_fei_skim(skim):
40
return
isinstance(skim, CombinedSkim)
or
is_fei_skim(skim)
41
42
43
def
main
():
44
path = b2.Path()
45
mdst_files = glob(f
'{b2.find_file("mdst/tests")}/mdst-v*.root'
)
46
mdst_files.sort(reverse=
True
)
47
ma.inputMdstList(
"default"
, require_file(mdst_files[0]), path=path)
48
49
analysisGlobaltag = ma.getAnalysisGlobaltag()
50
SkimObjects = [Registry.get_skim_function(skim)(analysisGlobaltag=analysisGlobaltag)
for
skim
in
Registry.names]
51
skims = CombinedSkim(*[skim
for
skim
in
SkimObjects
if
not
is_combined_or_fei_skim(skim)])
52
skims(path)
53
feiSkims = CombinedSkim(*[skim
for
skim
in
SkimObjects
if
is_fei_skim(skim)])
54
feiSkims(path)
55
56
b2.process(path, max_event=10)
57
58
59
if
__name__ ==
"__main__"
:
60
with
clean_working_directory():
61
main
()
skim.registry
Definition:
registry.py:1
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:75
skim
tests
test_skims.py
Generated on Thu Jul 14 2022 08:05:57 for Belle II Software by
1.9.1