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