Belle II Software development
EventRangePathSplitter Class Reference
Inheritance diagram for EventRangePathSplitter:

Public Member Functions

def __init__ (self, event_codes)
 
def initialize (self)
 
def beginRun (self)
 
def event (self)
 

Public Attributes

 event_codes
 tuple or list of event codes
 
 event_extra_info
 PyStoreObj off EventExtraInfo.
 
 event_ranges
 Dictionary to get number of events for each event code.
 
 event_number
 Event number.
 

Detailed Description

Module to set ``eventExtraInfo(EventCode)`` according to event range
of each channel.

Parameters:
    event_codes (Iterable): tuple or list of EventCode.

Definition at line 103 of file utils.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  event_codes 
)
Initialize the class
Parameters:
    event_codes (Iterable): tuple or list of EventCode.

Definition at line 112 of file utils.py.

112 def __init__(self, event_codes):
113 """
114 Initialize the class
115 Parameters:
116 event_codes (Iterable): tuple or list of EventCode.
117 """
118 import ROOT # noqa
119 super().__init__()
120
121 self.event_codes = event_codes
122
123 self.event_extra_info = ROOT.Belle2.PyStoreObj('EventExtraInfo')
124
125 self.event_ranges = None
126
127 self.event_number = -1
128

Member Function Documentation

◆ beginRun()

def beginRun (   self)
Begin run method of the module

Definition at line 137 of file utils.py.

137 def beginRun(self):
138 """Begin run method of the module"""
139 self.event_number = -1
140

◆ event()

def event (   self)
Event method of the module

Definition at line 141 of file utils.py.

141 def event(self):
142 """Event method of the module"""
143 self.event_number += 1
144 if not self.event_extra_info.isValid():
145 self.event_extra_info.create()
146 elif self.event_extra_info.hasExtraInfo('EventCode'):
147 B2FATAL('The EventExtraInfo object has already an EventCode field registered.')
148 for event_code, event_range in self.event_ranges.items():
149 if (event_range[0] <= self.event_number < event_range[1]):
150 self.event_extra_info.setExtraInfo('EventCode', event_code.value)
151 self.return_value(event_code.value)
152 return
153 # This should never happen.
154 self.return_value(0)
155
156

◆ initialize()

def initialize (   self)
Initialize module before any events are processed

Definition at line 129 of file utils.py.

129 def initialize(self):
130 """
131 Initialize module before any events are processed
132 """
133 import ROOT # noqa
134 self.event_ranges = get_event_ranges(ROOT.Belle2.Environment.Instance().getNumberOfEvents(), self.event_codes)
135 self.event_extra_info.registerInDataStore()
136

Member Data Documentation

◆ event_codes

event_codes

tuple or list of event codes

Definition at line 121 of file utils.py.

◆ event_extra_info

event_extra_info

PyStoreObj off EventExtraInfo.

Definition at line 123 of file utils.py.

◆ event_number

event_number

Event number.

Definition at line 127 of file utils.py.

◆ event_ranges

event_ranges

Dictionary to get number of events for each event code.

Definition at line 125 of file utils.py.


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