Belle II Software light-2406-ragdoll
CheckEventNumbers Class Reference
Inheritance diagram for CheckEventNumbers:
Collaboration diagram for CheckEventNumbers:

Public Member Functions

def __init__ (self, evtNumList)
 
def event (self)
 
def terminate (self)
 

Private Attributes

 __evtNumList
 the number of events so we expect the event numbers 0..(evtNumList-1)
 
 __evtNumbers
 event numbers we actually saw
 

Detailed Description

Class to check that we see all events we expect exactly once and nothing else

Definition at line 20 of file parallel_processing.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  evtNumList 
)
Remember number of events to process

Definition at line 23 of file parallel_processing.py.

23 def __init__(self, evtNumList):
24 """Remember number of events to process"""
25 super().__init__()
26
27 self.__evtNumList = evtNumList
28
29 self.__evtNumbers = []
30

Member Function Documentation

◆ event()

def event (   self)
Accumulate all event numbers we see

Definition at line 31 of file parallel_processing.py.

31 def event(self):
32 """Accumulate all event numbers we see"""
33 evtNr = Belle2.PyStoreObj("EventMetaData").obj().getEvent()
34 self.__evtNumbers.append(evtNr)
35
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

◆ terminate()

def terminate (   self)
Check if event numbers are as they should be

Definition at line 36 of file parallel_processing.py.

36 def terminate(self):
37 """Check if event numbers are as they should be"""
38 seen = self.__evtNumbers
39 should = list(range(1, self.__evtNumList + 1))
40 all_numbers = sorted(set(seen) | set(should))
41 all_ok = True
42 for evtNr in all_numbers:
43 c = seen.count(evtNr)
44 if not (evtNr in should and c == 1):
45 basf2.B2ERROR(f"event number {evtNr} seen {c} times")
46 all_ok = False
47 if not all_ok:
48 basf2.B2FATAL("Missing/extra events")
49
50

Member Data Documentation

◆ __evtNumbers

__evtNumbers
private

event numbers we actually saw

Definition at line 29 of file parallel_processing.py.

◆ __evtNumList

__evtNumList
private

the number of events so we expect the event numbers 0..(evtNumList-1)

Definition at line 27 of file parallel_processing.py.


The documentation for this class was generated from the following file: