Belle II Software  release-08-01-10
mixed_runs.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2
12 from ROOT import Belle2
13 import time
14 
15 basf2.set_random_seed("something important")
16 basf2.set_log_level(basf2.LogLevel.ERROR)
17 
18 
19 class DelayEvents(basf2.Module):
20  """Delay second event in each run"""
21 
22  def event(self):
23  """reimplementation of Module::event()."""
24 
25  evtmetadata = Belle2.PyStoreObj('EventMetaData')
26 
27  if not evtmetadata:
28  basf2.B2ERROR('No EventMetaData found')
29  else:
30  event = evtmetadata.obj().getEvent()
31  if event == 2:
32  time.sleep(0.2)
33 
34 
35 # Normal steering file part begins here
36 nruns = 6
37 basf2.set_nprocesses(2)
38 main = basf2.Path()
39 main.add_module("EventInfoSetter", evtNumList=[2] * nruns, expList=[0] * nruns,
40  runList=list(range(1, nruns + 1)))
41 test = main.add_module(DelayEvents())
42 test.set_property_flags(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED)
43 main.add_module('Progress', logLevel=basf2.LogLevel.INFO)
44 basf2.process(main)
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67