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