Belle II Software development
ImportTimeConversion.py
1#!/usr/bin/env python3
2
3
10
11# Import KLM time conversion payloads.
12
13import sys
14import basf2
15from ROOT import Belle2 # noqa: make the Belle2 namespace available
16from ROOT.Belle2 import KLMDatabaseImporter, KLMTimeConversion
17
18basf2.set_log_level(basf2.LogLevel.INFO)
19
20mc = False
21if (len(sys.argv) >= 2):
22 if (sys.argv[1] == 'mc'):
23 mc = True
24
25dbImporter = KLMDatabaseImporter()
26
27timeConversion = KLMTimeConversion()
28# Time offset in ns.
29timeConversion.setTimeOffset(0)
30# CTIME shift in bits.
31timeConversion.setCTimeShift(2)
32
33if (mc):
34 dbImporter.setIOV(1002, 0, 1002, -1)
35 timeConversion.setCTimeShift(2)
36 dbImporter.importTimeConversion(timeConversion)
37
38 dbImporter.setIOV(1003, 0, 1003, -1)
39 timeConversion.setCTimeShift(0)
40 dbImporter.importTimeConversion(timeConversion)
41
42 dbImporter.setIOV(0, 0, 0, -1)
43 timeConversion.setCTimeShift(0)
44 dbImporter.importTimeConversion(timeConversion)
45
46else:
47 dbImporter.setIOV(0, 0, 3, -1)
48 timeConversion.setCTimeShift(2)
49 dbImporter.importTimeConversion(timeConversion)
50
51 dbImporter.setIOV(4, 0, -1, -1)
52 timeConversion.setCTimeShift(0)
53 dbImporter.importTimeConversion(timeConversion)