ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerConfigFlags.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3import os
4
5from AthenaConfiguration.AthConfigFlags import AthConfigFlags
6from AthenaConfiguration.Enums import FlagEnum, Format, LHCPeriod
7from Campaigns.Utils import getDataYear
8from AthenaCommon.Logging import logging
9
10log=logging.getLogger('TriggerConfigFlags')
11
12class ROBPrefetching(FlagEnum):
13 # Enable mapping step InputMaker outputs as ROBPrefetchingAlg inputs
14 StepRoI = 'StepRoI'
15 # Enable mapping chains' first step to pre-HLT prefetching rules based on initial RoIs
16 InitialRoI = 'InitialRoI'
17 # Enable using larger RoI in TauCore step to speculatively prefetch ROBs for the subsequent TauIso step (ATR-26419)
18 TauCoreLargeRoI = 'TauCoreLargeRoI'
19
20
21def trigGlobalTag(flags):
22 """Return global conditions data to be used in the HLT. Return None to indicate that
23 no trigger-specific tag is required. Used for IOVDb.GlobalTag in AllConfigFlags.py.
24 """
25 return None if flags.Input.isMC else 'CONDBR2-HLTP-2026-01'
26
27def trigGeoTag(flags):
28 """Return geometry tag to be used in the HLT. Returns None to indicate that
29 no trigger-specific tag is required. Used for GeoModel.AtlasVersion in GeoModelConfigFlags.py.
30 """
31 return None if flags.Input.isMC else 'ATLAS-R3S-2021-03-02-00'
32
33
34def createTriggerFlags(doTriggerRecoFlags):
35 flags = AthConfigFlags()
36
37 flags.addFlag('Trigger.doLVL1', lambda prevFlags: (prevFlags.Input.isMC and prevFlags.Trigger.doHLT),
38 help='enable L1 simulation')
39
40 flags.addFlag('Trigger.doHLT', False,
41 help='run HLT selection algorithms')
42
43 flags.addFlag("Trigger.forceEnableAllChains", lambda prevFlags: prevFlags.GeoModel.Run >= LHCPeriod.Run4,
44 help='always enable all configured chains (for testing). Currently enabled by default for Run 4.')
45
46 flags.addFlag("Trigger.disableL1ConsistencyChecker", False,
47 help='force disabling the L1 ConsistencyChecker')
48
49 flags.addFlag('Trigger.enableL0Muon',
50 lambda prevFlags: prevFlags.GeoModel.Run >= LHCPeriod.Run4,
51 help='enable Run-4+ L0 Muon simulation or decoding')
52
53 flags.addFlag('Trigger.enableL1MuonPhase1', lambda prevFlags:
54 (not prevFlags.Trigger.enableL0Muon) and
55 prevFlags.Trigger.EDMVersion >= 3 or prevFlags.Detector.EnableMM or prevFlags.Detector.EnablesTGC,
56 help='enable Run-3 LVL1 muon decoding')
57
58 flags.addFlag('Trigger.enableL1CaloPhase1', lambda prevFlags:
59 prevFlags.Trigger.EDMVersion >= 3 or prevFlags.GeoModel.Run >= LHCPeriod.Run3,
60 help='enable Phase-1 LVL1 calo simulation and/or decoding for Run-3+')
61
62 flags.addFlag('Trigger.enableL1TopoDump', False,
63 help='enable L1Topo simulation to write inputs to txt file')
64
65 flags.addFlag('Trigger.enableL1TopoBWSimulation', True,
66 help='enable bitwise L1Topo simulation')
67
68 # by default, enable Legacy L1Calo decoding only for offline data reconstruction until 2024
69 flags.addFlag('Trigger.enableL1CaloLegacy', lambda prevFlags:
70 len(prevFlags.Input.Files) > 0 and prevFlags.Input.Format is Format.BS and prevFlags.Reco.EnableTrigger and getDataYear(prevFlags)<2024,
71 help='enable Legacy L1Calo simulation and/or decoding')
72
73 # L0MuonSim category (for Run-4+) : needs Trigger.enableL0Muon=True
74 flags.addFlag('Trigger.L0MuonSim.doEmulation',
75 lambda prevFlags: prevFlags.Trigger.enableL0Muon and
76 prevFlags.Input.isMC and
77 'TruthParticleContainer' in prevFlags.Input.Collections,
78 help='Emulate the L0Muon trigger TOBs from smeared truth muon particles')
79
80 # L1MuonSim category
81 flags.addFlag('Trigger.L1MuonSim.EmulateNSW', False,
82 help='enable emulation tool for NSW-TGC coincidence')
83
84 flags.addFlag('Trigger.L1MuonSim.doMMTrigger', True,
85 help='enable NSW MM trigger')
86
87 flags.addFlag('Trigger.L1MuonSim.doPadTrigger', True,
88 help='enable NSW sTGC pad trigger')
89
90 flags.addFlag('Trigger.L1MuonSim.doStripTrigger', False,
91 help='enable NSW sTGC strip trigger')
92
93 flags.addFlag('Trigger.L1MuonSim.WriteNSWDebugNtuple', False,
94 help='enable Storing NSW debug Ntuple')
95
96 flags.addFlag('Trigger.L1MuonSim.WriteMMBranches', False,
97 help='enable storing of Micromega branches in NSW debug Ntuple')
98
99 flags.addFlag('Trigger.L1MuonSim.WritesTGCBranches', False,
100 help='enable storing of TGC branches in NSW debug Ntuple')
101
102 flags.addFlag('Trigger.L1MuonSim.NSWVetoMode', True,
103 help='enable the veto mode of the NSW-TGC coincidence')
104
105 flags.addFlag('Trigger.L1MuonSim.doBIS78', True,
106 help='enable TGC-RPC BIS78 coincidence')
107
108 flags.addFlag('Trigger.L1MuonSim.CondDBOffline', 'OFLCOND-MC16-SDR-RUN2-04',
109 help='offline CondDB tag for RPC/TGC coincidence window in rerunLVL1 on data')
110
111 flags.addFlag('Trigger.L1MuonSim.RPCNBX', lambda prevFlags:
112 8 if prevFlags.Input.isMC else 4,
113 help='Number of bunch crossings in RPC readout')
114
115 flags.addFlag('Trigger.L1MuonSim.RPCNBCZ', lambda prevFlags:
116 3 if prevFlags.Input.isMC else 1,
117 help='Nominal BC for RPC readout')
118
119
120 # Detector flags
121 flags.addFlag('Trigger.doID', True,
122 help='enable Inner Detector')
123
124 flags.addFlag('Trigger.doMuon', True,
125 help='enable muon systems')
126
127 flags.addFlag('Trigger.doCalo', True,
128 help='enable calorimeters')
129
130 flags.addFlag('Trigger.doZDC', False,
131 help='enable ZDC system')
132
133 flags.addFlag('Trigger.ZdcLUT', 'TrigT1ZDC/zdcRun3T1LUT_v2_08_08_2023.json',
134 help='path to Run3 ZDC LUT')
135
136 # Enable TRT fast-OR trigger
137 flags.addFlag('Trigger.doTRT', False)
138
139 # Set TTC multiplicity required for the TRT fast-OR trigger
140 flags.addFlag('Trigger.TRT.TTCMultiplicity', 4)
141
142 # Path to file with list of masked chips
143 flags.addFlag('Trigger.TRT.maskedChipsFile', 'TrigT1TRT/fastORmaskedChips.json')
144
145
146 flags.addFlag('Trigger.doValidationMonitoring', False,
147 help='enable additional validation histograms')
148
149 flags.addFlag('Trigger.doRuntimeNaviVal', False,
150 help=('Check validity of each Decision objects in the entire decision tree (CPU expensive). '
151 'Also enable per-step decision printouts.'))
152
153 flags.addFlag('Trigger.ROBPrefetchingOptions',
154 [ROBPrefetching.InitialRoI, ROBPrefetching.StepRoI, ROBPrefetching.TauCoreLargeRoI],
155 help='select ROB prefetching types, empty list disables prefetching')
156
157 def EDMVersion(flags):
158 """Determine Trigger EDM version based on the input file."""
159 _log = logging.getLogger('TriggerConfigFlags.EDMVersion')
160
161 default_version = -1 # intentionally invalid default value, ATR-22856
162
163 if flags.Input.Format is Format.BS:
164 _log.debug("Input format is ByteStream")
165
166 if not any(flags.Input.Files) and flags.Common.isOnline:
167 _log.info("Online reconstruction, no input file. Return default EDMVersion=%d", default_version)
168 return default_version
169 try:
170 from TrigEDMConfig.Utils import getEDMVersionFromBS
171 except ImportError:
172 log.error("Failed to import TrigEDMConfig, analysing ByteStream files is not possible in this release!")
173 raise
174
175
176 version = getEDMVersionFromBS(flags.Input.Files[0])
177
178 return version if version is not None else default_version
179
180 else:
181 # POOL files: decide based on HLT output type present in the file
182 _log.debug("Input format is POOL -- determine from input file collections")
183 collections = flags.Input.Collections
184 if "HLTResult_EF" in collections:
185 _log.info("Determined EDMVersion to be 1, because HLTResult_EF found in POOL file")
186 return 1
187 elif "TrigNavigation" in collections:
188 _log.info("Determined EDMVersion to be 2, because TrigNavigation found in POOL file")
189 return 2
190 elif any("HLTNav_Summary" in s for s in collections):
191 if flags.GeoModel.Run >= LHCPeriod.Run4:
192 _log.info("Determined EDMVersion to be 4, because HLTNav_Summary.* found in POOL file and GeoModel.Run >= 4")
193 return 4
194 else:
195 _log.info("Determined EDMVersion to be 3, because HLTNav_Summary.* found in POOL file")
196 return 3
197 elif flags.Trigger.doHLT or flags.Trigger.doLVL1:
198 if flags.GeoModel.Run >= LHCPeriod.Run4:
199 _log.info("Determined EDMVersion to be 4, because we're now running the trigger and GeoModel.Run >= 4")
200 return 4
201 else:
202 _log.info("Determined EDMVersion to be 3, because we're now running the trigger")
203 return 3
204 elif not flags.Input.Collections:
205 # Special case for empty input files (can happen in merge jobs on the grid)
206 # The resulting version doesn't really matter as there's nothing to be done, but we want a valid configuration
207 _log.warning("All input files seem to be empty, cannot determine EDM version. Guessing EDMVersion=3")
208 return 3
209
210 _log.info("Could not determine EDM version from the input file. Return default EDMVersion=%d",
211 default_version)
212 return default_version
213
214 flags.addFlag('Trigger.EDMVersion', lambda prevFlags: EDMVersion(prevFlags),
215 help='Trigger EDM version (determined by input file or set to the version to be produced)')
216
217 flags.addFlag('Trigger.doEDMVersionConversion', False,
218 help='convert Run-1&2 EDM to Run-3 EDM')
219
220 flags.addFlag('Trigger.doxAODConversion', True,
221 help=('convert Run-1 EDM to xAOD'))
222
223 flags.addFlag('Trigger.doOnlineNavigationCompactification', True,
224 help='enable trigger Navigation compactification into a single collection')
225
226 flags.addFlag('Trigger.doNavigationSlimming', True,
227 help='enable Navigation slimming for RAWtoXYZ or AODtoDAOD transforms')
228
229 flags.addFlag('Trigger.derivationsExtraChains', [],
230 help='list of chains which should be considered for trigger-matching in addition to those from the TriggerAPI when running derivations')
231
232 # CostMonitoring category
233 flags.addFlag('Trigger.CostMonitoring.doCostMonitoring', True,
234 help='enable cost monitoring')
235
236 flags.addFlag('Trigger.CostMonitoring.chain', 'HLT_noalg_CostMonDS_L1All',
237 help='Cost monitoring chain name')
238
239 flags.addFlag('Trigger.CostMonitoring.outputCollection', 'HLT_TrigCostContainer',
240 help='Cost monitoring output collection name')
241
242 flags.addFlag('Trigger.CostMonitoring.monitorAllEvents', False,
243 help='enable Cost monitoring for all events')
244
245 flags.addFlag('Trigger.CostMonitoring.monitorROBs', True,
246 help='enable Cost monitoring of ROB accesses')
247
248 # L1 category
249 flags.addFlag('Trigger.L1.doMuon', True,
250 help='enable L1Muon ByteStream conversion/simulation')
251
252 flags.addFlag('Trigger.L1.doMuonTopoInputs', True,
253 help='enable ByteStream conversion/simulation of MUCTPI Topo TOBs')
254
255 flags.addFlag('Trigger.L1.doCalo', True,
256 help='enable L1Calo ByteStream conversion/simulation')
257
258 flags.addFlag('Trigger.L1.doCaloInputs', lambda prevFlags:
259 prevFlags.Trigger.L1.doCalo and prevFlags.Trigger.enableL1CaloPhase1 and not prevFlags.Trigger.doHLT,
260 help='enable L1Calo Input ([ejg]Towers) ByteStream conversion/simulation')
261
262 flags.addFlag('Trigger.L1.doeFex', lambda prevFlags:
263 prevFlags.Trigger.L1.doCalo and prevFlags.Trigger.enableL1CaloPhase1,
264 help='enable eFEX ByteStream conversion/simulation')
265
266 flags.addFlag('Trigger.L1.Menu.doeFexBDTTau', True,
267 help='set BDT tau algorithm as the active one for eFEX when constructing L1 menus')
268
269 flags.addFlag('Trigger.L1.dojFex', lambda prevFlags:
270 prevFlags.Trigger.L1.doCalo and prevFlags.Trigger.enableL1CaloPhase1,
271 help='enable jFEX ByteStream conversion/simulation')
272
273 flags.addFlag('Trigger.L1.dogFex', lambda prevFlags:
274 prevFlags.Trigger.L1.doCalo and prevFlags.Trigger.enableL1CaloPhase1,
275 help='enable gFEX ByteStream conversion/simulation')
276
277 flags.addFlag('Trigger.L1.L1CaloSuperCellContainerName', lambda prevFlags:
278 "EmulatedSCell" if prevFlags.GeoModel.Run is LHCPeriod.Run2 else "SCell",
279 help='name of SuperCell container')
280
281 flags.addFlag('Trigger.L1.doTopo', True,
282 help='enable L1Topo ByteStream conversion/simulation (steering both legacy and phase-1 Topo)')
283
284 flags.addFlag('Trigger.L1.doTopoPhase1', lambda prevFlags:
285 prevFlags.Trigger.L1.doTopo and prevFlags.Trigger.enableL1CaloPhase1,
286 help='control Phase-I L1Topo simulation even if L1.doTopo is True')
287
288 flags.addFlag('Trigger.L1.doGlobal', lambda prevFlags: prevFlags.GeoModel.Run >= LHCPeriod.Run4,
289 help='enable L0Global ByteStream conversion/simulation')
290
291 flags.addFlag('Trigger.L1.doCTP', True,
292 help='enable CTP ByteStream conversion/simulation')
293
294 flags.addFlag('Trigger.L1.Menu.doHeavyIonTobThresholds', lambda prevFlags:
295 'HI' in prevFlags.Trigger.triggerMenuSetup,
296 help='modify min-pt-to-Topo threshold for TOBs to HI values')
297
298 flags.addFlag('Trigger.L1.errorOnMissingTOB', True,
299 help='Set to true to enable strict-mode which will generate an ERROR on missing (non-overflow) TOB events in HLT-seeding from L1')
300
301 # Online category
302 flags.addFlag('Trigger.Online.partitionName', os.getenv('TDAQ_PARTITION') or '',
303 help='partition name used to determine online vs offline BS result writing')
304
305 flags.addFlag('Trigger.Online.isPartition', lambda prevFlags: len(prevFlags.Trigger.Online.partitionName)>0,
306 help='check if job is running in a partition (i.e. partition name is not empty)')
307
308 flags.addFlag("Trigger.Online.useEFByteStreamSvc", False,
309 help='use online EF ByteStream services')
310 flags.addFlag('Trigger.Online.EFInterface.Files', [])
311 flags.addFlag('Trigger.Online.EFInterface.OutputFileName', '')
312 flags.addFlag('Trigger.Online.EFInterface.LoopFiles', False)
313 flags.addFlag('Trigger.Online.EFInterface.NumEvents', -1)
314 flags.addFlag('Trigger.Online.EFInterface.SkipEvents', 0)
315 flags.addFlag('Trigger.Online.EFInterface.RunNumber', 0)
316 flags.addFlag('Trigger.Online.EFInterface.T0ProjectTag', '')
317 flags.addFlag('Trigger.Online.EFInterface.BeamType', 0)
318 flags.addFlag('Trigger.Online.EFInterface.BeamEnergy', 0)
319 flags.addFlag('Trigger.Online.EFInterface.TriggerType', 0)
320 flags.addFlag('Trigger.Online.EFInterface.Stream', '')
321 flags.addFlag('Trigger.Online.EFInterface.Lumiblock', 0)
322 flags.addFlag('Trigger.Online.EFInterface.DetMask', '00000000000000000000000000000000')
323 flags.addFlag('Trigger.Online.EFInterface.LibraryName', 'TrigDFEmulator',
324 help='Name of the EFDF interface shared library to load')
325
326 flags.addFlag('Trigger.Online.useOnlineTHistSvc', False,
327 help='use online THistSvc')
328
329 flags.addFlag('Trigger.Online.useOnlineWebdaqHistSvc', False,
330 help='use online Webdaq HistSvc')
331
332 flags.addFlag('Trigger.Online.BFieldAutoConfig', True,
333 help='auto-configure magnetic field from currents in IS')
334
335 flags.addFlag('Trigger.writeBS', False,
336 help='enable bytestream writing of trigger information')
337
338 flags.addFlag('Trigger.doTransientByteStream', lambda prevFlags:
339 True if prevFlags.Input.Format is Format.POOL and prevFlags.Trigger.doCalo else False,
340 help='create transient BS (for running on MC RDO with clients that require BS inputs)')
341
342 flags.addFlag('Trigger.AODEDMSet', lambda flags: 'AODSLIM' if flags.Input.isMC else 'AODFULL',
343 help='list of EDM objects to be written to AOD')
344
345 flags.addFlag('Trigger.ESDEDMSet', 'ESD',
346 help='list of EDM objects to be written to ESD')
347
348 flags.addFlag('Trigger.addRun3LowMuEDM', lambda prevFlags: "pp_lowMu_run3" in prevFlags.Trigger.triggerMenuSetup, help="Specify whether to add dedicated low mu EDM. Default is dependent on the menu setup." )
349
350 flags.addFlag('Trigger.ExtraEDMList', [],
351 help='list of extra EDM objects to be stored (for testing). Supported features: Add new items. Add extra decorations to existing Aux. Add additional output targets.')
352
353 def __availableRecoMetadata(flags):
354 systems = ['L1','HLT']
355 # Online reco without input files
356 if not any(flags.Input.Files) and flags.Common.isOnline:
357 return systems
358 # Makes no sense when running HLT
359 elif flags.Trigger.doHLT:
360 raise RuntimeError('Trigger.availableRecoMetadata is ill-defined if Trigger.doHLT==True')
361 # RAW: check if keys are in COOL
362 elif flags.Input.Format is Format.BS:
363 from TrigConfigSvc.TriggerConfigAccess import getKeysFromConditions
364 keys = getKeysFromConditions(flags.Input.RunNumbers[0], lbNr = 1, flags = flags) # currently only checking first file
365 return ( (['L1'] if 'LVL1PSK' in keys else []) +
366 (['HLT'] if 'HLTPSK' in keys else []) )
367 # POOL: metadata (do not distinguish L1/HLT yet, see discussions on GitLab commit f83ae2bc)
368 else:
369 return systems if flags.Trigger.triggerConfig == 'INFILE' else []
370
371 flags.addFlag('Trigger.availableRecoMetadata', lambda flags: __availableRecoMetadata(flags),
372 help="list of enabled trigger sub-systems in reconstruction: ['L1,'HLT']")
373
374 flags.addFlag("Trigger.decodeHLT", True,
375 help='enable decoding of HLT trigger decision/result in reconstruction')
376
377 flags.addFlag("Trigger.DecisionMakerValidation.Execute", True,
378 help='run trigger decision validation algorithm in reconstruction')
379
380 flags.addFlag("Trigger.DecisionMakerValidation.ErrorMode", True,
381 help='emit an ERROR (or WARNING) in case of trigger decision validation failure')
382
383 # Auto configure most probable choice for trigger configuration source based on job setup
384 def __triggerConfig(flags):
385 _log = logging.getLogger('TriggerConfigFlags.triggerConfig')
386 if flags.Common.isOnline and not flags.Trigger.doHLT:
387 # When running reconstruction at P1 (e.g. global monitoring, event display, etc.)
388 _log.debug("Autoconfigured default value for running reconstruction inside Point 1: 'DB'")
389 return 'DB'
390 elif flags.Input.Format is Format.BS:
391 from glob import glob
392 hasLocal = True if (glob("HLTMenu*.json") and glob("L1Menu*.json") and glob("HLTPrescales*.json") and glob("L1Prescales*.json") and glob("HLTMonitoring*.json") and glob("BunchGroupSet*.json")) else False
393 if flags.Trigger.doHLT:
394 # When running the Run 3 trigger on data, data the default config source is from the JSON created by compiling the menu in the job config phase
395 _log.debug("Autoconfigured default value for running the trigger on data: 'FILE'")
396 return 'FILE'
397 elif hasLocal:
398 # When running reco (doHLT == False) from RAW in a directory which already has a full suite of JSONs, assume that the user has just run the trigger manually
399 # and now wants to reconstruct the output using the menu files created when the trigger was executed, rather than reading the DB configuration for the run.
400 # A number of ART tests chain trigger then reco like this.
401 _log.debug("Autoconfigured default value for running reconstruction with a pre-supplied set of trigger configuration JSON files: 'FILE'")
402 return 'FILE'
403 elif flags.GeoModel.Run >= LHCPeriod.Run3:
404 # When reconstructing Run 3 data the default config source is the database
405 _log.debug("Autoconfigured default value for reconstruction of Run 3 data: 'DB'")
406 return 'DB'
407 else:
408 # When reconstructing Run 2 or Run 1 data, a stand-alone database converter will be called from python. We then need to load the converted JSON from disk
409 _log.debug("Autoconfigured default value for reconstruction of Run 1 or Run 2 data: 'FILE'")
410 return 'FILE'
411 else: # Format.POOL
412 from AthenaConfiguration.AutoConfigFlags import GetFileMD
413 md = GetFileMD(flags.Input.Files)
414 # Note: the following comprehension will detect both Run 2 and Run 3 in-file metadata formats.
415 # As of 2023, the Run 2 metadata format is still in production use for Run 2 MC AODs, DAODs produced with the Release 21 Run 2 trigger.
416 hasTrigMeta = ("metadata_items" in md and any(('TriggerMenu' in key) for key in md["metadata_items"].keys()))
417 if hasTrigMeta:
418 # When running over a file which already has metadata content (RDO_TRIG, ESD, AOD, DAOD), then read this from within the file's meta store
419 _log.debug("Autoconfigured default value to read trigger configuration data from the input file: 'INFILE'")
420 return 'INFILE'
421 else:
422 # MC production, read the menu JSON generated during the trigger job configuration
423 _log.debug("Autoconfigured default value to read trigger configuration data from disk for MC production: 'FILE'")
424 return 'FILE'
425
426 flags.addFlag('Trigger.triggerConfig', lambda flags: __triggerConfig(flags),
427 help='Trigger configuration source (https://twiki.cern.ch/twiki/bin/view/Atlas/TriggerConfigFlag)')
428
429 flags.addFlag('Trigger.useCrest', lambda prevFlags: prevFlags.IOVDb.UseCREST, # only effective if Trigger.triggerConfig is set to 'DB'
430 help='Flag enables trigger configuration database access through CREST')
431
432 flags.addFlag('Trigger.crestServer', lambda prevFlags: prevFlags.IOVDb.CrestServer,
433 help='CREST server to access trigger configuration')
434
435 flags.addFlag('Trigger.triggerMenuSetup', lambda flags: 'MC_pp_run3_v1_BulkMCProd_prescale' if flags.GeoModel.Run is LHCPeriod.Run3 else 'MC_pp_run4_v1_BulkMCProd_prescale',
436 help='name of the trigger menu')
437
438 flags.addFlag('Trigger.generateMenuDiagnostics', False,
439 help='print debug output from control flow generation')
440
441 flags.addFlag('Trigger.fastMenuGeneration', True,
442 help='avoid re-merging CAs that were already seen once')
443
444 flags.addFlag('Trigger.disableCPS', False,
445 help='disable coherent prescale sets (for testing with small menu)')
446
447 flags.addFlag('Trigger.enableEndOfEventProcessing', True,
448 help='enable execution of extra algorithms for accepted events')
449
450 flags.addFlag('Trigger.doCFEmulationTest', False,
451 help='enable run Control Flow Emulation test')
452
453 # trigger reconstruction
454 # Protection against import of packages not in the analysis release
455 # Signature and other trigger reco flags should be handled here
456 if doTriggerRecoFlags:
457 flags.join( createTriggerRecoFlags() )
458
459 # Disable the CPS system if the restricted menu flags are active
460 flags.Trigger.disableCPS = lambda prevFlags: prevFlags.Trigger.selectChains or len(prevFlags.Trigger.enabledSignatures)==1
461
462 return flags
463
464
466 flags = AthConfigFlags()
467
468 # Additional flags to filter chains
469 def _allSignatures (prevFlags):
470 from TriggerMenuMT.HLT.Config.GenerateMenuMT import allSignatures
471 l = list(allSignatures())
472 l.sort()
473 return l
474 flags.addFlag("Trigger.enabledSignatures", _allSignatures, help='list of enabled trigger signatures')
475 flags.addFlag("Trigger.disabledSignatures", [], help='list of disabled trigger signatures')
476 flags.addFlag("Trigger.selectChains", [], help='list of enabled chains')
477 flags.addFlag("Trigger.disableChains", [], help='list of disabled chains')
478
479 def __egamma():
480 from TriggerMenuMT.HLT.Egamma.TrigEgammaConfigFlags import createTrigEgammaConfigFlags
481 return createTrigEgammaConfigFlags()
482 flags.addFlagsCategory('Trigger.egamma', __egamma )
483
484 # muon offline reco flags varaint for trigger
485 def __muonSA():
486 from MuonConfig.MuonConfigFlags import createMuonConfigFlags
487 muonflags = createMuonConfigFlags()
488 muonflags.Muon.useTGCPriorNextBC=True
489 muonflags.Muon.MuonTrigger=True
490 muonflags.Muon.SAMuonTrigger=True
491 muonflags.Muon.enableErrorTuning=False
492 return muonflags
493 flags.addFlagsCategory('Trigger.Offline.SA', __muonSA, prefix=True)
494
495 def __muon():
496 from MuonConfig.MuonConfigFlags import createMuonConfigFlags
497 muonflags = createMuonConfigFlags()
498 muonflags.Muon.useTGCPriorNextBC=True
499 muonflags.Muon.MuonTrigger=True
500 muonflags.Muon.enableErrorTuning=False
501 return muonflags
502 flags.addFlagsCategory('Trigger.Offline', __muon, prefix=True)
503
504 def __muonCombined():
505 from MuonCombinedConfig.MuonCombinedConfigFlags import createMuonCombinedConfigFlags
506 muonflags = createMuonCombinedConfigFlags()
507 muonflags.MuonCombined.doCaloTrkMuId = False
508 muonflags.MuonCombined.doSiAssocForwardMuons = False
509 muonflags.MuonCombined.doStatisticalCombination = False
510 muonflags.MuonCombined.doMuGirl = False
511 muonflags.MuonCombined.doCombinedFit = True
512 return muonflags
513 flags.addFlagsCategory('Trigger.Offline.Combined', __muonCombined, prefix=True)
514
515 from AthenaCommon.SystemOfUnits import mm
516 flags.addFlag('Trigger.Muon.IsolationDzCut', 2.0*mm, help='Value of dz cut used in muon isolation calculation in the trigger')
517
518 flags.addFlag('Trigger.Muon.useNewRegionSelector', False, help='usage of new region selector')
519
520 def __tau():
521 from TrigTauRec.TrigTauConfigFlags import createTrigTauConfigFlags
522 return createTrigTauConfigFlags()
523 flags.addFlagsCategory('Trigger.Offline.Tau', __tau )
524
525 def __idTrk():
526 from TrigInDetConfig.TrigTrackingPassFlags import createTrigTrackingPassFlags
527 return createTrigTrackingPassFlags()
528 flags.addFlagsCategory( 'Trigger.InDetTracking', __idTrk )
529
530 def __idITk():
531 from TrigInDetConfig.TrigTrackingPassFlags import createTrigTrackingPassFlags
532 return createTrigTrackingPassFlags(mode='ITk')
533 flags.addFlagsCategory( 'Trigger.ITkTracking', __idITk )
534
535 def _idActs():
536 from TrigInDetConfig.TrigTrackingPassFlags import createTrigTrackingPassFlags
537 return createTrigTrackingPassFlags(mode='Acts')
538 flags.addFlagsCategory( 'Trigger.ActsTracking', _idActs )
539
540 flags.addFlag('Trigger.useActsTracking', False, help='use ACTS for ITk tracking')
541 flags.addFlag('Trigger.EFTrackPipeline', "", help='string to specify EFTrack pipeline')
542
543 def __trigCalo():
544 from TrigCaloRec.TrigCaloConfigFlags import createTrigCaloConfigFlags
545 return createTrigCaloConfigFlags()
546 flags.addFlagsCategory( 'Trigger.Calo', __trigCalo )
547
548 def __muctpiFlags():
549 from TrigT1MuctpiPhase1.TrigMUCTPIConfigFlags import createTrigMUCTPIConfigFlags
550 return createTrigMUCTPIConfigFlags()
551 flags.addFlagsCategory('Trigger.MUCTPI', __muctpiFlags )
552
553 def __ctpFlags():
554 from TrigT1CTP.CTPSimulationConfigFlags import createTrigCTPConfigFlags
555 return createTrigCTPConfigFlags()
556 flags.addFlagsCategory('Trigger.CTP', __ctpFlags )
557
558 def __fpgatracksimFlags():
559 """Additional function delays import"""
560 from FPGATrackSimConfTools.FPGATrackSimConfigFlags import createFPGATrackSimConfigFlags
561 return createFPGATrackSimConfigFlags()
562 flags.addFlagsCategory("Trigger.FPGATrackSim", __fpgatracksimFlags, prefix=True )
563
564 def __jet():
565 from TriggerMenuMT.HLT.Jet.TrigJetConfigFlags import createTrigJetConfigFlags
566 return createTrigJetConfigFlags()
567 flags.addFlagsCategory('Trigger.Jet', __jet )
568
569 def __fshad():
570 from TriggerMenuMT.HLT.Jet.TrigJetConfigFlags import createTrigFSHadConfigFlags
571 return createTrigFSHadConfigFlags()
572 flags.addFlagsCategory('Trigger.FSHad', __fshad )
573
574 return flags
575
576
577if __name__ == "__main__":
578 import unittest
579 from AthenaConfiguration.AllConfigFlags import initConfigFlags
580 from AthenaConfiguration.Enums import Project
581 flags = initConfigFlags()
582
583 class Tests(unittest.TestCase):
584
585 @unittest.skipIf(flags.Common.Project is Project.AthAnalysis, "project is AthAnalysis")
586 def test_recoFlags(self):
587 """Check if offline reco flags can be added to trigger"""
588 flags = initConfigFlags()
589 flags.Trigger.Offline.Tau.doTauRec=False
590 flags.Tau.doTauRec=True
591 self.assertEqual(flags.Trigger.Offline.Tau.doTauRec, False, "dependent flag setting does not work")
592 self.assertEqual(flags.Tau.doTauRec, True, "dependent flag setting does not work")
593
594 newflags = flags.cloneAndReplace('Tau', 'Trigger.Offline.Tau')
595
596 self.assertEqual(flags.Tau.doTauRec, True, "dependent flag setting does not work")
597 self.assertEqual(newflags.Tau.doTauRec, False, "dependent flag setting does not work")
598
599 def test_allFlags(self):
600 """Force load all dynamic flags"""
601 flags = initConfigFlags()
602 flags.loadAllDynamicFlags()
603
604 unittest.main()
createTriggerFlags(doTriggerRecoFlags)