Belle II Software
development
importFrontEndMaps.py
1
#!/usr/bin/env python3
2
3
10
11
# -------------------------------------------------------------------------------------
12
# Import front-end mappings given by top/data/FrontEndMapping.xml to a local database.
13
#
14
# usage: basf2 importFrontEndMaps.py [localDB]
15
# localDB: path/name of local database (D = "localDB-FEMaps/localDB.txt")
16
# -------------------------------------------------------------------------------------
17
18
from
basf2
import
conditions, create_path, process, Module, set_log_level, LogLevel
19
from
ROOT
import
Belle2
20
import
sys
21
22
localDBName =
"localDB-FEMaps/localDB.txt"
23
if
len(sys.argv) > 1:
24
localDBName = sys.argv[1]
25
26
# define a local database (will be created automatically, if doesn't exist)
27
conditions.expert_settings(save_payloads=localDBName)
28
29
30
class
ImportFrontEndMaps
(Module):
31
""" database importer for TOPFrontEndMaps """
32
33
def
initialize
(self):
34
""" initialize method: import a payload to local database """
35
36
iov =
Belle2.IntervalOfValidity
(0, 0, -1, -1)
37
mapper =
Belle2.TOP.TOPGeometryPar.Instance
().getFrontEndMapper()
38
if
not
mapper.isValid():
39
return
40
mapper.importPayload(iov)
41
42
print()
43
print(
'Mapping of boardstacks to SCROD IDs'
)
44
for
slot
in
range(1, 17):
45
print(
'slot'
, slot)
46
for
bs
in
range(4):
47
femap = mapper.getMap(slot, bs)
48
if
femap:
49
print(
' BS'
+ str(bs) +
':'
, femap.getScrodID())
50
else
:
51
print(
' BS'
+ str(bs) +
': *not available*'
)
52
print(
'--> FrontEndMaps imported to local database '
+ localDBName)
53
54
55
set_log_level(LogLevel.ERROR)
56
57
main = create_path()
58
main.add_module(
'EventInfoSetter'
)
59
main.add_module(
'Gearbox'
)
60
main.add_module(
'TOPGeometryParInitializer'
, useDB=
False
)
61
main.add_module(
ImportFrontEndMaps
())
62
63
# process single event
64
process(main)
Belle2::IntervalOfValidity
A class that describes the interval of experiments/runs for which an object in the database is valid.
Definition
IntervalOfValidity.h:25
Belle2::TOP::TOPGeometryPar::Instance
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
Definition
TOPGeometryPar.cc:43
importFrontEndMaps.ImportFrontEndMaps
Definition
importFrontEndMaps.py:30
importFrontEndMaps.ImportFrontEndMaps.initialize
initialize(self)
Definition
importFrontEndMaps.py:33
top
examples
importFrontEndMaps.py
Generated on Mon Sep 1 2025 02:57:20 for Belle II Software by
1.13.2