Belle II Software
development
083_module.py
1
#!/usr/bin/env python3
2
3
import
basf2
as
b2
4
5
6
class
MinModule
(b2.Module):
7
"""A minimal example of a basf2 module in python."""
8
9
def
__init__
(self):
10
"""Constructor"""
11
# call constructor of base class, required if you implement __init__
12
# yourself!
13
super().__init__()
14
# and do whatever else is necessary like declaring member variables
15
16
def initialize(self):
17
"""
Called once in the beginning just before starting processing"""
18
b2.B2INFO("initialize()")
19
20
def beginRun(self):
21
"""Called every time a run changes before the actual events in that run
22
are processed
23
"""
24
b2.B2INFO("beginRun()")
25
26
def event(self):
27
"""Called once for each event"""
28
b2.B2INFO("event()")
29
30
def endRun(self):
31
"""Called every time a run changes after the actual events in that run
32
were processed
33
"""
34
b2.B2INFO("endRun()")
35
36
def terminate(self):
37
"""Called once after all the processing is complete"""
38
b2.B2INFO("terminate()")
39
40
41
# create a path
42
main = b2.Path()
43
44
# set to generate 10 dummy events
45
main.add_module("EventInfoSetter", evtNumList=[10])
46
47
# and add our module
48
main.add_module(MinModule())
49
50
# run the path
51
b2.process(main)
083_module.MinModule
Definition
083_module.py:6
083_module.MinModule.__init__
__init__(self)
Definition
083_module.py:9
online_book
basf2
steering_files
083_module.py
Generated on Mon Sep 1 2025 02:54:37 for Belle II Software by
1.13.2