Belle II Software  release-05-01-25
backgroundInfo.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 from basf2 import *
5 from ROOT import Belle2
6 
7 # -----------------------------------------------------------
8 # Prints BackgroundInfo stored in the root file
9 # Use -i switch to specify the input file
10 # -----------------------------------------------------------
11 
12 
13 class printBGInfo(Module):
14 
15  '''
16  Print BackgroundInfo stored in the root file
17  '''
18 
19  def event(self):
20  ''' event function '''
21 
22  bgInfo = Belle2.PyStoreObj('BackgroundInfo', 1) # new version
23  bgInfos = Belle2.PyStoreArray('BackgroundInfos', 1) # old version
24  if bgInfo.isValid():
25  bgInfo.print()
26  elif bgInfos.isValid():
27  if bgInfos.getEntries() == 0:
28  print("Background info is empty")
29  i = 0
30  for bgInfo in bgInfos:
31  print("===========================")
32  print("* Backgroud info: entry", str(i))
33  print("===========================")
34  bgInfo.print()
35  i += 1
36  else:
37  print("No background info available")
38 
39  evtMetaData = Belle2.PyStoreObj('EventMetaData')
40  evtMetaData.obj().setEndOfData()
41 
42 
43 set_log_level(LogLevel.ERROR)
44 
45 # Create path
46 main = create_path()
47 
48 # input
49 roinput = register_module('RootInput')
50 main.add_module(roinput)
51 
52 # print info
53 main.add_module(printBGInfo())
54 
55 process(main)
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:69
backgroundInfo.printBGInfo
Definition: backgroundInfo.py:13
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:58
backgroundInfo.printBGInfo.event
def event(self)
Definition: backgroundInfo.py:19