7 from ROOT
import Belle2
9 basf2.set_random_seed(
"something important")
14 """For events with an odd event number, set module return value to False"""
17 """reimplementation of Module::event()."""
21 basf2.B2ERROR(
'No EventMetaData found')
23 event = evtmetadata.obj().getEvent()
24 basf2.B2INFO(
'Setting return value to ' + str(event % 2 == 0))
25 self.return_value(event % 2 == 0)
28 """reimplementation of Module::terminate()."""
30 basf2.B2INFO(
'terminating SelectOddEvents')
35 """Always return false"""
38 """reimplementation of Module::event()."""
39 self.return_value(
False)
44 """Print name in event"""
53 """reimplementation of Module::event()."""
55 basf2.B2ERROR(
"In module " + self.name())
57 main = basf2.create_path()
61 emptypath = basf2.create_path()
62 emptypath.add_path(basf2.create_path())
63 main.add_path(emptypath)
66 main.add_module(
'EventInfoSetter', expList=[0, 1], runList=[1, 2], evtNumList=[2, 1])
68 anotherpath = basf2.create_path()
69 main.add_path(anotherpath)
70 main.add_module(
'PrintCollections')
72 subsubpath = basf2.create_path()
73 subsubpath.add_module(
'Progress')
74 subsubpath.add_path(emptypath)
78 anotherpath.add_module(module_with_condition)
79 anotherpath.add_module(
'EventInfoPrinter')
88 module_with_condition.if_true(subsubpath)
94 returnfalse1_condition_path = basf2.create_path()
95 returnfalse1_condition_path.add_module(
PrintName(
'ReturnFalse1Condition'))
96 returnfalse1.if_false(returnfalse1_condition_path, basf2.AfterConditionPath.CONTINUE)
97 main.add_module(returnfalse1)
101 returnfalse2_condition_path = basf2.create_path()
102 returnfalse2_condition_path.add_module(
PrintName(
'ReturnFalse2Condition'))
103 returnfalse2.if_true(returnfalse2_condition_path)
109 basf2.B2INFO(
"second process() call follows...")