12 from basf2
import B2INFO, B2FATAL
13 from cdctrigger
import add_cdc_trigger
14 from ecltrigger
import add_ecl_trigger
15 from klmtrigger
import add_klm_trigger
16 from grltrigger
import add_grl_trigger
17 from gdltrigger
import add_gdl_trigger
20 def 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 algoritm 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)
56 path.add_module(
'StatisticsSummary').set_name(
'Sum_TriggerSimulation')
58 B2INFO(
'The L1 trigger simulation (TSIM) is set up with the following configuration:',
59 SimulationMode=SimulationMode,
60 ShortTracks=shortTracks,
61 FilterEvents=FilterEvents,
62 Belle2Phase=Belle2Phase,
63 Components=
', '.join(components))
66 def add_subdetector_tsim(
70 components=['CDC', 'ECL', 'KLM']):
72 Add subdetector modules to the TSIM with no GRL and no GDL.
74 @param path: Modules are added to this path.
75 @param SimulationMode: The simulation mode in TSIM: 1) fast simulation, trigger algoritm simulation only,
76 no firmware simulation; 2) full simulation, both trigger algorithm and firmware are simulated.
77 @param shortTracks: The standard CDC track finding requires hits in 4 axial super layers. With the shortTracks
78 option, tracks with hits in the 3 innermost super layers are also found.
79 @param components: List of subdetector components to be included in TSIM.
82 if (
'CDC' in components):
83 add_cdc_trigger(path=path, SimulationMode=SimulationMode, shortTracks=shortTracks, thetaDef=
'avg', zDef=
'min')
84 if (
'ECL' in components):
85 add_ecl_trigger(path=path)
86 if (
'KLM' in components):
87 add_klm_trigger(path=path)
95 simulateT0jitter=False,
96 components=['GRL', 'GDL']):
98 Add GRL and GDL modules to the TSIM with no subdetectors. The function have to applied based on the dataobjects
99 produced by add_subdetector_tsim.
101 @param SimulationMode: The simulation mode in TSIM: 1) fast simulation, trigger algoritm simulation only,
102 no firmware simulation; 2) full simulation, both trigger algorithm and firmware are simulated.
103 @param FilterEvents: if True only the events that pass the L1 trigger will survive simulation, the other are discarded.
104 Make sure you do need to filter events before you set the value to True.
105 @param Belle2Phase: The trigger menu at the given Phase is applied. Available options: Phase2, Phase3.
106 @param simulateT0jitter: if True L1 trigger jitter is simulated by EventT0Generator.
107 @param components: List of logic components to be included in TSIM.
110 if (
'GRL' in components):
111 add_grl_trigger(path=path, SimulationMode=SimulationMode)
112 if (
'GDL' in components):
115 SimulationMode=SimulationMode,
116 FilterEvents=FilterEvents,
117 Belle2Phase=Belle2Phase,
118 simulateT0jitter=simulateT0jitter)
126 Belle2Phase='Phase3',
127 components=['CDC', 'ECL', 'KLM', 'GRL', 'GDL'],
130 This convenience function is DEPRECATED!
132 The L1 trigger simulation (TSIM) is now included in ``add_simulation``.
134 If you already have a ``add_simulation`` in your path, you already get L1 trigger simulation.
136 If you do not have ``add_simulation``, and you need the L1 trigger simulation,\
137 please use ``add_trigger_simulation()``.
141 B2FATAL(
"add_tsim() is deprecated. The L1 trigger simulation is now included\
142 in add_simulation(). If you do not have add_simulation in your path, and you\
143 need the L1 trigger simulation, please use add_trigger_simulation().")