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