ATLAS Offline Software
EventBookkeeperToolsConfig.py
Go to the documentation of this file.
1 """Define functions for event bookkeeping configuration using ComponentAccumulator
2 
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
8 
9 
10 def BookkeeperToolCfg(flags, name='BookkeeperTool', output_name='CutBookkeepers'):
11  """BookkeeperTool config"""
12  tool = CompFactory.BookkeeperTool(name,
13  InputCollName = output_name,
14  OutputCollName = output_name)
15  acc = MetaDataSvcCfg(flags, tools=[tool])
16  acc.addPublicTool(tool)
17  return acc
18 
19 
21  """BookkeeperDumperTool configuration"""
22  return MetaDataSvcCfg(flags, toolNames=['BookkeeperDumperTool'])
23 
24 
25 def CutFlowSvcCfg(flags, **kwargs):
26  """CutFlowSvc configuration"""
27  acc = BookkeeperToolCfg(flags)
28 
29  kwargs.setdefault('Configured', True)
30  # Determine current input stream name
31  kwargs.setdefault('InputStream', flags.Input.ProcessingTags[-1] if flags.Input.ProcessingTags else 'N/A')
32  # Configure skimming cycle
33  from AthenaConfiguration.AutoConfigFlags import GetFileMD
34  kwargs.setdefault('SkimmingCycle', GetFileMD(flags.Input.Files).get('currentCutCycle', -1) + 1)
35 
36  # Init the service
37  acc.addService(CompFactory.CutFlowSvc(**kwargs))
38 
39  # TODO: different sequence?
40  acc.addEventAlgo(CompFactory.AllExecutedEventsCounterAlg())
41 
42  return acc
43 
44 
46  """AllWrittenEventsCounterAlg configuration"""
47  acc = ComponentAccumulator(CompFactory.AthSequencer("AthOutSeq", StopOverride=True))
48  acc.addEventAlgo(CompFactory.AllWrittenEventsCounterAlg())
49  return acc
50 
51 
52 def CutFlowOutputList(flags, output_name='CutBookkeepers'):
53  """CutFlow output metadata list"""
54  return [
55  'xAOD::CutBookkeeperContainer#' + output_name + '*',
56  'xAOD::CutBookkeeperAuxContainer#' + output_name + '*Aux.*',
57  'xAOD::CutBookkeeperContainer#Incomplete' + output_name + '*',
58  'xAOD::CutBookkeeperAuxContainer#Incomplete' + output_name + '*Aux.*'
59  ]
python.AutoConfigFlags.GetFileMD
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
Definition: AutoConfigFlags.py:65
python.EventBookkeeperToolsConfig.AllWrittenEventsCounterAlgCfg
def AllWrittenEventsCounterAlgCfg(flags)
Definition: EventBookkeeperToolsConfig.py:45
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.EventBookkeeperToolsConfig.BookkeeperToolCfg
def BookkeeperToolCfg(flags, name='BookkeeperTool', output_name='CutBookkeepers')
Definition: EventBookkeeperToolsConfig.py:10
python.EventBookkeeperToolsConfig.CutFlowOutputList
def CutFlowOutputList(flags, output_name='CutBookkeepers')
Definition: EventBookkeeperToolsConfig.py:52
python.EventBookkeeperToolsConfig.BookkeeperDumperToolCfg
def BookkeeperDumperToolCfg(flags)
Definition: EventBookkeeperToolsConfig.py:20
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.EventBookkeeperToolsConfig.CutFlowSvcCfg
def CutFlowSvcCfg(flags, **kwargs)
Definition: EventBookkeeperToolsConfig.py:25