Belle II Software
development
backgroundInfo.py
1
#!/usr/bin/env python3
2
3
10
11
import
basf2
as
b2
12
from
ROOT
import
Belle2
13
14
# -----------------------------------------------------------
15
# Prints BackgroundInfo stored in the root file
16
# Use -i switch to specify the input file
17
# -----------------------------------------------------------
18
19
20
class
printBGInfo
(b2.Module):
21
22
'''
23
Print BackgroundInfo stored in the root file
24
'''
25
26
def
event
(self):
27
''' event function '''
28
29
bgInfo =
Belle2.PyStoreObj
(
'BackgroundInfo'
, 1)
# new version
30
bgInfos =
Belle2.PyStoreArray
(
'BackgroundInfos'
, 1)
# old version
31
if
bgInfo.isValid():
32
bgInfo.print()
33
elif
bgInfos.isValid():
34
if
bgInfos.getEntries() == 0:
35
print(
"Background info is empty"
)
36
i = 0
37
for
bgInfo
in
bgInfos:
38
print(
"==========================="
)
39
print(
"* Background info: entry"
, str(i))
40
print(
"==========================="
)
41
bgInfo.print()
42
i += 1
43
else
:
44
print(
"No background info available"
)
45
46
evtMetaData =
Belle2.PyStoreObj
(
'EventMetaData'
)
47
evtMetaData.obj().setEndOfData()
48
49
50
b2.set_log_level(b2.LogLevel.ERROR)
51
52
# Create path
53
main = b2.create_path()
54
55
# input
56
roinput = b2.register_module(
'RootInput'
)
57
main.add_module(roinput)
58
59
# print info
60
main.add_module(
printBGInfo
())
61
62
b2.process(main)
Belle2::PyStoreArray
A (simplified) python wrapper for StoreArray.
Definition
PyStoreArray.h:73
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition
PyStoreObj.h:67
backgroundInfo.printBGInfo
Definition
backgroundInfo.py:20
backgroundInfo.printBGInfo.event
event(self)
Definition
backgroundInfo.py:26
background
steering_tools
backgroundInfo.py
Generated on Mon Sep 1 2025 02:47:18 for Belle II Software by
1.13.2