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 createIOVMetaData, propagateMetaData, MetaDataHelperLists
16  from AthenaConfiguration.Enums import MetadataCategory
17  mdLists = MetaDataHelperLists()
18  for mdCategory in ( MetadataCategory.FileMetaData, MetadataCategory.EventStreamInfo ):
19  lists, caConfig = propagateMetaData( flags, "", mdCategory )
20  mdLists += lists
21  acc.merge(caConfig)
22 
23  iovList, _ = createIOVMetaData(flags)
24  mdLists += iovList
25 
26  # Configure the MetaDataSvc and pass the relevant tools
27  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
28  acc.merge( MetaDataSvcCfg( flags, tools = mdLists.mdTools, toolNames = mdLists.mdToolNames ) )
29 
30  from AthenaConfiguration.MainServicesConfig import MessageSvcCfg
31  acc.merge( MessageSvcCfg( flags ) )
32  from AthenaConfiguration.Utils import setupLoggingLevels
33  setupLoggingLevels( flags, acc )
34 
35  return acc
36 
37 
38 def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog = None, disableEventTag = True ):
39  """Basic services configuration for AthenaPoolExamples that write output"""
40  acc = ComponentAccumulator()
41  if not flags.Input.Files:
42  # inputless examples use McEventSelector
43  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
44  acc.merge( McEventSelectorCfg( flags,
45  RunNumber = 1,
46  EventsPerRun = 0x100999999,
47  FirstEvent = 0x100000001,
48  EventsPerLB = 5,
49  FirstLB = 1,
50  InitialTimeStamp = 0,
51  TimeStampInterval = 5 ) )
52 
53  # Pool writing
54  from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
55  acc.merge( PoolWriteCfg( flags ) )
56  if writeCatalog is not None:
57  # Explicitly specify a non-default catalog name
58  acc.getService("PoolSvc").WriteCatalog = writeCatalog
59 
60  # ---------------- Configure basic metadata
61  from xAODMetaDataCnv.InfileMetaDataConfig import createIOVMetaData, propagateMetaData, MetaDataHelperLists
62  from AthenaConfiguration.Enums import MetadataCategory
63  mdLists = MetaDataHelperLists()
64  for mdCategory in ( MetadataCategory.FileMetaData, MetadataCategory.EventStreamInfo ):
65  lists, caConfig = propagateMetaData( flags, outputStreamName, mdCategory )
66  mdLists += lists
67  acc.merge(caConfig)
68 
69  iovList, _ = createIOVMetaData(flags)
70  mdLists += iovList
71 
72  # add metadata items and tools to the output stream
73  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
74  acc.merge( OutputStreamCfg( flags, outputStreamName, disableEventTag = disableEventTag,
75  MetadataItemList = mdLists.mdItems,
76  HelperTools = mdLists.helperTools ) )
77 
78  # Configure the MetaDataSvc and pass the relevant tools
79  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
80  acc.merge( MetaDataSvcCfg( flags, tools = mdLists.mdTools, toolNames = mdLists.mdToolNames ) )
81 
82  from AthenaConfiguration.MainServicesConfig import MessageSvcCfg
83  acc.merge( MessageSvcCfg( flags ) )
84  from AthenaConfiguration.Utils import setupLoggingLevels
85  setupLoggingLevels( flags, acc )
86 
87  return acc
88 
89 
90 
91 
92 
93 
94 
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:38
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, *args, **kwargs)
Definition: InfileMetaDataConfig.py:112
python.MainServicesConfig.MessageSvcCfg
def MessageSvcCfg(flags)
Definition: MainServicesConfig.py:153
AthenaPoolExampleConfig.AthenaPoolExampleReadCfg
def AthenaPoolExampleReadCfg(flags, readCatalogs=[])
Definition: AthenaPoolExampleConfig.py:6
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:46
InfileMetaDataConfig.createIOVMetaData
def createIOVMetaData(tools, result, flags)
Definition: InfileMetaDataConfig.py:108
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69