Belle II Software
development
Toggle main menu visibility
Main Page
Topics
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
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
v
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 Symbols
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
emptyrelations.py
1
#!/usr/bin/env python3
2
3
10
11
from
basf2
import
set_random_seed, create_path, Module
12
from
ROOT
import
Belle2
13
from
b2test_utils
import
safe_process, clean_working_directory
14
15
set_random_seed(
"something important"
)
16
17
18
class
MakeRelations
(Module):
19
'''Simple module that creates some relations.'''
20
21
def
initialize
(self):
22
'''Initialize.'''
23
24
self.
tracks
=
Belle2.PyStoreArray
(
'Tracks'
)
25
26
self.
clusters
=
Belle2.PyStoreArray
(
'KLMClusters'
)
27
self.
tracks
.registerInDataStore()
28
self.
clusters
.registerInDataStore()
29
self.
tracks
.registerRelationTo(self.
clusters
)
30
31
self.
first
=
True
32
21
def
initialize
(self):
…
33
def
event
(self):
34
'''Event.'''
35
if
not
self.
first
:
36
track = self.
tracks
.appendNew()
37
cluster = self.
clusters
.appendNew()
38
track.addRelationTo(cluster)
39
self.
first
=
False
40
41
33
def
event
(self):
…
18
class
MakeRelations
(Module):
…
42
def
create_file():
43
"""Create file with empty first event"""
44
path = create_path()
45
path.add_module(
'EventInfoSetter'
)
46
path.add_module(
MakeRelations
())
47
path.add_module(
'RootOutput'
, outputFileName=
'test.root'
)
48
safe_process(path, 2)
49
50
51
def
read_file():
52
"""Read file with empty first event"""
53
path = create_path()
54
path.add_module(
'RootInput'
, inputFileName=
'test.root'
)
55
path.add_module(
'PrintCollections'
, printForEvent=0)
56
safe_process(path)
57
58
59
if
__name__ ==
"__main__"
:
60
with
clean_working_directory():
61
create_file()
62
read_file()
Belle2::PyStoreArray
A (simplified) python wrapper for StoreArray.
Definition
PyStoreArray.h:72
emptyrelations.MakeRelations
Definition
emptyrelations.py:18
emptyrelations.MakeRelations.tracks
tracks
Tracks.
Definition
emptyrelations.py:24
emptyrelations.MakeRelations.initialize
initialize(self)
Definition
emptyrelations.py:21
emptyrelations.MakeRelations.clusters
clusters
KLMClusters.
Definition
emptyrelations.py:26
emptyrelations.MakeRelations.first
bool first
Bool for flagging the first event processed.
Definition
emptyrelations.py:31
emptyrelations.MakeRelations.event
event(self)
Definition
emptyrelations.py:33
framework
tests
emptyrelations.py
Generated on Sat May 17 2025 02:59:19 for Belle II Software by
1.13.2