Belle II Software development
checkFrontEndMaps.py
1#!/usr/bin/env python3
2
3
10
11# -------------------------------------------------------------------------------------
12# Check front-end mappings (boardstacks to SCROD IDs)
13#
14# usage: basf2 checkFrontEndMaps.py expNo runNo [globalTag or localDB]
15# -------------------------------------------------------------------------------------
16
17from basf2 import conditions, create_path, process, Module, set_log_level, LogLevel
18from ROOT import Belle2
19import sys
20
21argvs = sys.argv
22if len(argvs) < 3:
23 print("usage: basf2", argvs[0], "expNo runNo [globalTag or localDB]")
24 sys.exit()
25
26expNo = int(argvs[1])
27runNo = int(argvs[2])
28tag = '(main)'
29tagtxt = 'globalTag:'
30if len(argvs) == 4:
31 tag = argvs[3]
32 if '.txt' in tag:
33 conditions.append_globaltag('online')
34 conditions.append_testing_payloads(tag)
35 tagtxt = 'localDB:'
36 else:
37 conditions.append_globaltag(tag)
38
39
40class CheckFrontEndMaps(Module):
41 """ Print SCROD to boardstack mapping given by TOPFrontEndMaps """
42
43 def initialize(self):
44 """ initialize method: prints SCROD mappings """
45
46 mapper = Belle2.TOP.TOPGeometryPar.Instance().getFrontEndMapper()
47 if not mapper.isValid():
48 return
49
50 print()
51 print('expNo:', expNo, 'runNo:', runNo, tagtxt, tag)
52 print('Mapping of boardstacks to SCROD IDs')
53 for slot in range(1, 17):
54 print('slot', slot)
55 for bs in range(4):
56 femap = mapper.getMap(slot, bs)
57 if femap:
58 print(' BS' + str(bs) + ':', femap.getScrodID())
59 else:
60 print(' BS' + str(bs) + ': *not available*')
61
62
63set_log_level(LogLevel.ERROR)
64
65main = create_path()
66main.add_module('EventInfoSetter', expList=[expNo], runList=[runNo])
67main.add_module('TOPGeometryParInitializer')
68main.add_module(CheckFrontEndMaps())
69
70# process single event
71process(main)
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.