ATLAS Offline Software
Loading...
Searching...
No Matches
AllConfigFlags.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.SystemOfUnits import GeV, TeV
4from AthenaConfiguration.AthConfigFlags import AthConfigFlags, isGaudiEnv
5from AthenaConfiguration.AutoConfigFlags import GetFileMD, getInitialTimeStampsFromRunNumbers, getRunToTimestampDict, getSpecialConfigurationMetadata, getGeneratorsInfo
6from AthenaConfiguration.Enums import BeamType, Format, ProductionStep, BunchStructureSource, Project, LHCPeriod
7from Campaigns.Utils import Campaign
8from PyUtils.moduleExists import moduleExists
9
10
11def _addFlagsCategory (acf, name, generator, modName = None):
12 """Add flags category and return True/False on success/failure"""
13 if moduleExists (modName):
14 acf.addFlagsCategory (name, generator)
15 return True
16 return False
17
18
20
21 acf=AthConfigFlags()
22
23 #Flags steering the job execution:
24 from AthenaCommon.Constants import INFO
25 acf.addFlag('Exec.OutputLevel', INFO, help='Global OutputLevel')
26 acf.addFlag('Exec.QuietMode', True, help='Suppress excess output for grid running')
27 acf.addFlag('Exec.PrintAlgsSequence', False, help='print algorithm sequence in ApplicationMgr')
28 acf.addFlag('Exec.MaxEvents', -1, type=int, help='number of events to proceess (-1 for all)')
29 acf.addFlag('Exec.SkipEvents', 0, type=int, help='number of events to skip')
30 acf.addFlag('Exec.FirstEvent', 1, type=int, help='first event number when not reading from input file')
31 acf.addFlag('Exec.DebugStage', '', help='attach debugger at stage: conf, init, exec, fini')
32 acf.addFlag('Exec.Interactive', "", help='interactive prompt at stage: init, exec')
33 acf.addFlag('Exec.FPE', 0, help='FPE check mode: -2 (no FPE check), -1 (abort with core-dump), 0 (FPE Auditor w/o stack-tace) , >0 (number of stack-traces printed by the job)')
34 acf.addFlag('Exec.EventTimeOut', 0, help='per-event timeout (in ns) after which the job is aborted (0 means no timeout)')
35 acf.addFlag('Exec.EventPrintoutInterval', 1, help='interval of event heartbeat printouts from the loop manager')
36 acf.addFlag('Exec.StopOnSignal', [], help='List of signal names that can be used to stop the job gracefully. See SignalMonitorSvc in GaudiUtils.' )
37
38 #Custom messaging for components, see Utils.setupLoggingLevels
39 acf.addFlag('Exec.VerboseMessageComponents', [], help='verbose output for listed components (wildcards)')
40 acf.addFlag('Exec.DebugMessageComponents', [], help='debug output for listed components (wildcards)')
41 acf.addFlag('Exec.InfoMessageComponents', [], help='info output for listed components (wildcards)')
42 acf.addFlag('Exec.WarningMessageComponents', [], help='warning output for listed components (wildcards)')
43 acf.addFlag('Exec.ErrorMessageComponents', [], help='error output for listed components (wildcards)')
44
45 #Multi-threaded event service mode
46 acf.addFlag('Exec.MTEventService', False, help='use multi-threaded event service')
47 acf.addFlag('Exec.MTEventServiceChannel', 'EventService_EventRanges', help='name of YAMPL communication channel between AthenaMT and pilot')
48
49 #Multi-node with MPI
50 acf.addFlag('Exec.MPI', False, help='run in MPI mode')
51
52 #Activate per-event log-output of StoreGate content
53 acf.addFlag('Debug.DumpEvtStore', False, help='dump event store on each event')
54 acf.addFlag('Debug.DumpDetStore', False, help='dump detector store on each event')
55 acf.addFlag('Debug.DumpCondStore', False, help='dump conditions store on each event')
56
57 #Activate NameAuditor
58 acf.addFlag('Debug.NameAuditor',False,help='Activate NameAuditor')
59
60 acf.addFlag('ExecutorSplitting.TotalSteps', 0, help='number of steps for pileup overlay')
61 acf.addFlag('ExecutorSplitting.Step', -1, help='step number of current pileup overlay job')
62 acf.addFlag('ExecutorSplitting.TotalEvents', -1, help='events per pileup overlay step')
63
64 #Flags describing the input data
65 acf.addFlag('Input.Files', ["_ATHENA_GENERIC_INPUTFILE_NAME_",], help='input files')
66 acf.addFlag("Input.FileNentries", -1, help='actual number of events in file (filled from runArgs')
67 acf.addFlag('Input.SecondaryFiles', [], help='secondary input files for DoubleEventSelector')
68 acf.addFlag('Input.isMC', lambda prevFlags : "IS_SIMULATION" in GetFileMD(prevFlags.Input.Files).get("eventTypes", []), help='Monte Carlo input')
69 acf.addFlag('Input.OverrideRunNumber', False, help='override run number' )
70 acf.addFlag("Input.ConditionsRunNumber", -1, help='override HITS file run number with one from a data') # TODO merge with Input.RunNumbers
71 acf.addFlag('Input.RunNumbers', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("runNumbers", [])), type=list, help='run numbers of input files')
72 acf.addFlag('Input.MCChannelNumber', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("mc_channel_number", 0), help='Monte Carlo channel number')
73 acf.addFlag('Input.LumiBlockNumbers', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("lumiBlockNumbers", [])), type=list, help='lumi block numbers of input files')
74 acf.addFlag('Input.TimeStamps', lambda prevFlags : getInitialTimeStampsFromRunNumbers(prevFlags.Input.RunNumbers) if prevFlags.Input.OverrideRunNumber else [], type=list, help='timestamps of inputs files')
75 # Configure EvtIdModifierSvc with a list of dictionaries of the form:
76 # {'run': 152166, 'lb': 202, 'starttstamp': 1269948352889940910, 'evts': 1, 'mu': 0.005}
77 acf.addFlag("Input.RunAndLumiOverrideList", [], help='list of dictionaries to configure EvtIdModifierSvc')
78 # Job number
79 acf.addFlag("Input.JobNumber", 1, help='job number for pileup overlay')
80 acf.addFlag('Input.FailOnUnknownCollections', False, help='fail on unknown collections in input load')
81
82 def _dataYearFromFlags(prevFlags):
83 dataYear = GetFileMD(prevFlags.Input.Files).get("data_year", "")
84 if dataYear:
85 return int(dataYear)
86 if prevFlags.Input.ProjectName.startswith("data"):
87 if prevFlags.Input.ProjectName[4:6].isdigit():
88 return 2000 + int(prevFlags.Input.ProjectName[4:6])
89 return 0
90
91 def _keywordsFromFlags(prevFlags):
92 keywords_string = GetFileMD(prevFlags.Input.Files).get("keywords", "")
93 return [keyword.strip() for keyword in keywords_string.split(',') if keyword.strip()]
94
95 acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name", ""), help='project name')
96 acf.addFlag('Input.DataYear', _dataYearFromFlags, help='year of input data')
97 acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), type=Campaign, help='Monte Carlo campaign')
98 acf.addFlag('Input.TriggerStream', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("stream", "") if prevFlags.Input.Format == Format.BS
99 else GetFileMD(prevFlags.Input.Files).get("triggerStreamOfFile", ""), help='trigger stream name')
100 acf.addFlag('Input.Format', lambda prevFlags : Format.BS if GetFileMD(prevFlags.Input.Files).get("file_type", "BS") == "BS" else Format.POOL, type=Format, help='input format type')
101 acf.addFlag('Input.ProcessingTags', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("processingTags", []), help='list of stream names in this file')
102 acf.addFlag('Input.GeneratorsInfo', getGeneratorsInfo, help='generator version')
103 acf.addFlag('Input.Keywords', _keywordsFromFlags, type=list, help='evtgen keywords')
104 acf.addFlag('Input.SpecialConfiguration', getSpecialConfigurationMetadata, help='special configuration options read from input file metadata')
105
106 def _inputCollections(inputFile):
107 rawCollections = [type_key[1] for type_key in GetFileMD(inputFile).get("itemList", [])]
108 collections = [col for col in rawCollections if not col.endswith('Aux.')]
109 return collections
110
111 def _typedInputCollections(inputFile):
112 collections = ['%s#%s' % type_key for type_key in GetFileMD(inputFile).get("itemList", [])]
113 return collections
114
115 acf.addFlag('Input.Collections', lambda prevFlags : _inputCollections(prevFlags.Input.Files), help='input collections')
116 acf.addFlag('Input.SecondaryCollections', lambda prevFlags : _inputCollections(prevFlags.Input.SecondaryFiles), help='secondary input collections for overlay')
117 acf.addFlag('Input.TypedCollections', lambda prevFlags : _typedInputCollections(prevFlags.Input.Files), help='input collections key#type')
118 acf.addFlag('Input.SecondaryTypedCollections', lambda prevFlags : _typedInputCollections(prevFlags.Input.SecondaryFiles), help='secondary input collections key#type')
119
120 def _metadataItems(inputFile):
121 return GetFileMD(inputFile).get("metadata_items", {})
122
123 acf.addFlag('Input.MetadataItems', lambda prevFlags : _metadataItems(prevFlags.Input.Files), help='metadata items in input' )
124 acf.addFlag('Input.Release', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("AtlasRelease", ""), help='release of input file')
125 acf.addFlag('Input.AODFixesDone', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("AODFixVersion", ""), help='set of already applied AODFixes')
126
127 acf.addFlag('Concurrency.NumProcs', 0, help='number of concurrent processes')
128 acf.addFlag('Concurrency.NumThreads', 0, help='number of threads' )
129 acf.addFlag('Concurrency.NumConcurrentEvents', lambda prevFlags : prevFlags.Concurrency.NumThreads, help='number of concurrent events')
130 acf.addFlag('Concurrency.DebugWorkers', False, help='stops the worker in bootstrap until SIGUSR1 is received')
131 acf.addFlag('Concurrency.NumOffloadThreads', 0, help='maximum number of extra threads to use for CPU portion of asynchronous algorithms')
132
133 acf.addFlag('Scheduler.CheckDependencies', True, help='runtime check of algorithm input dependencies')
134 acf.addFlag('Scheduler.CheckOutputUsage', False, help='runtime check of algorithm output usage')
135 acf.addFlag('Scheduler.ShowDataDeps', False, help='show data dependencies')
136 acf.addFlag('Scheduler.ShowDataFlow', False, help='show data flow')
137 acf.addFlag('Scheduler.ShowControlFlow', False, help='show data flow')
138 acf.addFlag('Scheduler.EnableVerboseViews', True, help='enable verbose view output')
139 acf.addFlag('Scheduler.AutoLoadUnmetDependencies', True, help='auto-load unmet data dependencies')
140 acf.addFlag('Scheduler.DataDepsGraphFile', '', help='file name containing the data dependency graph [.dot or .md]')
141 acf.addFlag('Scheduler.DataDepsGraphAlgPattern', '.*', help='regex pattern for selecting algorithms to be drawn in the data dependency graph')
142 acf.addFlag('Scheduler.DataDepsGraphObjectPattern', '.*', help='regex pattern for selecting I/O to be drawn in the data dependency graph')
143
144 acf.addFlag('MP.WorkerTopDir', 'athenaMP_workers', help='work directory for MP workers')
145 acf.addFlag('MP.OutputReportFile', 'AthenaMPOutputs', help='name of MP report file')
146 acf.addFlag('MP.Strategy', 'SharedQueue', help='event assignment strategy')
147 acf.addFlag('MP.CollectSubprocessLogs', False, help='collects log of sub-processes')
148 acf.addFlag('MP.PollingInterval', 100, help='time interval in milliseconds between subsequent polling of subproceses')
149 acf.addFlag('MP.EventsBeforeFork', 0, help='number of events to process before forking')
150 acf.addFlag('MP.EventRangeChannel', 'EventService_EventRanges', help='channel name for communicating event ranges with the pilot')
151 acf.addFlag('MP.EvtRangeScattererCaching', False, help='activate extra event caching by the EvtRangeScatterer')
152 acf.addFlag('MP.MemSamplingInterval', 0, help='time interval in seconds between taking memory samples')
153 acf.addFlag('MP.ChunkSize', -1, help='size of event chunks in shared queue (-1: auto_flush for LZMA-compressed files, -2: auto_flush for LZMA or ZLIB, -3: auto_flush for LZMA, ZLIB or LZ4, -4: auto_flush)')
154 acf.addFlag('MP.ReadEventOrders', False, help='read event order from ASCII file for reproducibility')
155 acf.addFlag('MP.EventOrdersFile', 'athenamp_eventorders.txt', help='file name for event order')
156 acf.addFlag('MP.UseSharedReader', False, help='use shared reader')
157 acf.addFlag('MP.UseSharedWriter', False, help='use shared writer')
158 acf.addFlag('MP.UseParallelCompression', True, help='enable event compression in workers')
159 acf.addFlag('MP.SharedWriter.FileFlushSetting', {},
160 help="how frequently (in number of events) SW will flush the output, e.g., {'DAOD_PHYS.pool.root':500}. If empty, AutoFlush is used. Only applies when parallel compression is enabled.")
161
162 acf.addFlag('Common.MsgSuppression', True, help='enable log message suppression')
163 acf.addFlag('Common.MsgSourceLength', 50, help='length of the source-field in the log message format')
164 acf.addFlag('Common.ShowMsgStats', False ,help='print message statistics at the end of the job')
165
166 acf.addFlag('Common.isOnline', False, help='job runs in an online environment')
167 acf.addFlag('Common.useOnlineLumi', lambda prevFlags : prevFlags.Common.isOnline, help='use online version of luminosity')
168 acf.addFlag('Common.isOverlay', lambda prevFlags: prevFlags.Common.ProductionStep == ProductionStep.Overlay,
169 help='enable overlay')
170 acf.addFlag('Common.doExpressProcessing', False, help='do express stream processing')
171 acf.addFlag('Common.ProductionStep', ProductionStep.Default, type=ProductionStep, help='production step')
172 acf.addFlag('Common.Project', Project.determine(), type=Project, help='current athena software project')
173
174 # replace global.Beam*
175 acf.addFlag('Beam.BunchSpacing', 25, help='bunch spacing in nanoseconds')
176 acf.addFlag('Beam.Type', lambda prevFlags : BeamType(GetFileMD(prevFlags.Input.Files).get('beam_type', 'collisions')), type=BeamType, help='beam type')
177 acf.addFlag("Beam.NumberOfCollisions", lambda prevFlags : 2. if prevFlags.Beam.Type is BeamType.Collisions else 0., help='number of pileup collisions')
178
179 def _configureBeamEnergy(prevFlags):
180 metadata = GetFileMD(prevFlags.Input.Files)
181 default = 6.8 * TeV
182 # pool files
183 if prevFlags.Input.Format == Format.POOL:
184 return float(metadata.get("beam_energy", default))
185 # BS files
186 elif prevFlags.Input.Format == Format.BS:
187 if metadata.get("eventTypes", [""])[0] == "IS_DATA":
188 # special option for online running
189 if prevFlags.Common.isOnline:
190 from PyUtils.OnlineISConfig import GetRunType
191
192 return float(GetRunType()[1] or default)
193
194 # configure Beam energy depending on beam type:
195 if prevFlags.Beam.Type.value == "cosmics":
196 return 0.0
197 elif prevFlags.Beam.Type.value == "singlebeam":
198 return 450.0 * GeV
199 elif prevFlags.Beam.Type.value == "collisions":
200 projectName = prevFlags.Input.ProjectName
201 beamEnergy = None
202
203 if "GeV" in projectName:
204 beamEnergy = (
205 float(
206 (str(projectName).split("_")[1]).replace("GeV", "", 1)
207 )
208 / 2
209 * GeV
210 )
211 elif "TeV" in projectName:
212 if "hip5TeV" in projectName:
213 # Approximate 'beam energy' here as sqrt(sNN)/2.
214 beamEnergy = 1.577 * TeV
215 elif "hip8TeV" in projectName:
216 # Approximate 'beam energy' here as sqrt(sNN)/2.
217 beamEnergy = 2.51 * TeV
218 else:
219 beamEnergy = (
220 float(
221 (str(projectName).split("_")[1])
222 .replace("TeV", "", 1)
223 .replace("p", ".")
224 )
225 / 2
226 * TeV
227 )
228 if "5TeV" in projectName:
229 # these are actually sqrt(s) = 5.02 TeV
230 beamEnergy = 2.51 * TeV
231 elif projectName.endswith("_hi") or projectName.endswith("_hip"):
232 if projectName in ("data10_hi", "data11_hi"):
233 beamEnergy = 1.38 * TeV # 1.38 TeV (=3.5 TeV * (Z=82/A=208))
234 elif projectName == "data12_hi":
235 beamEnergy = 1.577 * TeV # 1.577 TeV (=4 TeV * (Z=82/A=208))
236 elif projectName in ("data12_hip", "data13_hip"):
237 # Pb (p) Beam energy in p-Pb collisions in 2012/3 was 1.577 (4) TeV.
238 # Approximate 'beam energy' here as sqrt(sNN)/2.
239 beamEnergy = 2.51 * TeV
240 elif projectName in ("data15_hi", "data18_hi"):
241 beamEnergy = 2.51 * TeV # 2.51 TeV (=6.37 TeV * (Z=82/A=208)) - lowered to 6.37 to match s_NN = 5.02 in Pb-p runs.
242 elif projectName == "data17_hi":
243 beamEnergy = 2.721 * TeV # 2.72 TeV for Xe-Xe (=6.5 TeV * (Z=54/A=129))
244 return beamEnergy or default
245 elif metadata.get("eventTypes", [""])[0] == "IS_SIMULATION":
246 return float(metadata.get("beam_energy", default))
247 return default
248
249
250 acf.addFlag('Beam.Energy', lambda prevFlags : _configureBeamEnergy(prevFlags), help='beam energy in MeV')
251 acf.addFlag('Beam.estimatedLuminosity', lambda prevFlags : ( 1E33*(prevFlags.Beam.NumberOfCollisions)/2.3 ) *\
252 (25./prevFlags.Beam.BunchSpacing), help='luminosity estimated from pileup')
253 acf.addFlag('Beam.BunchStructureSource', lambda prevFlags: BunchStructureSource.MC if prevFlags.Input.isMC else BunchStructureSource.TrigConf, help='source of bunch structure')
254
255 acf.addFlag('Beam.vdMScan.ConfigFile', 'LRAPositioner.root', help='vdM Scan Sim/Reco/BSFit Configuration File')
256 acf.addFlag('Beam.vdMScan.PV.PDF', 'Default', help='vdM Scan Sim/BSFit PV PDF Histogram')
257
258 # output
259 acf.addFlag('Output.BSFileName', '', help='BS output file name')
260 acf.addFlag('Output.EVNTFileName', '', help='EVNT output file name')
261 acf.addFlag('Output.TXTFileName', '', help='LHE output file name')
262 acf.addFlag('Output.EVNT_TRFileName', '', help='EVNT_TR output file name')
263 acf.addFlag('Output.HITSFileName', '', help='HITS output file name')
264 acf.addFlag('Output.RDOFileName', '', help='RDO output file name')
265 acf.addFlag('Output.RDO_SGNLFileName', '', help='RDO_SGNL output file name')
266 acf.addFlag('Output.ESDFileName', '', help='ESD output file name')
267 acf.addFlag('Output.AODFileName', '', help='AOD output file name')
268 acf.addFlag('Output.HISTFileName', '', help='HIST output file name')
269
270 acf.addFlag('Output.doWriteEVNT', lambda prevFlags: bool(prevFlags.Output.EVNTFileName), help='write EVNT file')
271 acf.addFlag('Output.doWriteTXT', lambda prevFlags: bool(prevFlags.Output.TXTFileName), help='write LHE file')
272 acf.addFlag('Output.doWriteEVNT_TR', lambda prevFlags: bool(prevFlags.Output.EVNT_TRFileName), help='write EVNT_TR file')
273 acf.addFlag('Output.doWriteHITS', lambda prevFlags: bool(prevFlags.Output.HITSFileName), help='write HITS file')
274 acf.addFlag('Output.doWriteRDO', lambda prevFlags: bool(prevFlags.Output.RDOFileName), help='write RDO file')
275 acf.addFlag('Output.doWriteRDO_SGNL', lambda prevFlags: bool(prevFlags.Output.RDO_SGNLFileName), help='write RDO_SGNL file')
276 acf.addFlag('Output.doWriteESD', lambda prevFlags: bool(prevFlags.Output.ESDFileName), help='write ESD file')
277 acf.addFlag('Output.doWriteAOD', lambda prevFlags: bool(prevFlags.Output.AODFileName), help='write AOD file')
278 acf.addFlag('Output.doWriteBS', False, help='write bytestream file')
279 acf.addFlag('Output.doWriteDAOD', False, help='write at least one DAOD file')
280 acf.addFlag('Output.doJiveXML', False, help='write JiveXML file')
281
282 acf.addFlag('Output.doGEN_AOD2xAOD', True, help="Configure the AODtoxAOD Truth Conversion")
283 acf.addFlag('Output.OneDataHeaderForm', False, help="Write only a single common DataHeaderForm per stream")
284 acf.addFlag('Output.TreeAutoFlush', {}, help="dict with auto-flush settings for stream e.g. {'STREAM': 123}")
285 acf.addFlag('Output.TemporaryStreams', [], help='list of output streams that are marked temporary')
286
287 # Eventually this should be stream specific, similar to TreeAutoFlush, but that needs some changes first
288 acf.addFlag('Output.DefaultContainerType', 'ROOTTREEINDEX', help='set the underlying storage technology for the default container type')
289
290 # Might move this elsewhere in the future.
291 # Some flags from https://gitlab.cern.ch/atlas/athena/blob/master/Tracking/TrkDetDescr/TrkDetDescrSvc/python/TrkDetDescrJobProperties.py
292 # (many, e.g. those that set properties of one tool are not needed)
293 acf.addFlag('TrackingGeometry.MagneticFileMode', 6) # TODO: unused?
294 acf.addFlag('TrackingGeometry.MaterialSource', 'COOL', help='material source (COOL, Input or None)')
295
296#Detector Flags:
297 def __detector():
298 from AthenaConfiguration.DetectorConfigFlags import createDetectorConfigFlags
299 return createDetectorConfigFlags()
300 acf.addFlagsCategory( "Detector", __detector )
301
302#Simulation Flags:
303 def __simulation():
304 from SimulationConfig.SimConfigFlags import createSimConfigFlags
305 return createSimConfigFlags()
306 _addFlagsCategory (acf, "Sim", __simulation, 'SimulationConfig' )
307
308#Test Beam Simulation Flags:
309 def __testbeam():
310 from SimulationConfig.TestBeamConfigFlags import createTestBeamConfigFlags
311 return createTestBeamConfigFlags()
312 _addFlagsCategory (acf, "TestBeam", __testbeam, 'SimulationConfig' )
313
314#Digitization Flags:
315 def __digitization():
316 from DigitizationConfig.DigitizationConfigFlags import createDigitizationCfgFlags
317 return createDigitizationCfgFlags()
318 _addFlagsCategory(acf, "Digitization", __digitization, 'DigitizationConfig' )
319
320#Overlay Flags:
321 def __overlay():
322 from OverlayConfiguration.OverlayConfigFlags import createOverlayConfigFlags
323 return createOverlayConfigFlags()
324 _addFlagsCategory(acf, "Overlay", __overlay, 'OverlayConfiguration' )
325
326#Geo Model Flags:
327 def __geomodel():
328 from AthenaConfiguration.GeoModelConfigFlags import createGeoModelConfigFlags
329 return createGeoModelConfigFlags(not isGaudiEnv() or acf.Common.Project is Project.AthAnalysis)
330 acf.addFlagsCategory( "GeoModel", __geomodel )
331
332#Reco Flags:
333 def __reco():
334 from RecJobTransforms.RecoConfigFlags import createRecoConfigFlags
335 return createRecoConfigFlags()
336 _addFlagsCategory(acf, "Reco", __reco, 'RecJobTransforms')
337
338#Generator Flags:
339 def __generators():
340 from GeneratorConfig.GeneratorConfigFlags import createGeneratorConfigFlags
341 return createGeneratorConfigFlags()
342 _addFlagsCategory(acf, "Generator", __generators, 'GeneratorConfig')
343
344#IOVDbSvc Flags:
345 if isGaudiEnv():
346 from IOVDbSvc.IOVDbAutoCfgFlags import (getLastGlobalTag, getDatabaseInstanceDefault,
347 getCrestServer, getCrestAPI, getCrestConnection)
348
349 def __getTrigTag(flags):
350 from TriggerJobOpts.TriggerConfigFlags import trigGlobalTag
351 return trigGlobalTag(flags)
352
353 acf.addFlag("IOVDb.GlobalTag", lambda flags :
354 (__getTrigTag(flags) if flags.Trigger.doLVL1 or flags.Trigger.doHLT else None) or
355 getLastGlobalTag(flags), help='global conditions tag')
356
357 acf.addFlag("IOVDb.DatabaseInstance", getDatabaseInstanceDefault, help='conditions DB instance')
358
359 # Run dependent simulation
360 acf.addFlag("IOVDb.RunToTimestampDict", lambda prevFlags: getRunToTimestampDict(), help='runNumber to timestamp map')
361
362 def __useCrest(flags):
363 if flags.Common.Project is Project.AthGeneration:
364 return False
365 elif flags.GeoModel.Run > LHCPeriod.Run3:
366 return False #To be set true when we make switch to CREST for Run4
367 else:
368 return False
369
370 acf.addFlag("IOVDb.UseCREST", __useCrest, help='Use CREST for conditions access')
371 acf.addFlag("IOVDb.CrestServer", lambda prevFlags: getCrestServer(), help="CREST server URL")
372 acf.addFlag("IOVDb.CrestAPI", lambda prevFlags : getCrestAPI(), help="CREST API version")
373
374 #For HLT-jobs, the ring-size should be 0 (eg no cleaning at all since there are no IOV-updates during the job)
375 acf.addFlag("IOVDb.CleanerRingSize",lambda prevFlags : 0 if prevFlags.Trigger.doHLT else 2*max(1, prevFlags.Concurrency.NumConcurrentEvents), help='size of ring-buffer for conditions cleaner')
376 acf.addFlag("IOVDb.SqliteInput","",help="Folders found in this file will be used instead of the production db")
377 acf.addFlag("IOVDb.SqliteFolders",(),help="Folders listed here will be taken from the IOVDb.SqliteInput file instead of the production db. If empty, all folders found in the file are used.")
378 acf.addFlag("IOVDb.WriteParametersAsMetaData", True, help="Write simulation/digitization parameters directly as in-file metadata (True) or via intermediate sqlite files (False)")
379
380 def _buildDBConn(flags):
381 if flags.IOVDb.UseCREST:
382 return getCrestConnection(flags.IOVDb.CrestServer, flags.IOVDb.CrestAPI)
383 else:
384 # In case of COOL, we have many different connection strings
385 # (like COOLONL_LAR/CONDR2 or COOLOFL_SCT/OFLP200), which are set for each
386 # folder individually. The value here is rather a dummy.
387 return "sqlite://;schema=mycool.db;dbname="+flags.IOVDb.DatabaseInstance
388
389 acf.addFlag("IOVDb.DBConnection", _buildDBConn, help='database connection string')
390
391#PoolSvc Flags:
392 acf.addFlag("PoolSvc.MaxFilesOpen", lambda prevFlags : 2 if prevFlags.MP.UseSharedReader else 0, help='maximum number of open files')
393 acf.addFlag("PoolSvc.PersSvcPerInputType", False, help='enable separate persistency service for each input type')
394
395
396 def __bfield():
397 from MagFieldConfig.BFieldConfigFlags import createBFieldConfigFlags
398 return createBFieldConfigFlags()
399 _addFlagsCategory(acf, "BField", __bfield, 'MagFieldConfig')
400
401 def __lar():
402 from LArConfiguration.LArConfigFlags import createLArConfigFlags
403 return createLArConfigFlags()
404 _addFlagsCategory(acf, "LAr", __lar, 'LArConfiguration' )
405
406 def __tile():
407 from TileConfiguration.TileConfigFlags import createTileConfigFlags
408 return createTileConfigFlags()
409 _addFlagsCategory(acf, 'Tile', __tile, 'TileConfiguration' )
410
411
412 def __calo():
413 from CaloRec.CaloConfigFlags import createCaloConfigFlags
414 return createCaloConfigFlags()
415 _addFlagsCategory(acf, 'Calo', __calo, 'CaloRec' )
416
417#Random engine Flags:
418 acf.addFlag("Random.Engine", "dSFMT", help='random number service ("dSFMT", "Ranlux64", "Ranecu")')
419 acf.addFlag("Random.SeedOffset", 0, help='seed offset') # TODO replace usage of Digitization.RandomSeedOffset with this flag
420
421 def __trigger():
422 from TriggerJobOpts.TriggerConfigFlags import createTriggerFlags
423 return createTriggerFlags(acf.Common.Project is not Project.AthAnalysis)
424
425 added = _addFlagsCategory(acf, "Trigger", __trigger, 'TriggerJobOpts' )
426 if not added:
427 # If TriggerJobOpts is not available, we add at least these basic flags
428 # to indicate Trigger is not available:
429 acf.addFlag('Trigger.doLVL1', False, help='enable L1 simulation')
430 acf.addFlag('Trigger.doHLT', False, help='run HLT selection algorithms')
431
432 def __indet():
433 from InDetConfig.InDetConfigFlags import createInDetConfigFlags
434 return createInDetConfigFlags()
435 _addFlagsCategory(acf, "InDet", __indet, 'InDetConfig' )
436
437 def __itk():
438 from InDetConfig.ITkConfigFlags import createITkConfigFlags
439 return createITkConfigFlags()
440 _addFlagsCategory(acf, "ITk", __itk, 'InDetConfig' )
441
442 def __tracking():
443 from TrkConfig.TrkConfigFlags import createTrackingConfigFlags
444 return createTrackingConfigFlags()
445 _addFlagsCategory(acf, "Tracking", __tracking, 'TrkConfig')
446
447 def __trackoverlay():
448 from TrackOverlayConfig.TrackOverlayConfigFlags import createTrackOverlayConfigFlags
449 return createTrackOverlayConfigFlags()
450 _addFlagsCategory(acf, "TrackOverlay", __trackoverlay, 'TrackOverlayConfig')
451
452 def __acts():
453 from ActsConfig.ActsConfigFlags import createActsConfigFlags
454 return createActsConfigFlags()
455 _addFlagsCategory(acf, "Acts", __acts, 'ActsConfig')
456
457 def __hgtd():
458 from HGTD_Config.HGTD_ConfigFlags import createHGTD_ConfigFlags
459 return createHGTD_ConfigFlags()
460 _addFlagsCategory(acf, "HGTD", __hgtd, 'HGTD_Config' )
461
462 def __muon():
463 from MuonConfig.MuonConfigFlags import createMuonConfigFlags
464 return createMuonConfigFlags()
465 _addFlagsCategory(acf, "Muon", __muon, 'MuonConfig' )
466
467 def __muoncombined():
468 from MuonCombinedConfig.MuonCombinedConfigFlags import createMuonCombinedConfigFlags
469 return createMuonCombinedConfigFlags()
470 _addFlagsCategory(acf, "MuonCombined", __muoncombined, 'MuonCombinedConfig' )
471
472 def __egamma():
473 from egammaConfig.egammaConfigFlags import createEgammaConfigFlags
474 return createEgammaConfigFlags()
475 _addFlagsCategory(acf, "Egamma", __egamma, 'egammaConfig' )
476
477 def __met():
478 from METReconstruction.METConfigFlags import createMETConfigFlags
479 return createMETConfigFlags()
480 _addFlagsCategory(acf,"MET",__met, 'METReconstruction')
481
482 def __jet():
483 from JetRecConfig.JetConfigFlags import createJetConfigFlags
484 return createJetConfigFlags()
485 _addFlagsCategory(acf,"Jet",__jet, 'JetRecConfig')
486
487 def __ufo():
488 from TrackCaloClusterRecTools.UFOConfigFlags import createUFOConfigFlags
489 return createUFOConfigFlags()
490 _addFlagsCategory(acf,"UFO",__ufo, 'TrackCaloClusterRecTools')
491
492 def __tau():
493 from tauRec.TauConfigFlags import createTauConfigFlags
494 return createTauConfigFlags()
495 _addFlagsCategory(acf, "Tau",__tau, 'tauRec')
496
497 def __ditau():
498 from DiTauRec.DiTauConfigFlags import createDiTauConfigFlags
499 return createDiTauConfigFlags()
500 _addFlagsCategory(acf, "DiTau",__ditau, 'DiTauRec')
501
502 def __pflow():
503 from eflowRec.PFConfigFlags import createPFConfigFlags
504 return createPFConfigFlags()
505 _addFlagsCategory(acf,"PF",__pflow, 'eflowRec')
506
507 def __btagging():
508 from JetTagConfig.BTaggingConfigFlags import createBTaggingConfigFlags
509 return createBTaggingConfigFlags()
510 _addFlagsCategory(acf,"BTagging",__btagging, 'JetTagConfig')
511
512 def __hi():
513 from HIRecConfig.HIRecConfigFlags import createHIRecConfigFlags
514 return createHIRecConfigFlags()
515 _addFlagsCategory(acf, "HeavyIon", __hi, "HIRecConfig")
516
517 def __onlineED():
518 from EventDisplaysOnline.EventDisplaysOnlineFlags import createOnlineEventDisplayFlags
519 return createOnlineEventDisplayFlags()
520 _addFlagsCategory(acf, "OnlineEventDisplays", __onlineED, 'EventDisplaysOnline' )
521
522 def __dq():
523 from AthenaMonitoring.DQConfigFlags import createDQConfigFlags
524 dqf = createDQConfigFlags()
525 return dqf
526 _addFlagsCategory(acf, "DQ", __dq, 'AthenaMonitoring' )
527
528 def __perfmon():
529 from PerfMonComps.PerfMonConfigFlags import createPerfMonConfigFlags
530 return createPerfMonConfigFlags()
531 _addFlagsCategory(acf, "PerfMon", __perfmon, 'PerfMonComps')
532
533 def __physVal():
534 from PhysValMonitoring.PhysValFlags import createPhysValConfigFlags
535 return createPhysValConfigFlags()
536 _addFlagsCategory(acf, "PhysVal", __physVal , "PhysValMonitoring")
537
538 def __caloRinger():
539 from CaloRingerAlgs.CaloRingerFlags import createCaloRingerConfigFlags
540 return createCaloRingerConfigFlags()
541 _addFlagsCategory(acf, "CaloRinger", __caloRinger, 'CaloRingerAlgs' )
542
543 def __caloGPU():
544 from CaloRecGPU.CaloRecGPUFlags import createFlagsCaloRecGPU
545 return createFlagsCaloRecGPU()
546 _addFlagsCategory(acf, "CaloRecGPU", __caloGPU, 'CaloRecGPU' )
547
548
550 from DerivationFrameworkConfiguration.DerivationConfigFlags import createDerivationConfigFlags
551 return createDerivationConfigFlags()
552 _addFlagsCategory(acf, "Derivation", __commonDerivation, 'DerivationFrameworkConfiguration' )
553
554#indet derivation flags
556 from DerivationFrameworkInDet.InDetDFConfigFlags import createInDetDFConfigFlags
557 return createInDetDFConfigFlags()
558 _addFlagsCategory(acf, "Derivation.InDet", __indetDerivation, 'DerivationFrameworkInDet' )
559
560#egamma derivation Flags:
562 from DerivationFrameworkEGamma.EGammaDFConfigFlags import createEGammaDFConfigFlags
563 return createEGammaDFConfigFlags()
564 _addFlagsCategory(acf, "Derivation.Egamma", __egammaDerivation, 'DerivationFrameworkEGamma' )
565
566#llp derivation Flags:
568 from DerivationFrameworkLLP.LLPDFConfigFlags import createLLPDFConfigFlags
569 return createLLPDFConfigFlags()
570 _addFlagsCategory(acf, "Derivation.LLP", __llpDerivation, 'DerivationFrameworkLLP' )
571
572 # onnxruntime flags
574 from AthOnnxComps.OnnxRuntimeFlags import createOnnxRuntimeFlags
575 return createOnnxRuntimeFlags()
576 _addFlagsCategory(acf, "AthOnnx", __onnxruntime, 'AthOnnxComps')
577
578 # (Accelerator) Device flags.
579 def __device():
580 from AthDeviceComps.DeviceConfigFlags import createDeviceConfigFlags
581 return createDeviceConfigFlags()
582 _addFlagsCategory(acf, "Device", __device, 'AthDeviceComps')
583
584 # CUDA flags.
585 def __cuda():
586 from AthCUDAServices.CUDAConfigFlags import createCUDAConfigFlags
587 return createCUDAConfigFlags()
588 _addFlagsCategory(acf, "CUDA", __cuda, 'AthCUDAServices')
589
590 #EFTracking fpga data prep (F100)
592 from EFTrackingFPGAPipeline.IntegrationConfigFlag import addFPGADataPrepFlags
593 return addFPGADataPrepFlags()
594
595 _addFlagsCategory(acf, "FPGADataPrep", _eftracking_f100, "EFTrackingFPGAPipeline")
596
597 def __fpga():
598 from AthXRTServices.FPGAConfigFlags import createFPGAMgmtFlags
599 return createFPGAMgmtFlags()
600 _addFlagsCategory(acf, "FPGAMgmt", __fpga, 'AthXRTServices' )
601
602 # For AnalysisBase, pick up things grabbed in Athena by the functions above
603 if not isGaudiEnv():
604 def EDMVersion(flags):
605 # POOL files: decide based on HLT output type present in the file
606 default_version = 3
607 collections = flags.Input.Collections
608 if "HLTResult_EF" in collections:
609 return 1
610 elif "TrigNavigation" in collections:
611 return 2
612 elif any("HLTNav_Summary" in s for s in collections):
613 return 3
614 elif not flags.Input.Collections:
615 # Special case for empty input files (can happen in merge jobs on the grid)
616 # The resulting version doesn't really matter as there's nothing to be done, but we want a valid configuration
617 return 3
618
619 return default_version
620 acf.addFlag('Trigger.EDMVersion', lambda prevFlags: EDMVersion(prevFlags),
621 help='Trigger EDM version (determined by input file or set to the version to be produced)')
622
623 return acf
624
625
626if __name__=="__main__":
627 from AthenaConfiguration.TestDefaults import defaultTestFiles
629 import sys
630 if len(sys.argv) > 1:
631 flags.Input.Files = sys.argv[1:]
632 else:
633 flags.Input.Files = defaultTestFiles.AOD_RUN3_DATA
634
635 flags.loadAllDynamicFlags()
636 flags.initAll()
637 flags.dump()
#define max(a, b)
Definition cfImp.cxx:41
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179
__commonDerivation()
common derivation flags
_addFlagsCategory(acf, name, generator, modName=None)