Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RAWtoALL_Skeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
4 from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
5 
6 from AthenaCommon import SystemOfUnits as Units
7 
8 # force no legacy job properties
9 from AthenaCommon import JobProperties
10 JobProperties.jobPropertiesDisallowed = True
11 
12 
13 
14 def fromRunArgs(runArgs):
15  from AthenaCommon.Logging import logging
16  log = logging.getLogger('RAWtoALL')
17  log.info('****************** STARTING Reconstruction (RAWtoALL) *****************')
18 
19  log.info('**** Transformation run arguments')
20  log.info(str(runArgs))
21 
22  import time
23  timeStart = time.time()
24 
25  log.info('**** executing ROOT6Setup')
26  from PyUtils.Helpers import ROOT6Setup
27  ROOT6Setup(batch=True)
28 
29  log.info('**** Setting-up configuration flags')
30  from AthenaConfiguration.AllConfigFlags import initConfigFlags
31  flags = initConfigFlags()
32  # set per-event timeout (in ns)
33  flags.Exec.EventTimeOut = 3600*Units.second
34 
35  commonRunArgsToFlags(runArgs, flags)
36 
37  # Autoconfigure enabled subdetectors
38  if hasattr(runArgs, 'detectors'):
39  detectors = runArgs.detectors
40  else:
41  detectors = None
42 
43  # TODO: event service?
44 
45 
47  inputsDRAW = [prop for prop in dir(runArgs) if prop.startswith('inputDRAW') and prop.endswith('File')]
48  if hasattr(runArgs, 'inputBSFile'):
49  if inputsDRAW:
50  raise RuntimeError('Impossible to run RAWtoALL with input BS and DRAW files (one input type only!)')
51  flags.Input.Files = runArgs.inputBSFile
52  if len(inputsDRAW) == 1:
53  flags.Input.Files = getattr(runArgs, inputsDRAW[0])
54  elif len(inputsDRAW) > 1:
55  raise RuntimeError('Impossible to run RAWtoALL with multiple input DRAW files (viz.: {0})'.format(inputsDRAW))
56 
57  # RDO
58  if hasattr(runArgs, 'inputRDOFile'):
59  flags.Input.Files = runArgs.inputRDOFile
60  if hasattr(runArgs, 'inputRDO_TRIGFile'):
61  flags.Input.Files = runArgs.inputRDO_TRIGFile
62  # TODO: trigger setup
63 
64  # TODO: EVNT?
65 
66 
67  if hasattr(runArgs, 'outputESDFile'):
68  flags.Output.ESDFileName = runArgs.outputESDFile
69  log.info("---------- Configured ESD output")
70 
71  if hasattr(runArgs, 'outputAODFile'):
72  flags.Output.AODFileName = runArgs.outputAODFile
73  log.info("---------- Configured AOD output")
74 
75  if hasattr(runArgs, 'outputHISTFile'):
76  flags.Output.HISTFileName = runArgs.outputHISTFile
77  flags.DQ.doMonitoring = True
78  log.info("---------- Configured HIST output")
79 
80  if hasattr(runArgs, 'outputHIST_R2AFile'):
81  flags.Output.HISTFileName = runArgs.outputHIST_R2AFile
82  flags.DQ.doMonitoring = True
83  log.info("---------- Configured HIST_R2A output")
84 
85  if hasattr(runArgs, 'outputDAOD_IDTIDEFile'):
86  flagString = 'Output.DAOD_IDTIDEFileName'
87  flags.addFlag(flagString, runArgs.outputDAOD_IDTIDEFile)
88  flags.Output.doWriteDAOD = True
89  flags.addFlag('Output.doWriteDAOD_IDTIDE', True)
90  log.info("---------- Configured DAOD_IDTIDE output")
91 
92  if hasattr(runArgs, 'outputDAOD_PIXELVALIDFile'):
93  flagString = 'Output.DAOD_PIXELVALIDFileName'
94  flags.addFlag(flagString, runArgs.outputDAOD_PIXELVALIDFile)
95  flags.Output.doWriteDAOD = True
96  flags.addFlag('Output.doWriteDAOD_PIXELVALID', True)
97  log.info("---------- Configured DAOD_PIXELVALID output")
98 
99  if hasattr(runArgs, 'outputDAOD_IDTRKVALIDFile'):
100  flagString = 'Output.DAOD_IDTRKVALIDFileName'
101  flags.addFlag(flagString, runArgs.outputDAOD_IDTRKVALIDFile)
102  flags.Output.doWriteDAOD = True
103  flags.addFlag('Output.doWriteDAOD_IDTRKVALID', True)
104  log.info("---------- Configured DAOD_IDTRKVALID output")
105 
106  if hasattr(runArgs, 'outputDAOD_SCTVALIDFile'):
107  flagString = 'Output.DAOD_SCTVALIDFileName'
108  flags.addFlag(flagString, runArgs.outputDAOD_SCTVALIDFile)
109  flags.Output.doWriteDAOD = True
110  flags.addFlag('Output.doWriteDAOD_SCTVALID', True)
111  log.info("---------- Configured DAOD_SCTVALID output")
112 
113  if hasattr(runArgs, 'outputDESDM_MCPFile'):
114  flagString = 'Output.DESDM_MCPFileName'
115  flags.addFlag(flagString, runArgs.outputDESDM_MCPFile)
116  flags.Output.doWriteDAOD = True
117  flags.addFlag('Output.doWriteDESDM_MCP', True)
118  log.info("---------- Configured DESDM_MCP output")
119 
120  if hasattr(runArgs, 'outputDESDM_EXOTHIPFile'):
121  flagString = 'Output.DESDM_EXOTHIPFileName'
122  flags.addFlag(flagString, runArgs.outputDESDM_EXOTHIPFile)
123  flags.Output.doWriteDAOD = True
124  flags.addFlag('Output.doWriteDESDM_EXOTHIP', True)
125  log.info("---------- Configured DESDM_EXOTHIP output")
126 
127  if hasattr(runArgs, 'outputDRAW_ZMUMUFile'):
128  flagString = 'Output.DRAW_ZmumuFileName'
129  flags.addFlag(flagString, runArgs.outputDRAW_ZMUMUFile)
130  flags.Output.doWriteBS = True
131  log.info("---------- Configured DRAW ZMUMU output")
132 
133  if hasattr(runArgs, 'outputDRAW_EGZFile'):
134  flagString = 'Output.DRAW_EGZFileName'
135  flags.addFlag(flagString, runArgs.outputDRAW_EGZFile)
136  flags.Output.doWriteBS = True
137  log.info("---------- Configured DRAW_EGZ output")
138 
139  if hasattr(runArgs, 'outputDRAW_TAULHFile'):
140  flagString = 'Output.DRAW_TAULHFileName'
141  flags.addFlag(flagString, runArgs.outputDRAW_TAULHFile)
142  flags.Output.doWriteBS = True
143  log.info("---------- Configured DRAW_TAULH output")
144 
145  if hasattr(runArgs, 'outputDRAW_JETFile'):
146  flagString = 'Output.DRAW_JETFileName'
147  flags.addFlag(flagString, runArgs.outputDRAW_JETFile)
148  flags.Output.doWriteBS = True
149  log.info("---------- Configured DRAW_JET output")
150 
151  if hasattr(runArgs, 'outputDAOD_L1CALO1File'):
152  flagString = 'Output.DAOD_L1CALO1FileName'
153  flags.addFlag(flagString, runArgs.outputDAOD_L1CALO1File)
154  flags.Output.doWriteDAOD = True
155  flags.addFlag('Output.doWriteDAOD_L1CALO1', True)
156  log.info("---------- Configured DAOD_L1CALO1 output")
157 
158  if hasattr(runArgs, 'outputDAOD_L1CALO2File'):
159  flagString = 'Output.DAOD_L1CALO2FileName'
160  flags.addFlag(flagString, runArgs.outputDAOD_L1CALO2File)
161  flags.Output.doWriteDAOD = True
162  flags.addFlag('Output.doWriteDAOD_L1CALO2', True)
163  log.info("---------- Configured DAOD_L1CALO2 output")
164 
165  if hasattr(runArgs, 'outputDESDM_PHOJETFile'):
166  flagString = 'Output.DESDM_PHOJETFileName'
167  flags.addFlag(flagString, runArgs.outputDESDM_PHOJETFile)
168  flags.Output.doWriteDAOD = True
169  flags.addFlag('Output.doWriteDESDM_PHOJET', True)
170  log.info("---------- Configured DESDM_PHOJET output")
171 
172  if hasattr(runArgs, 'outputDESDM_ALLCELLSFile'):
173  streamName = 'DESDM_ALLCELLS'
174  flags.addFlag(f'Output.{streamName}FileName', runArgs.outputDESDM_ALLCELLSFile)
175  flags.addFlag(f'Output.doWrite{streamName}', True)
176  log.info("---------- Configured "+streamName+" output")
177 
178  # Reconstruction flags should be parsed after inputs are set
179  from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags
180  recoRunArgsToFlags(runArgs, flags)
181 
182  from AthenaConfiguration.Enums import ProductionStep
183  flags.Common.ProductionStep=ProductionStep.Reconstruction
184 
185  # Setup detector flags
186  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
187  setupDetectorFlags(flags, detectors, use_metadata=True, toggle_geometry=True, keep_beampipe=True)
188  # Print reco domain status
189  from RecJobTransforms.RecoConfigFlags import printRecoFlags
190  printRecoFlags(flags)
191 
192  # TODO: DESD, DAOD and DRAW
193 
194  # outputHIST_R2AFile
195  # outputTAG_COMMFile
196  # outputTXT_FTKIPFile
197  # outputNTUP_MUONCALIBFile
198  # outputTXT_JIVEXMLTGZFile
199 
200  # Setup perfmon flags from runargs
201  from PerfMonComps.PerfMonConfigHelpers import setPerfmonFlagsFromRunArgs
202  setPerfmonFlagsFromRunArgs(flags, runArgs)
203 
204  # Pre-include
205  processPreInclude(runArgs, flags)
206 
207  # Pre-exec
208  processPreExec(runArgs, flags)
209 
210  # To respect --athenaopts
211  flags.fillFromArgs()
212 
213  # Disable event timeout if debugging has been requested.
214  if flags.Exec.DebugStage != '':
215  flags.Exec.EventTimeOut = 0
216 
217  # Lock flags
218  flags.lock()
219 
220  # Main reconstruction steering
221  from RecJobTransforms.RecoSteering import RecoSteering
222  cfg = RecoSteering(flags)
223 
224  # Performance DPDs
225  cfg.flagPerfmonDomain('PerfDPD')
226  # IDTIDE
227  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_IDTIDEFileName" in key)]:
228  from DerivationFrameworkInDet.IDTIDE import IDTIDECfg
229  cfg.merge(IDTIDECfg(flags))
230  log.info("---------- Configured IDTIDE perfDPD")
231 
232  # PixelVALID
233  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_PIXELVALIDFileName" in key)]:
234  from DerivationFrameworkInDet.PIXELVALID import PixelVALIDCfg
235  cfg.merge(PixelVALIDCfg(flags))
236  log.info("---------- Configured PixelVALID perfDPD")
237 
238  # SCTVALID
239  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_SCTVALIDFileName" in key)]:
240  from InDetPrepRawDataToxAOD.SCTVALID import SCTVALIDCfg
241  cfg.merge(SCTVALIDCfg(flags))
242  log.info("---------- Configured SCTVALID perfDPD")
243 
244  # IDTRKVALID
245  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_IDTRKVALIDFileName" in key)]:
246  from DerivationFrameworkInDet.IDTRKVALID import IDTRKVALIDCfg
247  cfg.merge(IDTRKVALIDCfg(flags))
248  log.info("---------- Configured IDTRKVALID perfDPD")
249 
250  # DESDM_MCP
251  for flag in [key for key in flags._flagdict.keys() if ("Output.DESDM_MCPFileName" in key)]:
252  from PrimaryDPDMaker.DESDM_MCP import DESDM_MCPCfg
253  cfg.merge(DESDM_MCPCfg(flags))
254  log.info("---------- Configured DESDM_MCP perfDPD")
255 
256  # DESDM_EXOTHIP
257  for flag in [key for key in flags._flagdict.keys() if ("Output.DESDM_EXOTHIPFileName" in key)]:
258  from PrimaryDPDMaker.DESDM_EXOTHIP import DESDM_EXOTHIPCfg
259  cfg.merge(DESDM_EXOTHIPCfg(flags))
260  log.info("---------- Configured DESDM_EXOTHIP perfDPD")
261 
262  # DRAW ZMUMU
263  for flag in [key for key in flags._flagdict.keys() if ("Output.DRAW_ZmumuFileName" in key)]:
264  from PrimaryDPDMaker.DRAW_ZMUMU import DRAW_ZmumuCfg
265  cfg.merge(DRAW_ZmumuCfg(flags))
266  log.info("---------- Configured DRAW_ZMUMU perfDPD")
267 
268  #DRAW_EGZ
269  for flag in [key for key in flags._flagdict.keys() if ("Output.DRAW_EGZFileName" in key)]:
270  from PrimaryDPDMaker.DRAW_EGZ import DRAW_EGZCfg
271  cfg.merge(DRAW_EGZCfg(flags))
272  log.info("---------- Configured DRAW_EGZ perfDPD")
273 
274  #DRAW_TAULH
275  for flag in [key for key in flags._flagdict.keys() if ("Output.DRAW_TAULHFileName" in key)]:
276  from PrimaryDPDMaker.DRAW_TAULH import DRAW_TAULHCfg
277  cfg.merge(DRAW_TAULHCfg(flags))
278  log.info("---------- Configured DRAW_TAULH perfDPD")
279 
280  #DRAW_JET
281  for flag in [key for key in flags._flagdict.keys() if ("Output.DRAW_JETFileName" in key)]:
282  from PrimaryDPDMaker.DRAW_JET import DRAW_JETCfg
283  cfg.merge(DRAW_JETCfg(flags))
284  log.info("---------- Configured DRAW_JET perfDPD")
285 
286  # L1CALO1/2
287  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_L1CALO1FileName" in key)]:
288  from DerivationFrameworkL1Calo.L1CALO1 import L1CALO1Cfg
289  cfg.merge(L1CALO1Cfg(flags))
290  log.info("---------- Configured L1CALO1 perfDPD")
291 
292  for flag in [key for key in flags._flagdict.keys() if ("Output.DAOD_L1CALO2FileName" in key)]:
293  from DerivationFrameworkL1Calo.L1CALO2 import L1CALO2Cfg
294  cfg.merge(L1CALO2Cfg(flags))
295  log.info("---------- Configured L1CALO2 perfDPD")
296 
297  # DESDM PHOJET
298  for flag in [key for key in flags._flagdict.keys() if ("Output.DESDM_PHOJETFileName" in key)]:
299  from PrimaryDPDMaker.DESDM_PHOJET import DESDM_PHOJETCfg
300  cfg.merge(DESDM_PHOJETCfg(flags))
301  log.info("---------- Configured PHOJET perfDPD")
302 
303  # DESDM ALLCELLS
304  for flag in [key for key in flags._flagdict.keys() if ("Output.DESDM_ALLCELLSFileName" in key)]:
305  from PrimaryDPDMaker.DESDM_ALLCELLS import DESDM_ALLCELLSCfg
306  cfg.merge(DESDM_ALLCELLSCfg(flags))
307  log.info("---------- Configured ALLCELLS perfDPD")
308 
309  # Special message service configuration
310  from DigitizationConfig.DigitizationSteering import DigitizationMessageSvcCfg
311  cfg.merge(DigitizationMessageSvcCfg(flags))
312 
313  # Post-include
314  processPostInclude(runArgs, flags, cfg)
315 
316  # Post-exec
317  processPostExec(runArgs, flags, cfg)
318 
319  from AthenaConfiguration.Utils import setupLoggingLevels
320  setupLoggingLevels(flags, cfg)
321 
322  # Write some metadata into TagInfo
323  from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
324  cfg.merge(
326  flags,
327  tagValuePairs={
328  "beam_type": flags.Beam.Type.value,
329  "beam_energy": str(int(flags.Beam.Energy)),
330  "triggerStreamOfFile": ""
331  if flags.Input.isMC
332  else flags.Input.TriggerStream,
333  "project_name": "IS_SIMULATION"
334  if flags.Input.isMC
335  else flags.Input.ProjectName,
336  f"AtlasRelease_{runArgs.trfSubstepName}": flags.Input.Release or "n/a",
337  },
338  )
339  )
340  if not flags.Input.isMC and flags.Input.DataYear > 0:
341  cfg.merge(TagInfoMgrCfg(flags, tagValuePairs={
342  "data_year": str(flags.Input.DataYear)
343  }))
344 
345  # Write AMI tag into in-file metadata
346  from PyUtils.AMITagHelperConfig import AMITagCfg
347  cfg.merge(AMITagCfg(flags, runArgs))
348 
349  # Print PerfMon domain information when running detailed monitoring
350  if flags.PerfMon.doFullMonMT:
351  cfg.printPerfmonDomains()
352 
353  timeConfig = time.time()
354  log.info("configured in %d seconds", timeConfig - timeStart)
355 
356  log.info("Configured according to flag values listed below")
357  flags.dump()
358 
359  # Print sum information about AccumulatorCache performance
360  from AthenaConfiguration.AccumulatorCache import AccumulatorDecorator
361  AccumulatorDecorator.printStats()
362 
363  # Run the final accumulator
364  sc = cfg.run()
365  timeFinal = time.time()
366  log.info("Run RAWtoALL_skeleton in %d seconds (running %d seconds)", timeFinal - timeStart, timeFinal - timeConfig)
367 
368  import sys
369  sys.exit(not sc.isSuccess())
python.RAWtoALL_Skeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: RAWtoALL_Skeleton.py:14
python.RecoSteering.RecoSteering
def RecoSteering(flags)
Definition: RecoSteering.py:6
python.DESDM_PHOJET.DESDM_PHOJETCfg
def DESDM_PHOJETCfg(configFlags)
Definition: DESDM_PHOJET.py:40
python.TransformUtils.processPreExec
def processPreExec(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:41
vtune_athena.format
format
Definition: vtune_athena.py:14
python.TransformUtils.processPostExec
def processPostExec(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:50
python.DESDM_MCP.DESDM_MCPCfg
def DESDM_MCPCfg(flags)
Definition: DESDM_MCP.py:357
python.DESDM_ALLCELLS.DESDM_ALLCELLSCfg
def DESDM_ALLCELLSCfg(configFlags)
Definition: DESDM_ALLCELLS.py:27
L1CALO1.L1CALO1Cfg
def L1CALO1Cfg(flags)
Definition: L1CALO1.py:14
python.RecoConfigFlags.printRecoFlags
def printRecoFlags(flags)
Definition: RecoConfigFlags.py:155
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.RecoConfigFlags.recoRunArgsToFlags
def recoRunArgsToFlags(runArgs, flags)
Definition: RecoConfigFlags.py:198
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.TagInfoMgrConfig.TagInfoMgrCfg
def TagInfoMgrCfg(flags, tagValuePairs={})
Definition: TagInfoMgrConfig.py:6
python.DigitizationSteering.DigitizationMessageSvcCfg
def DigitizationMessageSvcCfg(flags)
Definition: DigitizationSteering.py:217
python.DRAW_TAULH.DRAW_TAULHCfg
def DRAW_TAULHCfg(flags)
Definition: DRAW_TAULH.py:121
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:50
python.SCTVALID.SCTVALIDCfg
def SCTVALIDCfg(flags)
Definition: SCTVALID.py:198
python.PerfMonConfigHelpers.setPerfmonFlagsFromRunArgs
def setPerfmonFlagsFromRunArgs(flags, runArgs)
Definition: PerfMonConfigHelpers.py:3
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
python.Helpers.ROOT6Setup
def ROOT6Setup(batch=False)
Definition: Tools/PyUtils/python/Helpers.py:19
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
python.PIXELVALID.PixelVALIDCfg
def PixelVALIDCfg(flags)
Definition: PIXELVALID.py:204
beamspotman.dir
string dir
Definition: beamspotman.py:623
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:291
python.DRAW_JET.DRAW_JETCfg
def DRAW_JETCfg(flags)
Definition: DRAW_JET.py:64
python.AMITagHelperConfig.AMITagCfg
def AMITagCfg(flags, runArgs=None, fixBroken=False)
Definition: AMITagHelperConfig.py:77
python.DRAW_EGZ.DRAW_EGZCfg
def DRAW_EGZCfg(flags)
Definition: DRAW_EGZ.py:94
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.DESDM_EXOTHIP.DESDM_EXOTHIPCfg
def DESDM_EXOTHIPCfg(flags)
Definition: DESDM_EXOTHIP.py:52
python.IDTRKVALID.IDTRKVALIDCfg
def IDTRKVALIDCfg(flags)
Definition: IDTRKVALID.py:228
str
Definition: BTagTrackIpAccessor.cxx:11
python.IDTIDE.IDTIDECfg
def IDTIDECfg(flags)
Definition: IDTIDE.py:318
L1CALO2.L1CALO2Cfg
def L1CALO2Cfg(flags)
Definition: L1CALO2.py:14
python.DRAW_ZMUMU.DRAW_ZmumuCfg
def DRAW_ZmumuCfg(flags)
Definition: DRAW_ZMUMU.py:85