11 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
12 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
13 from AthenaConfiguration.ComponentFactory
import CompFactory
14 from AthenaPython.PyAthenaComps
import Alg, StatusCode
27 flags.Exec.MaxEvents = evtMax
28 flags.Exec.OutputLevel = INFO
29 flags.Common.MsgSourceLength = 18
36 flags.Input.Files = [infile]
37 for stream, outfile
in kw.items():
38 flags.addFlag (f
'Output.{stream}FileName', outfile)
41 from Campaigns.Utils
import Campaign
42 flags.Input.RunNumbers = [0]
43 flags.Input.TimeStamps = [0]
44 flags.Input.ProcessingTags = []
45 flags.Input.TypedCollections = []
46 flags.Input.isMC =
True
47 flags.IOVDb.GlobalTag =
''
48 flags.Input.MCCampaign = Campaign.Unknown
51 if flags.Output.StorageTechnology.EventData ==
'ROOTRNTUPLE':
53 return s.replace (
'.root',
'.rntup.root')
54 flags.Input.Files = [to_rntup(f)
for f
in flags.Input.Files]
55 for k, v
in flags.Output.asdict().
items():
56 if k.endswith (
'FileName'):
57 setattr (flags.Output, k, to_rntup (v))
66 loadReadDicts = False,
67 loadWriteDicts = False,
69 TimeStampInterval = None,
71 from AthenaConfiguration.MainServicesConfig
import \
72 MainServicesCfg, MessageSvcCfg
73 cfg = MainServicesCfg (flags)
74 cfg.merge (MessageSvcCfg (flags))
75 cfg.getService(
"MessageSvc").debugLimit = 10000
76 cfg.addService (CompFactory.ClassIDSvc (OutputLevel = INFO))
77 cfg.addService (CompFactory.ChronoStatSvc (ChronoPrintOutTable =
False,
78 PrintUserTime =
False,
79 StatPrintOutTable =
False))
81 if flags.Input.Files == [
'_ATHENA_GENERIC_INPUTFILE_NAME_']:
84 from McEventSelector.McEventSelectorConfig
import McEventSelectorCfg
86 if EventsPerLB
is not None:
87 mckw[
'EventsPerLB'] = EventsPerLB
88 if TimeStampInterval
is not None:
89 mckw[
'TimeStampInterval'] = TimeStampInterval
90 cfg.merge (McEventSelectorCfg (flags, **mckw))
92 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
93 cfg.merge (EventInfoCnvAlgCfg (flags, disableBeamSpot =
True))
94 elif not flags.Input.Files[0].endswith (
'.bs'):
96 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
97 cfg.merge (PoolReadCfg (flags))
101 cfg.merge (LoadWriteDictsCfg (flags))
103 cfg.merge (LoadReadDictsCfg (flags))
106 if flags.Output.StorageTechnology.EventData ==
'ROOTRNTUPLE':
107 testName = testName +
'_rntup'
108 fileCatalog = testName +
'_catalog.xml'
109 from AthenaPoolCnvSvc.PoolCommonConfig
import PoolSvcCfg
110 kw = {
'WriteCatalog' :
'file:' + fileCatalog}
112 kw[
'ReadCatalog'] = [
'file:' + readCatalog]
113 cfg.merge (PoolSvcCfg (flags, **kw))
116 os.remove (fileCatalog)
127 def TestOutputCfg (flags, stream, itemList, typeNames = [], metaItemList = []):
128 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
130 itemList = [
'xAOD::EventInfo#EventInfo',
131 'xAOD::EventAuxInfo#EventInfoAux.'] + itemList
133 metaItemList = [
"IOVMetaDataContainer#*"]
135 helperTools = [ CompFactory.xAODMaker.EventFormatStreamHelperTool(
136 f
'{stream}_EventFormatStreamHelperTool',
137 Key = f
'EventFormat{stream}',
138 TypeNames = typeNames,
139 DataHeaderKey = f
'Stream{stream}') ]
140 metaItemList = [ f
'xAOD::EventFormat#EventFormat{stream}' ] + metaItemList
141 acc.merge (OutputStreamCfg (flags, stream,
143 HelperTools = helperTools,
144 MetadataItemList = metaItemList))
147 alg.WritingTool.SubLevelBranchName =
'<key>'
148 acc.getService (
'AthenaPoolCnvSvc').PoolAttributes += [
"DEFAULT_SPLITLEVEL='1'"]
159 def __init__ (self, name = 'LoadWriteDicts', **kw):
160 super(LoadWriteDicts, self).__init__ (name=name, **kw)
163 ROOT.gROOT.SetBatch(
True)
165 cppyy.load_library(
"libDataModelTestDataCommonDict")
166 cppyy.load_library(
"libDataModelTestDataWriteDict")
167 cppyy.load_library(
"libDataModelTestDataWriteCnvDict")
169 ROOT.DMTest.setConverterLibrary (
'libDataModelTestDataWriteCnvPoolCnv.so')
170 ROOT.DMTest.setTrigConverterLibrary (
'libDataModelTestDataWriteSerCnv.so')
171 return StatusCode.Success
186 super(LoadReadDicts, self).__init__ (name=name, **kw)
189 ROOT.gROOT.SetBatch(
True)
191 cppyy.load_library(
"libDataModelTestDataCommonDict")
192 cppyy.load_library(
"libDataModelTestDataReadDict")
194 ROOT.gROOT.GetClass(
'DMTest::HAuxContainer_v1')
195 ROOT.gROOT.GetClass(
'DataVector<DMTest::H_v1>')
196 ROOT.gROOT.GetClass(
'DMTest::HView_v1')
197 ROOT.DMTest.setConverterLibrary (
'libDataModelTestDataReadCnvPoolCnv.so')
198 ROOT.DMTest.setTrigConverterLibrary (
'libDataModelTestDataReadSerCnv.so')
199 return StatusCode.Success
208 is_rntuple = flags.Output.StorageTechnology.EventData ==
'ROOTRNTUPLE'
210 return True,
lambda k:
''
211 return False,
lambda k:k