Belle II Software development
importTimeWalk.py
1#!/usr/bin/env python
2
3
10
11# --------------------------------------------------------------------------------
12# Import payload TOPCalTimeWalk
13# --------------------------------------------------------------------------------
14
15import basf2 as b2
16from ROOT import Belle2 # noqa: make Belle2 namespace available
17from ROOT.Belle2 import TOPDatabaseImporter
18
19# Create path
20main = b2.create_path()
21
22# Event info setter - execute single event
23eventinfosetter = b2.register_module('EventInfoSetter')
24eventinfosetter.param('evtNumList', [1])
25main.add_module(eventinfosetter)
26
27# Gearbox - access to xml files
28gearbox = b2.register_module('Gearbox')
29main.add_module(gearbox)
30
31# Initialize TOP geometry parameters from gearbox
32main.add_module('TOPGeometryParInitializer', useDB=False)
33
34# process single event
35b2.process(main)
36
37# define a local database to save payloads(created automatically, if not existing)
38b2.conditions.expert_settings(save_payloads="localDB/localDB.txt")
39
40# and then run the importer
41dbImporter = TOPDatabaseImporter()
42
43# import constants
44params = [-106.757,
45 0.317404,
46 4.11324e-06,
47 -1.31485e-07,
48 1.10216e-11] # ps
49a = 8806.6 # ps
50b = 5.25439e-05 # ps
51
52for i in range(len(params)):
53 params[i] /= 1000 # ns
54a /= 1000 # ns
55b /= 1000 # ns
56
57print('time_walk =', params)
58print('a =', a, 'b = ', b)
59
60dbImporter.importTimeWalk(params, a, b)
61
62b2.B2RESULT("Done")