ATLAS Offline Software
AthenaPoolExampleConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 
5 # additional read catalogs are optional
6 def AthenaPoolExampleReadCfg(flags, readCatalogs = [] ):
7  """Basic services configuration for AthenaPoolExamples that read imput"""
9 
10  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
11  acc.merge( PoolReadCfg( flags ) )
12  acc.getService("PoolSvc").ReadCatalog += readCatalogs
13 
14  # ---------------- Configure basic metadata
15  from xAODMetaDataCnv.InfileMetaDataConfig import createEventStreamInfo, propagateMetaData, MetaDataHelperLists
16  from AthenaConfiguration.Enums import MetadataCategory
17  mdLists = MetaDataHelperLists()
18 
19  lists, caConfig = propagateMetaData( flags, "", MetadataCategory.FileMetaData )
20  mdLists += lists
21  acc.merge(caConfig)
22 
23  mdLists.mdItems += ["IOVMetaDataContainer#*"]
24 
25  esiList, _ = createEventStreamInfo(flags)
26  mdLists += esiList
27 
28  # Configure the MetaDataSvc and pass the relevant tools
29  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
30  acc.merge( MetaDataSvcCfg( flags, tools = mdLists.mdTools, toolNames = mdLists.mdToolNames ) )
31 
32  from AthenaConfiguration.MainServicesConfig import MessageSvcCfg
33  acc.merge( MessageSvcCfg( flags ) )
34  from AthenaConfiguration.Utils import setupLoggingLevels
35  setupLoggingLevels( flags, acc )
36 
37  return acc
38 
39 
40 def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog = None, disableEventTag = True ):
41  """Basic services configuration for AthenaPoolExamples that write output"""
42  acc = ComponentAccumulator()
43  if not flags.Input.Files:
44  # inputless examples use McEventSelector
45  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
46  acc.merge( McEventSelectorCfg( flags,
47  RunNumber = 1,
48  EventsPerRun = 0x100999999,
49  FirstEvent = 0x100000001,
50  EventsPerLB = 5,
51  FirstLB = 1,
52  InitialTimeStamp = 0,
53  TimeStampInterval = 5 ) )
54 
55  # Pool writing
56  from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
57  acc.merge( PoolWriteCfg( flags ) )
58  if writeCatalog is not None:
59  # Explicitly specify a non-default catalog name
60  acc.getService("PoolSvc").WriteCatalog = writeCatalog
61 
62  # ---------------- Configure basic metadata
63  from xAODMetaDataCnv.InfileMetaDataConfig import createEventStreamInfo, propagateMetaData, MetaDataHelperLists
64  from AthenaConfiguration.Enums import MetadataCategory
65  mdLists = MetaDataHelperLists()
66 
67  lists, caConfig = propagateMetaData( flags, outputStreamName, MetadataCategory.FileMetaData )
68  mdLists += lists
69  acc.merge(caConfig)
70 
71  mdLists.mdItems += ["IOVMetaDataContainer#*"]
72 
73  esiList, _ = createEventStreamInfo(flags, streamName=outputStreamName)
74  mdLists += esiList
75 
76  # add metadata items and tools to the output stream
77  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
78  acc.merge( OutputStreamCfg( flags, outputStreamName, disableEventTag = disableEventTag,
79  MetadataItemList = mdLists.mdItems,
80  HelperTools = mdLists.helperTools ) )
81 
82  # Configure the MetaDataSvc and pass the relevant tools
83  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
84  acc.merge( MetaDataSvcCfg( flags, tools = mdLists.mdTools, toolNames = mdLists.mdToolNames ) )
85 
86  from AthenaConfiguration.MainServicesConfig import MessageSvcCfg
87  acc.merge( MessageSvcCfg( flags ) )
88  from AthenaConfiguration.Utils import setupLoggingLevels
89  setupLoggingLevels( flags, acc )
90 
91  return acc
92 
93 
94 
95 
96 
97 
98 
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:40
python.PoolWriteConfig.PoolWriteCfg
def PoolWriteCfg(flags)
Definition: PoolWriteConfig.py:41
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
InfileMetaDataConfig.propagateMetaData
def propagateMetaData(flags, streamName="", category=None)
Definition: InfileMetaDataConfig.py:130
python.MainServicesConfig.MessageSvcCfg
def MessageSvcCfg(flags)
Definition: MainServicesConfig.py:161
AthenaPoolExampleConfig.AthenaPoolExampleReadCfg
def AthenaPoolExampleReadCfg(flags, readCatalogs=[])
Definition: AthenaPoolExampleConfig.py:6
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:46
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
InfileMetaDataConfig.createEventStreamInfo
def createEventStreamInfo(tools, result, flags, **kwargs)
Definition: InfileMetaDataConfig.py:115
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69