Belle II Software development
mixed_runs.py
1#!/usr/bin/env python3
2
3
10
11import basf2
12from ROOT import Belle2
13import time
14
15basf2.set_random_seed("something important")
16basf2.set_log_level(basf2.LogLevel.ERROR)
17
18
19class 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
36nruns = 6
37basf2.set_nprocesses(2)
38main = basf2.Path()
39main.add_module("EventInfoSetter", evtNumList=[2] * nruns, expList=[0] * nruns,
40 runList=list(range(1, nruns + 1)))
41test = main.add_module(DelayEvents())
42test.set_property_flags(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED)
43main.add_module('Progress', logLevel=basf2.LogLevel.INFO)
44basf2.process(main)
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67