7 from ROOT
import Belle2
8 from b2test_utils
import skip_test_if_light
11 basf2.set_random_seed(
"something important")
14 path.add_module(
'EventInfoSetter', evtNumList=[5, 1], runList=[0, 1], expList=[0, 1])
15 pgun = path.add_module(
'ParticleGun', nTracks=3)
20 """print some debug info"""
23 """reimplementation of Module::event()."""
26 basf2.B2INFO(
"MCPart: " + str(part.obj().getIndex()))
29 """reimplementation of Module::beginRun()."""
30 basf2.B2INFO(
"TestModule: beginRun()")
33 for use_pp
in [
False,
True]:
35 subeventpath = basf2.Path()
38 testmod.set_property_flags(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED)
40 subeventpath.add_module(
'EventInfoPrinter')
41 subeventpath.add_module(testmod)
43 path.for_each(
'MCParticle',
'MCParticles', subeventpath)
44 path.add_module(
'PrintCollections', printForEvent=0)
46 basf2.set_nprocesses(2)
47 basf2.logging.log_level = basf2.LogLevel.WARNING
54 assert basf2.statistics.get(pgun).calls(basf2.statistics.INIT) == 1
55 assert basf2.statistics.get(testmod).calls(basf2.statistics.INIT) == 1
58 assert basf2.statistics.get(pgun).calls(basf2.statistics.TERM) == 1
59 assert basf2.statistics.get(testmod).calls(basf2.statistics.TERM) == 1
61 assert basf2.statistics.get(pgun).calls(basf2.statistics.BEGIN_RUN) == 2
62 assert basf2.statistics.get(testmod).calls(basf2.statistics.BEGIN_RUN) == 2
63 assert basf2.statistics.get(pgun).calls(basf2.statistics.END_RUN) == 2
64 assert basf2.statistics.get(testmod).calls(basf2.statistics.END_RUN) == 2
66 assert basf2.statistics.get(pgun).calls(basf2.statistics.EVENT) == 6
67 assert basf2.statistics.get(testmod).calls(basf2.statistics.EVENT) == 3 * 6
70 retbytes = os.wait()[1]