12def createNtupleOutputStream(streamName, fileName, tupleName="physics", asAlg = False):
13 if asAlg:
14 from AthenaCommon.AlgSequence import AlgSequence
15 topSequence = AlgSequence()
16
17
18 writingTool1 = AthenaRootOutputStreamTool( streamName + "Tool" )
19 writingTool1.TreeName = tupleName
20 writingTool1.OutputFile = fileName
21
22 cls = AthenaRootNtupleOutputStreamProtect
23
24 outputStream = cls(
25 streamName,
26 WritingTool = writingTool1,
27 ItemList = ["RunNumber",
28 "EventNumber",],
29
30 )
31 if asAlg:
32 from AthenaCommon.AlgSequence import AlgSequence
33 topSequence += outputStream
34 else:
35 theApp.addOutputStream( outputStream )
36
37 if fileName != "":
38 outputStream.OutputFile = fileName
39 return outputStream
40