ATLAS Offline Software
AODtoHIST_Skeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 import sys
4 
5 from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
6 
7 # force no legacy job properties
8 from AthenaCommon import JobProperties
9 JobProperties.jobPropertiesDisallowed = True
10 
11 
12 def fromRunArgs(runArgs):
13 
14  from AthenaCommon.Logging import logging
15  log = logging.getLogger('AODtoHIST')
16  log.info('****************** STARTING AOD->HIST MAKING *****************')
17 
18  log.info('**** Transformation run arguments')
19  log.info(str(runArgs))
20 
21  import time
22  timeStart = time.time()
23 
24  # some basic settings here...
25  from AthenaConfiguration.AllConfigFlags import initConfigFlags
26  flags = initConfigFlags()
27  from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
28  commonRunArgsToFlags(runArgs, flags)
29  from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags
30  recoRunArgsToFlags(runArgs, flags)
31 
32  # Input
33  if hasattr(runArgs, 'inputAODFile'):
34  flags.Input.Files = runArgs.inputAODFile
35 
36  # Output
37  if hasattr(runArgs, 'outputHIST_AODFile'):
38  flags.Output.HISTFileName = runArgs.outputHIST_AODFile
39  log.info("---------- Configured HIST_AOD output")
40  if hasattr(runArgs, 'outputHISTFile'):
41  flags.Output.HISTFileName = runArgs.outputHISTFile
42  log.info("---------- Configured HIST output")
43 
44 
45 
46  # Autoconfigure enabled subdetectors
47  if hasattr(runArgs, 'detectors'):
48  detectors = runArgs.detectors
49  else:
50  detectors = None
51  # Setup detector flags
52  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
53  setupDetectorFlags(flags, detectors, use_metadata=True, toggle_geometry=True, keep_beampipe=True)
54 
55  processPreInclude(runArgs, flags)
56  processPreExec(runArgs, flags)
57 
58  # To respect --athenaopts
59  flags.fillFromArgs()
60  flags.lock()
61 
62  # Main DQ steering
63  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
64  cfg = MainServicesCfg(flags)
65  # setup input
66  cfg.flagPerfmonDomain('IO')
67  from AthenaConfiguration.Enums import Format
68  if flags.Input.Format is Format.BS:
69  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
70  cfg.merge(ByteStreamReadCfg(flags))
71  log.info("---------- Configured BS reading")
72  else:
73  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
74  cfg.merge(PoolReadCfg(flags))
75  # Check if running on legacy inputs
76  if "EventInfo" not in flags.Input.Collections:
77  from xAODEventInfoCnv.xAODEventInfoCnvConfig import (
78  EventInfoCnvAlgCfg)
79  cfg.merge(EventInfoCnvAlgCfg(flags))
80  log.info("---------- Configured POOL reading")
81 
82  from AthenaMonitoring.AthenaMonitoringCfg import AthenaMonitoringCfg, AthenaMonitoringPostprocessingCfg
83  cfg.merge(AthenaMonitoringCfg(flags))
84  cfg.merge(AthenaMonitoringPostprocessingCfg(flags))
85 
86  processPostInclude(runArgs, flags, cfg)
87  processPostExec(runArgs, flags, cfg)
88 
89  # Run the final accumulator
90  sc = cfg.run()
91  timeFinal = time.time()
92  log.info("Run AODtoHIST_Skeleton in %d seconds", timeFinal - timeStart)
93 
94  sys.exit(not sc.isSuccess())
python.TransformUtils.processPreExec
def processPreExec(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:41
python.TransformUtils.processPostExec
def processPostExec(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:50
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:196
python.AODtoHIST_Skeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: AODtoHIST_Skeleton.py:12
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.AthenaMonitoringCfg.AthenaMonitoringCfg
def AthenaMonitoringCfg(flags)
Definition: AthenaMonitoringCfg.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:286
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.AthenaMonitoringCfg.AthenaMonitoringPostprocessingCfg
def AthenaMonitoringPostprocessingCfg(flags)
Definition: AthenaMonitoringCfg.py:164