11from basf2
import B2INFO, B2FATAL
12from geometry
import is_detector_present
13from cdctrigger
import add_cdc_trigger
14from ecltrigger
import add_ecl_trigger
15from klmtrigger
import add_klm_trigger
16from grltrigger
import add_grl_trigger
17from gdltrigger
import add_gdl_trigger
20def add_trigger_simulation(
26 components=['CDC', 'ECL', 'KLM', 'GRL', 'GDL'],
27 simulateT0jitter=False,
30 Add the L1 trigger simulation (TSIM) modules to path.
32 @param path: Modules are added to this path.
33 @param SimulationMode: The simulation mode in TSIM: 1) fast simulation, trigger algorithm simulation only,
34 no firmware simulation; 2) full simulation, both trigger algorithm and firmware are simulated.
35 @param shortTracks: The standard CDC track finding requires hits in 4 axial super layers. With the shortTracks
36 option, tracks with hits in the 3 innermost super layers are also found.
37 @param FilterEvents: if True only the events that pass the L1 trigger will survive simulation, the other are discarded.
38 Make sure you do need to filter events before you set the value to True.
39 @param Belle2Phase: The trigger menu at the given Phase is applied. Available options: Phase2, Phase3.
40 @param components: List of sub-trigger components to be included in TSIM.
41 @param simulateT0jitter: if True L1 trigger jitter is simulated by EventT0Generator.
46 SimulationMode=SimulationMode,
47 shortTracks=shortTracks,
48 components=components)
51 SimulationMode=SimulationMode,
52 FilterEvents=FilterEvents,
53 Belle2Phase=Belle2Phase,
54 simulateT0jitter=simulateT0jitter,
55 components=components)
57 B2INFO(
'The L1 trigger simulation (TSIM) is set up with the following configuration:',
58 SimulationMode=SimulationMode,
59 ShortTracks=shortTracks,
60 FilterEvents=FilterEvents,
61 Belle2Phase=Belle2Phase,
62 Components=
', '.join(components))
65def add_subdetector_tsim(
69 components=['CDC', 'ECL', 'KLM']):
71 Add subdetector modules to the TSIM with no GRL and no GDL.
73 @param path: Modules are added to this path.
74 @param SimulationMode: The simulation mode in TSIM: 1) fast simulation, trigger algorithm simulation only,
75 no firmware simulation; 2) full simulation, both trigger algorithm and firmware are simulated.
76 @param shortTracks: The standard CDC track finding requires hits in 4 axial super layers. With the shortTracks
77 option, tracks with hits in the 3 innermost super layers are also found.
78 @param components: List of subdetector components to be included in TSIM.
81 if is_detector_present(
'CDC', components):
82 add_cdc_trigger(path=path, SimulationMode=SimulationMode, shortTracks=shortTracks, thetaDef=
'avg', zDef=
'min')
83 if is_detector_present(
'ECL', components):
84 add_ecl_trigger(path=path)
85 if is_detector_present(
'KLM', components):
86 add_klm_trigger(path=path)
94 simulateT0jitter=False,
95 components=['GRL', 'GDL']):
97 Add GRL and GDL modules to the TSIM with no subdetectors. The function have to applied based on the dataobjects
98 produced by add_subdetector_tsim.
100 @param SimulationMode: The simulation mode in TSIM: 1) fast simulation, trigger algorithm simulation only,
101 no firmware simulation; 2) full simulation, both trigger algorithm and firmware are simulated.
102 @param FilterEvents: if True only the events that pass the L1 trigger will survive simulation, the other are discarded.
103 Make sure you do need to filter events before you set the value to True.
104 @param Belle2Phase: The trigger menu at the given Phase is applied. Available options: Phase2, Phase3.
105 @param simulateT0jitter: if True L1 trigger jitter is simulated by EventT0Generator.
106 @param components: List of logic components to be included in TSIM.
109 if (
'GRL' in components):
110 add_grl_trigger(path=path, SimulationMode=SimulationMode)
111 if (
'GDL' in components):
114 SimulationMode=SimulationMode,
115 FilterEvents=FilterEvents,
116 Belle2Phase=Belle2Phase,
117 simulateT0jitter=simulateT0jitter)
125 Belle2Phase='Phase3',
126 components=['CDC', 'ECL', 'KLM', 'GRL', 'GDL'],
129 This convenience function is DEPRECATED!
131 The L1 trigger simulation (TSIM) is now included in ``add_simulation``.
133 If you already have a ``add_simulation`` in your path, you already get L1 trigger simulation.
135 If you do not have ``add_simulation``, and you need the L1 trigger simulation,\
136 please use ``add_trigger_simulation()``.
140 B2FATAL(
"add_tsim() is deprecated. The L1 trigger simulation is now included\
141 in add_simulation(). If you do not have add_simulation in your path, and you\
142 need the L1 trigger simulation, please use add_trigger_simulation().")