def createOutputStream( streamName, fileName = "", asAlg = False ): writingTool = AthenaPoolOutputStreamTool( streamName + "Tool" ) writingTool.DataHeaderSatellites = [ "basic/:EventInfo#*" ] outputStream = AthenaOutputStream( streamName, WritingTool = writingTool, ItemList = [ "EventInfo#*" ] ) outputStream.MetadataStore = svcMgr.MetaDataStore outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ] if asAlg: from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += outputStream else: theApp.OutStreamType = "AthenaOutputStream" theApp.addOutputStream( outputStream ) if fileName != "": outputStream.OutputFile = fileName from OutputStreamAthenaPoolConf import MakeEventStreamInfo streamInfoTool = MakeEventStreamInfo( streamName + "_MakeEventStreamInfo" ) streamInfoTool.Key = streamName outputStream.HelperTools = [ streamInfoTool ] return outputStream
def createOutputStream(streamName, fileName="", asAlg=False): from AthenaServices.AthenaServicesConf import AthenaOutputStream theApp.OutStreamType = "AthenaOutputStream" if asAlg: from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Now do standard output stream writingTool1 = AthenaRootOutputStreamTool(streamName + "Tool") writingTool1.TreeName = "CollectionTree" outputStream = AthenaOutputStream(streamName, WritingTool=writingTool1, ItemList=["EventInfo#*"]) if asAlg: from AthenaCommon.AlgSequence import AlgSequence topSequence += outputStream else: theApp.addOutputStream(outputStream) if fileName != "": outputStream.OutputFile = fileName return outputStream
# Declare output streams: Stream1 = AthenaOutputStream("Stream1") # Tool for output stream: Stream1.WritingTool = "AthenaPoolOutputStreamTool" # Set processing stage name for <>_ref try: Stream1.ProcessingTag = StageOutName except: print "No processing tag set for stream1" # Persistent data file name: try: Stream1.OutputFile = OutFile except: Stream1.OutputFile = "OutputData.root" #Extend or not provenance on event stream try: Stream1.ExtendProvenanceRecord = Extend except: print "Provenance record will be extended in DataHeader" # List of data objects to be persistified: Stream1.ItemList += ["EventInfo#*"] topSequence += Stream1 #--------------------------------------------------------------
def createOutputStream(streamName, fileName="", asAlg=False, noTag=False, eventInfoKey="EventInfo", decisionFilter="", trigNavThinningSvc=None): if trigNavThinningSvc is None: trigNavThinningSvc = _trigNavThinningSvcs.get(streamName, None) # define athena output stream writingTool = AthenaOutputStreamTool(streamName + "Tool") outputStream = AthenaOutputStream(streamName, WritingTool=writingTool, ItemList=["EventInfo#*"]) #outputStream.ItemList += [ "xAOD::EventInfo#*" ] outputStream.MetadataStore = svcMgr.MetaDataStore outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ] ## get a handle on the default top-level algorithm sequence from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from AthenaCommon.AlgSequence import AthSequencer outSequence = AthSequencer("AthOutSeq") doTag = not noTag if doTag: if ('EventInfoTagBuilder/EventInfoTagBuilder' not in topSequence.getProperties()['Members']): key = "SimpleTag" # Tell tool to pick it up outputStream.WritingTool.AttributeListKey = key # build eventinfo attribute list from .OutputStreamAthenaPoolConf import EventInfoAttListTool, EventInfoTagBuilder EventInfoTagBuilder = EventInfoTagBuilder( AttributeList=key, EventInfoKey=eventInfoKey, FilterString=decisionFilter) from AthenaCommon.GlobalFlags import globalflags if globalflags.InputFormat() == 'bytestream': #No event-tag input in bytestream EventInfoTagBuilder.PropagateInput = False topSequence += EventInfoTagBuilder # decide where to put outputstream in sequencing if asAlg: outSequence += outputStream else: outSequence += outputStream if fileName != "": outputStream.OutputFile = fileName from .OutputStreamAthenaPoolConf import MakeEventStreamInfo streamInfoTool = MakeEventStreamInfo(streamName + "_MakeEventStreamInfo") streamInfoTool.Key = streamName streamInfoTool.EventInfoKey = eventInfoKey outputStream.HelperTools = [streamInfoTool] # Support for MT thinning. from AthenaServices.AthenaServicesConf import Athena__ThinningCacheTool tct = Athena__ThinningCacheTool('ThinningCacheTool_' + streamName, StreamName=streamName) if trigNavThinningSvc is not None: tct.TrigNavigationThinningSvc = trigNavThinningSvc outputStream.HelperTools += [tct] # Set the list of transient items based on what we know is in the transient # store. The output algorithm will then declare input dependencies # for objects which are both listed here and in the ItemList. # (We do it like this because ItemList is typically configured to include # everything which might possibly be output. If this gets cleaned up, # then we can remove this.) # Some builds don't include RecExConfig, so don't crash in that case. # FIXME: Rather than using ObjKeyStore, we could scan all algorithms # and look for write handles. try: tlist = [] from RecExConfig.ObjKeyStore import objKeyStore for typ, klist in objKeyStore['transient'].getProperties().items(): for k in klist: tlist.append(typ + '#' + k) outputStream.TransientItems += tlist except ImportError: pass return outputStream