14from ROOT
import Belle2
15from b2test_utils
import skip_test_if_light
18basf2.set_random_seed(
"something important")
21path.add_module(
'EventInfoSetter', evtNumList=[5, 1], runList=[0, 1], expList=[0, 1])
22pgun = path.add_module(
'ParticleGun', nTracks=3)
27 """print some debug info"""
30 """reimplementation of Module::event()."""
33 basf2.B2INFO(
"MCPart: " + str(part.obj().getIndex()))
36 """reimplementation of Module::beginRun()."""
37 basf2.B2INFO(
"TestModule: beginRun()")
40for use_pp
in [
False,
True]:
42 subeventpath = basf2.Path()
45 testmod.set_property_flags(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED)
47 subeventpath.add_module(
'EventInfoPrinter')
48 subeventpath.add_module(testmod)
50 path.for_each(
'MCParticle',
'MCParticles', subeventpath)
51 path.add_module(
'PrintCollections', printForEvent=0)
53 basf2.set_nprocesses(2)
54 basf2.logging.log_level = basf2.LogLevel.WARNING
61 assert basf2.statistics.get(pgun).calls(basf2.statistics.INIT) == 1
62 assert basf2.statistics.get(testmod).calls(basf2.statistics.INIT) == 1
65 assert basf2.statistics.get(pgun).calls(basf2.statistics.TERM) == 1
66 assert basf2.statistics.get(testmod).calls(basf2.statistics.TERM) == 1
68 assert basf2.statistics.get(pgun).calls(basf2.statistics.BEGIN_RUN) == 2
69 assert basf2.statistics.get(testmod).calls(basf2.statistics.BEGIN_RUN) == 2
70 assert basf2.statistics.get(pgun).calls(basf2.statistics.END_RUN) == 2
71 assert basf2.statistics.get(testmod).calls(basf2.statistics.END_RUN) == 2
73 assert basf2.statistics.get(pgun).calls(basf2.statistics.EVENT) == 6
74 assert basf2.statistics.get(testmod).calls(basf2.statistics.EVENT) == 3 * 6
77 retbytes = os.wait()[1]
a (simplified) python wrapper for StoreObjPtr.