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