Belle II Software development
ImportStripEfficiency.py
1#!/usr/bin/env python3
2
3
10
11# Import KLM strip efficiency payloads.
12
13import sys
14from ROOT import Belle2 # noqa: make the Belle2 namespace available
15from ROOT.Belle2 import KLMDatabaseImporter, KLMStripEfficiency, KLMChannelIndex
16
17mc = False
18if (len(sys.argv) < 2):
19 print('Usage: basf2 ImportStripEfficiency.py [mc | input_file].')
20elif (sys.argv[1] == 'mc'):
21 mc = True
22else:
23 inputFile = sys.argv[1]
24
25dbImporter = KLMDatabaseImporter()
26
27stripEfficiency = KLMStripEfficiency()
28
29if (mc):
30 index = KLMChannelIndex()
31 index2 = KLMChannelIndex()
32 while (index != index2.end()):
33 channel = index.getKLMChannelNumber()
34 stripEfficiency.setEfficiency(channel, 1.0, 0.0)
35 index.increment()
36
37 dbImporter.setIOV(0, 0, 0, -1)
38 dbImporter.importStripEfficiency(stripEfficiency)
39
40 dbImporter.setIOV(1002, 0, 1002, -1)
41 dbImporter.importStripEfficiency(stripEfficiency)
42
43 dbImporter.setIOV(1003, 0, 1003, -1)
44 dbImporter.importStripEfficiency(stripEfficiency)
45
46else:
47 dbImporter.loadStripEfficiency(stripEfficiency, inputFile)
48
49 dbImporter.setIOV(0, 0, -1, -1)
50 dbImporter.importStripEfficiency(stripEfficiency)