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