diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py index 48fb48844a4a5adb407a955d06af07b9c6031953..afeaf2a1964816dbbfc94dde9d8129260f9365f0 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py @@ -932,7 +932,7 @@ if globalflags.InputFormat()=='bytestream': MetaDataStore=svcMgr.MetaDataStore -#Lumiblocks and EventBookkeepers +# Lumiblocks and ByteStreamMetadata if rec.doFileMetaData(): #lumiblocks @@ -958,25 +958,6 @@ if rec.doFileMetaData(): include ("LumiBlockComps/CreateLumiBlockFromFile_jobOptions.py") pass - # Add the needed stuff for cut-flow bookkeeping. - # Only the configurables that are not already present will be created - hasBookkeepers = False - if 'metadata_items' in metadata: - metadata_items = metadata['metadata_items'] - if 'xAOD::CutBookkeeperContainer_v1' in set(metadata_items.values()): - logRecExCommon_topOptions.debug("Existing CutBookkeeperContainer found") - hasBookkeepers = True - if hasBookkeepers or ('runArgs' in dir() and hasattr(runArgs, "reductionConf")): # TODO: no other way to detect we are running derivations - # TODO: check all DAOD workflows - from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc - logRecExCommon_topOptions.debug("Going to call CreateCutFlowSvc") - CreateCutFlowSvc( svcName="CutFlowSvc", seq=topSequence, addMetaDataToAllOutputFiles=True ) - if rec.readAOD() or rec.readESD(): - #force CutFlowSvc execution (necessary for file merging) - theApp.CreateSvc+=['CutFlowSvc'] - logRecExCommon_topOptions.debug("Added CutFlowSvc to theApp") - pass - try: # ByteStreamMetadata from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamMetadataTool @@ -984,8 +965,6 @@ if rec.doFileMetaData(): svcMgr.MetaDataSvc.MetaDataTools += [ "ByteStreamMetadataTool" ] except Exception: treatException("Could not load ByteStreamMetadataTool") - - pass @@ -1339,6 +1318,29 @@ if ( rec.doAOD() or rec.doWriteAOD()) and not rec.readAOD() : pdr.flag_domain('aod') +# EventBookkeepers +if rec.doFileMetaData() or rec.OutputFileNameForRecoStep() == 'EVNTtoDAOD': + # Add the needed stuff for cut-flow bookkeeping. + # Only the configurables that are not already present will be created + hasBookkeepers = False + if 'metadata_items' in metadata: + metadata_items = metadata['metadata_items'] + if 'xAOD::CutBookkeeperContainer_v1' in set(metadata_items.values()): + logRecExCommon_topOptions.debug("Existing CutBookkeeperContainer found") + hasBookkeepers = True + if hasBookkeepers or rec.OutputFileNameForRecoStep() in ['EVNTtoDAOD', 'AODtoDAOD']: + from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc + logRecExCommon_topOptions.debug("Going to call CreateCutFlowSvc") + CreateCutFlowSvc( svcName="CutFlowSvc", seq=topSequence, addMetaDataToAllOutputFiles=True ) + if rec.readAOD() or rec.readESD(): + #force CutFlowSvc execution (necessary for file merging) + theApp.CreateSvc+=['CutFlowSvc'] + logRecExCommon_topOptions.debug("Added CutFlowSvc to theApp") + pass + pass + pass + + if rec.doWriteAOD(): from ParticleBuilderOptions.AODFlags import AODFlags # Particle Builders