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
DBImportTBC.py
1
#!/usr/bin/env python
2
3
10
11
# --------------------------------------------------------------------------------
12
# Example of using Database importer for importing TBC constants to local database
13
# User has to set the path to TOPTimeBaseCalibrator output files correctly
14
# Name and location of local DB can also be changed
15
# --------------------------------------------------------------------------------
16
17
import
basf2
as
b2
18
from
ROOT
import
Belle2
# noqa: make Belle2 namespace available
19
from
ROOT.Belle2
import
TOPDatabaseImporter
20
import
sys
21
import
glob
22
23
# define local database with write access
24
b2.conditions.expert_settings(save_payloads=
"localDB/localDB.txt"
)
25
26
# get a list of root files containing calibration constants
27
folder_name =
'tbc'
# location of output files from TOPTimeBaseCalibrator
28
fNames = glob.glob(folder_name +
'/*.root'
)
29
if
len(fNames) == 0:
30
print(
'No root files found in'
, folder_name)
31
sys.exit()
32
33
# convert the list to a single string
34
fileNames =
''
35
for
fName
in
fNames:
36
fileNames = fileNames +
' '
+ fName
37
38
39
class
PayloadImporter(b2.Module):
40
''' Payload importer using TOPDatabaseImporter '''
41
42
def
initialize
(self):
43
''' Import timebase calibration '''
44
45
dbImporter = TOPDatabaseImporter()
46
dbImporter.importSampleTimeCalibration(fileNames)
47
48
49
# create path
42
def
initialize
(self):
…
50
main = b2.create_path()
51
52
# Event info setter - execute single event
53
main.add_module(
'EventInfoSetter'
)
54
55
# Gearbox
56
main.add_module(
'Gearbox'
)
57
58
# Geometry parameters
59
main.add_module(
'TOPGeometryParInitializer'
, useDB=
False
)
60
61
# Importer
62
main.add_module(
PayloadImporter
())
63
64
# process single event
65
b2.process(main)
DBImportTBC.PayloadImporter
Definition
DBImportTBC.py:41
DBImportTBC.PayloadImporter.initialize
initialize(self)
Definition
DBImportTBC.py:44
top
examples
DBImportTBC.py
Generated on Sun May 18 2025 03:03:05 for Belle II Software by
1.13.2