ATLAS Offline Software
DRAWCommonByteStream.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from AthenaCommon.Logging import logging
7 import os
8 
10  formatName,
11  filename):
12  '''Common config fragment for setting up
13  ByteStream for DRAW formats'''
14  if os.access(filename,os.F_OK):
15  msg=logging.getLogger('DRAWByteStreamCfg')
16  msg.warning(f"Deleting pre-existing DRAW file {filename}")
17  os.remove(filename)
18 
19 
20  # Output configuration
21  outCA = ComponentAccumulator(
22  CompFactory.AthSequencer(
23  name='AthOutSeq',
24  StopOverride=True))
25 
26  bsesoSvc = CompFactory.ByteStreamEventStorageOutputSvc(
27  name="BSEventStorageOutputSvc"+formatName,
28  MaxFileMB=15000,
29  MaxFileNE=15000000,
30  OutputDirectory='./',
31  StreamType='',
32  StreamName='Stream'+formatName,
33  SimpleFileName=filename)
34  outCA.addService(bsesoSvc)
35 
36  bsIS = CompFactory.ByteStreamEventStorageInputSvc('ByteStreamInputSvc')
37  outCA.addService(bsIS)
38 
39  bsCopyTool = CompFactory.ByteStreamOutputStreamCopyTool(
40  ByteStreamOutputSvc=bsesoSvc,
41  ByteStreamInputSvc=bsIS)
42 
43  bsCnvSvc = CompFactory.ByteStreamCnvSvc(
44  ByteStreamOutputSvcList=[bsesoSvc.getName()])
45  outCA.addService(bsCnvSvc)
46 
47  outCA.addEventAlgo(CompFactory.AthenaOutputStream(
48  name='BSOutputStreamAlg'+formatName,
49  WritingTool=bsCopyTool,
50  EvtConversionSvc=bsCnvSvc.name,
51  RequireAlgs=[formatName+'Kernel'],
52  ExtraInputs={('xAOD::EventInfo', 'StoreGateSvc+EventInfo')}),
53  domain='IO', primary=True)
54 
55  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
56  from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg
57  outCA.merge(IOVDbSvcCfg(flags))
58  outCA.merge(MetaDataSvcCfg(flags,
59  ["IOVDbMetaDataTool", "ByteStreamMetadataTool"]))
60 
61  return outCA
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.IOVDbSvcConfig.IOVDbSvcCfg
def IOVDbSvcCfg(flags, **kwargs)
Definition: IOVDbSvcConfig.py:19
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
python.DRAWCommonByteStream.DRAWCommonByteStreamCfg
def DRAWCommonByteStreamCfg(flags, formatName, filename)
Definition: DRAWCommonByteStream.py:9