5 """ This is the main skeleton for merging POOL files generically.
6 Currently it handles (D)AOD/(D)ESD files, but can be extended in the future.
7 That'll mostly entail configuring extra components needed for TP conversion (if any).
11 from AthenaCommon.Logging
import logging
12 log = logging.getLogger(
'MergePool_Skeleton')
13 log.info(
'****************** STARTING MergePool MERGING *****************')
16 log.info(
'**** Transformation run arguments')
17 log.info(
str(runArgs))
20 log.info(
'**** Setting up configuration flags')
22 from PyJobTransforms.CommonRunArgsToFlags
import commonRunArgsToFlags
23 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
25 flags.Exec.EventPrintoutInterval = 100
29 inputFile, outputFile =
None,
None
31 for attr
in dir(runArgs):
32 if attr.startswith(
'input')
and attr.endswith(
'File'):
33 inputFile = getattr(runArgs, attr)
34 elif attr.startswith(
'output')
and attr.endswith(
'File'):
35 outputFile = getattr(runArgs, attr)
37 if not inputFile
or not outputFile:
38 raise RuntimeError(
'Could NOT determine the input/output files!')
41 flags.Input.Files = inputFile
44 streamToMerge = flags.Input.ProcessingTags[0].removeprefix(
'Stream')
if flags.Input.ProcessingTags
else None
47 raise RuntimeError(
'Could NOT determine the stream type!')
53 setattr(flags.Output, f
'{streamToMerge}FileName', outputFile)
55 flags.addFlag(f
'Output.{streamToMerge}FileName', outputFile)
56 flags.addFlag(f
'Output.doWrite{streamToMerge}',
True)
57 if 'DAOD' in streamToMerge:
58 flags.Output.doWriteDAOD =
True
61 from PerfMonComps.PerfMonConfigHelpers
import setPerfmonFlagsFromRunArgs
65 from PyJobTransforms.TransformUtils
import processPreExec, processPreInclude, processPostExec, processPostInclude
66 log.info(
'**** Processing preInclude')
70 log.info(
'**** Processing preExec')
74 log.info(
'**** Processing athenaopts')
78 log.info(
'**** Locking configuration flags')
82 log.info(
'**** Setting up job components')
85 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
89 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
95 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
96 cfg.merge(
OutputStreamCfg(flags, streamToMerge, takeItemsFromInput =
True, extendProvenanceRecord =
False))
98 Stream.ForceRead =
True
100 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
101 from AthenaConfiguration.Enums
import MetadataCategory
108 MetadataCategory.IOVMetaData,
113 log.info(f
'**** Configured {streamToMerge} writing')
116 for item
in flags.Input.TypedCollections:
117 ctype, cname = item.split(
'#')
118 if ctype.startswith(
'Trk')
or ctype.startswith(
'InDet'):
119 from TrkEventCnvTools.TrkEventCnvToolsConfig
import TrkEventCnvSuperToolCfg
121 if ctype.startswith(
'Calo')
or ctype.startswith(
'LAr'):
122 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
124 if ctype.startswith(
'Calo')
or ctype.startswith(
'Tile'):
125 from TileGeoModel.TileGMConfig
import TileGMCfg
127 if ctype.startswith(
'Muon'):
128 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
132 if flags.PerfMon.doFastMonMT
or flags.PerfMon.doFullMonMT:
133 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
137 log.info(
'**** Processing postInclude')
141 log.info(
'**** Processing postExec')
147 sys.exit(
not sc.isSuccess())