Belle II Software
development
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
Enumerator
c
d
f
p
t
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
EventCountLimiter.py
1
#!/usr/bin/env python3
2
3
10
11
# Purpose:
12
# basf module to return false if the event counter equals or exceeds the user-defined limit
13
#
14
import
basf2
15
16
# =========================================================================
17
#
18
# EventCountLimiter
19
#
20
# =========================================================================
21
22
23
class
EventCountLimiter
(basf2.Module):
24
"""Report when the event counter has reached or exceeded its limit"""
25
26
def
__init__
(self, maxCount):
27
"""Constructor
28
29
Argument:
30
maxCount (int): number of events to be processed
31
"""
32
super().
__init__
()
33
34
self.
maxCount
= maxCount
if
(maxCount >= 0)
else
(1 << 31)
35
36
self.
eventCounter
= 0
37
38
def
initialize
(self):
39
"""Handle job initialization (nothing to do here)"""
40
41
def
terminate
(self):
42
"""Handle job termination (nothing to do here)"""
43
44
def
beginRun
(self):
45
"""Handle begin of run (nothing to do here)"""
46
47
def
endRun
(self):
48
"""Handle end of run (nothing to do here)"""
49
50
def
event
(self):
51
"""Process one event: has eventCounter reached or exceeded its limit?"""
52
self.eventCounter += 1
53
super().return_value(self.eventCounter < self.maxCount)
EventCountLimiter.EventCountLimiter
Definition:
EventCountLimiter.py:23
EventCountLimiter.EventCountLimiter.maxCount
maxCount
internal copy of the event-counter upper limit
Definition:
EventCountLimiter.py:34
EventCountLimiter.EventCountLimiter.terminate
def terminate(self)
Definition:
EventCountLimiter.py:41
EventCountLimiter.EventCountLimiter.beginRun
def beginRun(self)
Definition:
EventCountLimiter.py:44
EventCountLimiter.EventCountLimiter.eventCounter
eventCounter
internal event counter
Definition:
EventCountLimiter.py:36
EventCountLimiter.EventCountLimiter.__init__
def __init__(self, maxCount)
Definition:
EventCountLimiter.py:26
EventCountLimiter.EventCountLimiter.initialize
def initialize(self)
Definition:
EventCountLimiter.py:38
EventCountLimiter.EventCountLimiter.endRun
def endRun(self)
Definition:
EventCountLimiter.py:47
EventCountLimiter.EventCountLimiter.event
def event(self)
Definition:
EventCountLimiter.py:50
klm
bklm
scripts
EventCountLimiter.py
Generated on Wed Apr 9 2025 02:42:37 for Belle II Software by
1.9.6