27 """Set up to read from a bytestream file
29 The function adds the components required to read events and metadata from
30 bytestream input. May be used to read events from a secondary input as well
34 flags: Job configuration flags
35 type_names: (optional) specific type names for address provider to find
38 A component accumulator fragment containing the components required to
39 read from bytestream. Should be merged into main job configuration.
41 result = ComponentAccumulator()
43 bytestream_conversion = CompFactory.ByteStreamCnvSvc()
44 result.addService(bytestream_conversion)
47 if flags.Common.isOnline
and not any(flags.Input.Files)
and not (flags.Trigger.doHLT
or flags.Trigger.doLVL1):
48 bytestream_input = CompFactory.ByteStreamEmonInputSvc(
"ByteStreamInputSvc")
50 eiName =
"{}EventInfo".format(flags.Overlay.BkgPrefix
if flags.Common.ProductionStep
is ProductionStep.MinbiasPreprocessing
else "")
51 bytestream_input = CompFactory.ByteStreamEventStorageInputSvc(
52 name=
"ByteStreamInputSvc",
54 result.addService(bytestream_input)
56 if flags.Input.SecondaryFiles:
57 event_selector = CompFactory.EventSelectorByteStream(
58 name=
"SecondaryEventSelector",
60 Input=flags.Input.SecondaryFiles,
61 SkipEvents=flags.Exec.SkipEvents
if flags.Overlay.SkipSecondaryEvents >= 0
else flags.Exec.SkipEvents,
62 ByteStreamInputSvc=bytestream_input.name,
64 result.addService(event_selector)
66 event_selector = CompFactory.EventSelectorByteStream(
68 Input=flags.Input.Files,
69 SkipEvents=flags.Exec.SkipEvents,
70 ByteStreamInputSvc=bytestream_input.name,
72 result.addService(event_selector)
73 result.setAppProperty(
"EvtSel", event_selector.name)
75 event_persistency = CompFactory.EvtPersistencySvc(
76 name=
"EventPersistencySvc", CnvServices=[bytestream_conversion.name]
78 result.addService(event_persistency)
80 result.addService(CompFactory.ROBDataProviderSvc())
82 address_provider = CompFactory.ByteStreamAddressProviderSvc(
83 TypeNames=type_names
if type_names
else list(),
85 result.addService(address_provider)
88 MetaDataSvcCfg(flags, [
"IOVDbMetaDataTool",
"ByteStreamMetadataTool"])
91 proxy = CompFactory.ProxyProviderSvc(ProviderNames = [address_provider.name])
92 result.addService(proxy)
94 result.merge(SGInputLoaderCfg(flags, address_provider.TypeNames,
95 ExtraOutputs=[(
"xAOD::EventInfo",f
"StoreGateSvc+{eiName}"),
96 (
"xAOD::EventAuxInfo",f
"StoreGateSvc+{eiName}Aux.")]))
102 """Set up output stream in RAW/bytestream format
104 Configure components responsible for writing bytestream format. Write job
105 results to bytestream file. ATLAS file naming conventions are enforced as
106 determined from the given configuration flags.
109 flags: Job configuration flags
110 type_names: (optional) Specify item list for output stream to write
113 A component accumulator fragment containing the components required to
114 write to bytestream. Should be merged into main job configuration.
116 all_runs =
set(flags.Input.RunNumbers)
119 ),
"Input is from multiple runs, do not know which one to use {}".format(
122 result = ComponentAccumulator(CompFactory.AthSequencer(
'AthOutSeq', StopOverride=
True))
124 event_storage_output = CompFactory.ByteStreamEventStorageOutputSvc(
127 OutputDirectory=
"./",
128 SimpleFileName=flags.Output.BSFileName,
130 RunNumber=all_runs.pop(),
132 result.addService(event_storage_output)
136 bytestream_conversion = CompFactory.ByteStreamCnvSvc(
137 name=
"ByteStreamCnvSvc",
138 ByteStreamOutputSvcList=[event_storage_output.getName()],
140 result.addService(bytestream_conversion)
143 event_info_input = (
'xAOD::EventInfo',
'StoreGateSvc+EventInfo')
145 output_stream = CompFactory.AthenaOutputStream(
146 name=
"BSOutputStreamAlg",
147 EvtConversionSvc=bytestream_conversion.name,
148 OutputFile=
"ByteStreamEventStorageOutputSvc",
149 ItemList=type_names
if type_names
else list(),
150 ExtraInputs=[event_info_input]
152 result.addEventAlgo(output_stream, primary=
True)
154 result.merge(IOVDbSvcCfg(flags))
157 MetaDataSvcCfg(flags, [
"IOVDbMetaDataTool",
"ByteStreamMetadataTool"])
163 """Set up transient ByteStream output stream
165 Configure components responsible for writing bytestream format. Write the
166 specified objects to ByteStream into the cache of the ROBDataProviderSvc.
167 The data can then be read downstream as if they were coming from a BS file.
170 flags: Job configuration flags
171 item_list: (optional) List of objects to be written to transient ByteStream
172 type_names: (optional) List of types/names to register in BS conversion service
173 as available to be read from (transient) ByteStream
174 extra_inputs: (optional) List of objects which need to be produced before transient
175 ByteStream streaming is scheduled - ensures correct scheduling
178 A component accumulator fragment containing the components required to
179 write transient bytestream. Should be merged into main job configuration.
182 result = ComponentAccumulator()
184 result.addService(CompFactory.ROBDataProviderSvc())
186 rdp_output = CompFactory.ByteStreamRDP_OutputSvc()
187 result.addService(rdp_output)
189 bytestream_conversion = CompFactory.ByteStreamCnvSvc(
190 name=
"ByteStreamCnvSvc",
191 FillTriggerBits=
False,
192 ByteStreamOutputSvcList=[rdp_output.getName()],
194 result.addService(bytestream_conversion)
198 extra_outputs = [(
"TransientBSOutType",
"StoreGateSvc+TransientBSOutKey")]
201 event_info_input = (
'xAOD::EventInfo',
'StoreGateSvc+EventInfo')
203 extra_inputs = [event_info_input]
204 elif event_info_input
not in extra_inputs:
205 extra_inputs.append(event_info_input)
207 output_stream = CompFactory.AthenaOutputStream(
208 name=
"TransBSStreamAlg",
209 EvtConversionSvc=bytestream_conversion.name,
210 OutputFile=
"ByteStreamRDP_OutputSvc",
211 ItemList=item_list
if item_list
else list(),
212 ExtraInputs=extra_inputs,
213 ExtraOutputs=extra_outputs
215 result.addEventAlgo(output_stream,
218 address_provider = CompFactory.ByteStreamAddressProviderSvc(
219 TypeNames=type_names
if type_names
else list(),
221 result.addService(address_provider)
223 result.addService(CompFactory.ProxyProviderSvc(
224 ProviderNames = [address_provider.name]))
226 result.merge(SGInputLoaderCfg(flags, Load=address_provider.TypeNames))