ATLAS Offline Software
RDOMerge_Skeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 import sys
4 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
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  from AthenaCommon.Logging import logging
14  log = logging.getLogger('RDOMerge_tf')
15  log.info('****************** STARTING RDO MERGING *****************')
16 
17  log.info('**** Transformation run arguments')
18  log.info(str(runArgs))
19 
20  log.info('**** Setting-up configuration flags')
21  from AthenaConfiguration.AllConfigFlags import initConfigFlags
22  flags = initConfigFlags()
23 
24  commonRunArgsToFlags(runArgs, flags)
25 
26  if hasattr(runArgs, "PileUpPresampling"):
27  from AthenaConfiguration.Enums import ProductionStep
28  flags.Common.ProductionStep = ProductionStep.PileUpPresampling
29 
30  if hasattr(runArgs, 'inputRDOFile'):
31  flags.Input.Files = runArgs.inputRDOFile
32  else:
33  raise RuntimeError('No input RDO file defined')
34 
35  if hasattr(runArgs, 'outputRDO_MRGFile'):
36  if runArgs.outputRDO_MRGFile == 'None':
37  flags.Output.RDOFileName = ''
38  # TODO decide if we need a specific RDO_MRGFileName flag
39  else:
40  flags.Output.RDOFileName = runArgs.outputRDO_MRGFile
41  else:
42  raise RuntimeError('No outputRDO_MRGFile defined')
43 
44  # Autoconfigure enabled subdetectors
45  if hasattr(runArgs, 'detectors'):
46  detectors = runArgs.detectors
47  else:
48  detectors = None
49 
50  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
51  setupDetectorFlags(flags, detectors, use_metadata=True, toggle_geometry=True)
52 
53  # Pre-include
54  processPreInclude(runArgs, flags)
55 
56  # Pre-exec
57  processPreExec(runArgs, flags)
58 
59  # To respect --athenaopts
60  flags.fillFromArgs()
61 
62  # Lock flags
63  flags.lock()
64 
65  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
66  cfg = MainServicesCfg(flags)
67 
68  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
69  cfg.merge(PoolReadCfg(flags))
70 
71  # Geometry dependencies
72  if flags.Detector.EnablePixel:
73  from PixelGeoModel.PixelGeoModelConfig import PixelReadoutGeometryCfg
74  cfg.merge(PixelReadoutGeometryCfg(flags))
75  if flags.Detector.EnableSCT:
76  from SCT_GeoModel.SCT_GeoModelConfig import SCT_ReadoutGeometryCfg
77  cfg.merge(SCT_ReadoutGeometryCfg(flags))
78  if flags.Detector.EnableTRT:
79  from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
80  cfg.merge(TRT_ReadoutGeometryCfg(flags))
81 
82  if flags.Detector.EnableITkPixel:
83  from PixelGeoModelXml.ITkPixelGeoModelConfig import ITkPixelReadoutGeometryCfg
84  cfg.merge(ITkPixelReadoutGeometryCfg(flags))
85  if flags.Detector.EnableITkStrip:
86  from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg
87  cfg.merge(ITkStripReadoutGeometryCfg(flags))
88 
89  if flags.Detector.EnableHGTD:
90  if flags.HGTD.Geometry.useGeoModelXml:
91  from HGTD_GeoModelXml.HGTD_GeoModelConfig import HGTD_ReadoutGeometryCfg
92  else:
93  from HGTD_GeoModel.HGTD_GeoModelConfig import HGTD_ReadoutGeometryCfg
94  cfg.merge(HGTD_ReadoutGeometryCfg(flags))
95 
96  if flags.Detector.EnableLAr:
97  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
98  cfg.merge(LArGMCfg(flags))
99  if flags.Detector.EnableTile:
100  from TileGeoModel.TileGMConfig import TileGMCfg
101  cfg.merge(TileGMCfg(flags))
102  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
103  cfg.merge(TileCablingSvcCfg(flags))
104 
105  if flags.Detector.EnableMuon:
106  from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
107  cfg.merge(MuonGeoModelCfg(flags))
108 
109  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
110  cfg.merge(OutputStreamCfg(flags, 'RDO', takeItemsFromInput = True, extendProvenanceRecord = False))
111 
112  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
113  cfg.merge(SetupMetaDataForStreamCfg(flags, 'RDO'))
114 
115  # Silence HepMcParticleLink warnings
116  from DigitizationConfig.DigitizationSteering import DigitizationMessageSvcCfg
117  cfg.merge(DigitizationMessageSvcCfg(flags))
118 
119  # Post-include
120  processPostInclude(runArgs, flags, cfg)
121 
122  # Post-exec
123  processPostExec(runArgs, flags, cfg)
124 
125  # Write AMI tag into in-file metadata
126  from PyUtils.AMITagHelperConfig import AMITagCfg
127  cfg.merge(AMITagCfg(flags, runArgs))
128 
129  import time
130  tic = time.time()
131  # Run the final accumulator
132  sc = cfg.run()
133  log.info("Ran RDOMerge_tf in " + str(time.time()-tic) + " seconds")
134 
135  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.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:55
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.RDOMerge_Skeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: RDOMerge_Skeleton.py:12
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.DigitizationSteering.DigitizationMessageSvcCfg
def DigitizationMessageSvcCfg(flags)
Definition: DigitizationSteering.py:217
SCT_GeoModelConfig.SCT_ReadoutGeometryCfg
def SCT_ReadoutGeometryCfg(flags)
Definition: SCT_GeoModelConfig.py:42
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
HGTD_GeoModelConfig.HGTD_ReadoutGeometryCfg
def HGTD_ReadoutGeometryCfg(flags)
Definition: python/HGTD_GeoModelConfig.py:23
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
PixelGeoModelConfig.PixelReadoutGeometryCfg
def PixelReadoutGeometryCfg(flags)
Definition: PixelGeoModelConfig.py:42
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
ITkPixelGeoModelConfig.ITkPixelReadoutGeometryCfg
def ITkPixelReadoutGeometryCfg(flags, setGeometryAlignable=False, setAlignmentFolderName="/Indet/Align")
Definition: ITkPixelGeoModelConfig.py:39
python.AMITagHelperConfig.AMITagCfg
def AMITagCfg(flags, runArgs=None, fixBroken=False)
Definition: AMITagHelperConfig.py:77
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
ITkStripGeoModelConfig.ITkStripReadoutGeometryCfg
def ITkStripReadoutGeometryCfg(flags, setGeometryAlignable=False, setAlignmentFolderName="/Indet/Align")
Definition: ITkStripGeoModelConfig.py:39
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:219
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7