Belle II Software release-09-00-03
core.py
1
8from .utils import add_low_multiplicity_generator, EventRangePathSplitter, ExtraInfoPathSplitter
9from .constants import EventCodes_taus
10
11from basf2 import Path, AfterConditionPath
12
13
14def add_generators(path, event_codes):
15 """
16 Add generators for a list of event codes.
17
18 Parameters:
19 path (basf2.Path): path where generators should be added
20 event_codes (Iterable): tuple or list of EventCode.
21 """
22
23 s1 = path.add_module(EventRangePathSplitter(event_codes))
24
25 for e in event_codes:
26 generator_path = Path()
27 add_low_multiplicity_generator(generator_path, e)
28 s1.if_value(f'={e.value}', generator_path, AfterConditionPath.CONTINUE)
29
30 if len(tuple(set(event_codes) & set(EventCodes_taus))):
31 s2 = path.add_module(ExtraInfoPathSplitter(EventCodes_taus))
32 tau_decay_path = Path()
33 tau_decay_path.add_module('EvtGenDecay')
34 s2.if_true(tau_decay_path, AfterConditionPath.CONTINUE)