12 from ROOT
import Belle2
14 basf2.set_random_seed(
"something important")
19 """For events with an odd event number, set module return value to False"""
22 """reimplementation of Module::event()."""
26 basf2.B2ERROR(
'No EventMetaData found')
28 event = evtmetadata.obj().getEvent()
29 basf2.B2INFO(
'Setting return value to ' + str(event % 2 == 0))
30 self.return_value(event % 2 == 0)
33 """reimplementation of Module::terminate()."""
35 basf2.B2INFO(
'terminating SelectOddEvents')
40 """Always return false"""
43 """reimplementation of Module::event()."""
44 self.return_value(
False)
49 """Print name in event"""
58 """reimplementation of Module::event()."""
60 basf2.B2ERROR(
"In module " + self.name())
63 main = basf2.create_path()
67 emptypath = basf2.create_path()
68 emptypath.add_path(basf2.create_path())
69 main.add_path(emptypath)
72 main.add_module(
'EventInfoSetter', expList=[0, 1], runList=[1, 2], evtNumList=[2, 1])
74 anotherpath = basf2.create_path()
75 main.add_path(anotherpath)
76 main.add_module(
'PrintCollections')
78 subsubpath = basf2.create_path()
79 subsubpath.add_module(
'Progress')
80 subsubpath.add_path(emptypath)
84 anotherpath.add_module(module_with_condition)
85 anotherpath.add_module(
'EventInfoPrinter')
94 module_with_condition.if_true(subsubpath)
100 returnfalse1_condition_path = basf2.create_path()
101 returnfalse1_condition_path.add_module(
PrintName(
'ReturnFalse1Condition'))
102 returnfalse1.if_false(returnfalse1_condition_path, basf2.AfterConditionPath.CONTINUE)
103 main.add_module(returnfalse1)
107 returnfalse2_condition_path = basf2.create_path()
108 returnfalse2_condition_path.add_module(
PrintName(
'ReturnFalse2Condition'))
109 returnfalse2.if_true(returnfalse2_condition_path)
115 basf2.B2INFO(
"second process() call follows...")
a (simplified) python wrapper for StoreObjPtr.