def _loadBasicRegistrationStream(): """Loads the basic services for RegistrationStreamSvc""" ## make sure we have been -at least- minimally correctly configured import AthenaCommon.AtlasUnixStandardJob ## get a handle on the top-level Algorithm sequence from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() #-------------------------------------------------------------- # Example for Event Collection Registration #-------------------------------------------------------------- # # For each output collection, use a separate registration stream # # Run RegistrationStream as an algorithm from RegistrationServices.RegistrationServicesConf import RegistrationStream topSequence += RegistrationStream("RegStream1", CollectionType="ExplicitROOT", OutputCollection="NewEventCollection", OutputLevel=INFO) # # backward compat RegStream1 = topSequence.RegStream1 # List of DO's to register: # First element is used to obtain a token to the DataHeader RegStream1.ItemList += ["DataHeader#*"] # The second element is the AthenaAttributeList to be written into the # collection as the tag: RegStream1.ItemList += ["AthenaAttributeList#SimpleTag"] msg.debug("Loading basic services for RegistrationStream... [DONE]") return
Stream1.ItemList += ["EventInfo#*"] topSequence += Stream1 #-------------------------------------------------------------- # Event tag collection registration #-------------------------------------------------------------- # Registration stream: from RegistrationServices.RegistrationServicesConf import RegistrationStream from RegistrationServices.RegistrationServicesConf import RegistrationStreamLCGTool from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool RegStreamTool1 = RegistrationStreamLCGTool("LCGTool") RegStreamTool1.OutputCollection = "ToolSupremacy.root" RegStream1 = RegistrationStream("RegStream1") RegStream1.OutputLevel = INFO RegStream1.Tool = RegStreamTool1 # Specifies whether collection references input or output data file: try: RegStream1.WriteInputDataHeader = WriteInputHeader except: RegStream1.WriteInputDataHeader = FALSE if inCollType == "MonteCarlo": RegStream1.WriteInputDataHeader = FALSE # Output collection name: try: RegStream1.OutputCollection = OutColl
WriteTag = AthPoolEx__WriteTag( "WriteTag" ) WriteTag.Magic = 1 topSequence += WriteTag from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream Stream2 = AthenaPoolOutputStream ( "Stream2" , "SimplePoolFileB.root" , True ) Stream2.WritingTool.AttributeListKey = "RunEventTag" #-------------------------------------------------------------- # Event Collection Registration #-------------------------------------------------------------- from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream2 = RegistrationStream( "RegStream2" , CollectionType="ExplicitROOT" , Tool=TagTool ) RegStream2.WriteInputDataHeader = False RegStream2.OutputCollection = "SimplePoolCollection2.root" RegStream2.CollectionOpenMode = "UPDATE" RegStream2.ItemList += [ "DataHeader#Stream2" ] RegStream2.ItemList += [ "TagAthenaAttributeList#RunEventTag" ] topSequence += RegStream2 #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL) #-------------------------------------------------------------- svcMgr.MessageSvc.OutputLevel = 3 svcMgr.PoolSvc.OutputLevel = 2 svcMgr.AthenaPoolCnvSvc.OutputLevel = 2 topSequence.WriteData.OutputLevel = 2 Stream2.OutputLevel = 2
#-------------------------------------------------------------- # Consequently, should have 3 output files # Numbers 3, 4, from PassAll and 1 from Passnone #-------------------------------------------------------------- # # Now configure output collection # #-------------------------------------------------------------- from RegistrationServices.RegistrationServicesConf import RegistrationStream from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") #TagTool.FragmentByGroup = True #topSequence += ["RegistrationStream/FullColl" ] FullColl = RegistrationStream("FullColl") FullColl.OutputCollection = "SplittableCollection.root" #FullColl.ItemList += [ "DataHeader#*" ] FullColl.ItemList += ["DataHeader#DataStream"] FullColl.ItemList += ["AthenaAttributeList#SimpleTag"] FullColl.ItemList += ["CollectionMetadataContainer#*"] FullColl.AcceptAlgs = ["PassAllFilter"] #FullColl.Tool = TagTool # Now put full veto to make sure vetos work on collections #topSequence += ["RegistrationStream/NullColl" ] NullColl = RegistrationStream("NullColl") NullColl.OutputCollection = "NullableCollection.root" NullColl.ItemList += ["DataHeader#DataStream"] NullColl.ItemList += ["AthenaAttributeList#SimpleTag"] NullColl.OutputLevel = INFO
athOutSeq += Bad #-------------------------------------------------------------- # Now do collections #-------------------------------------------------------------- # Explicit (i.e. not just files) collections (ROOT) # from RegistrationServices.RegistrationServicesConf import RegistrationStream from RegistrationServices.RegistrationServicesConf import RegistrationStreamLCGTool from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") TagTool.OutputLevel = INFO # bit 1 CollBit1 = RegistrationStream("CollBit1") CollBit1.CollectionType = "ExplicitROOT" #CollBit1.OutputCollection = "AthenaPoolMultiTest_Split1"; # The output file name CollBit1.OutputCollection = "Collection_Split1.root" CollBit1.ItemList += ["DataHeader#*"] CollBit1.ItemList += ["AthenaAttributeList#SimpleTag"] CollBit1.ItemList += ["CollectionMetadataContainer#*"] CollBit1.OutputLevel = INFO CollBit1.AcceptAlgs = ["Splitter1"] #CollBit1.CollectionOpenMode = "UPDATE" # bit ( 2 | 3 ) Coll23 = RegistrationStream("Coll23") Coll23.CollectionType = "ExplicitROOT" Coll23.OutputCollection = "Collection_Split23.root" Coll23.ItemList += ["DataHeader#*"]
from AthenaPoolMultiTest.AthenaPoolMultiTestConf import * RunEventTagWriter = RunEventTagWriter("RunEventTagWriter") #RunEventTagWriter.OutputLevel = DEBUG topSequence += RunEventTagWriter from RegistrationServices.RegistrationServicesConf import RegistrationStream from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") #TagTool.PrimaryKey = ['RunNumber','EventNumber'] # output a collection to test multi input metadata copy FullColl = RegistrationStream("FullColl") FullColl.WriteInputDataHeader = TRUE FullColl.OutputCollection = "CheckCollections.root" FullColl.ItemList += ["DataHeader#*"] FullColl.ItemList += ["AthenaAttributeList#RunEventTag"] FullColl.Tool = TagTool FullColl.OutputLevel = DEBUG athRegSeq += FullColl #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL) #-------------------------------------------------------------- svcMgr.MessageSvc.infoLimit = 5000 svcMgr.MessageSvc.debugLimit = 5000 svcMgr.MessageSvc.OutputLevel = INFO
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream Stream1 = AthenaPoolOutputStream( "Stream1" ) Stream1.OutputFile = "SimplePoolFile.root" # List of DO's to write out Stream1.ItemList+=["CaloCellContainer#*"] Stream1.ItemList+=["EventInfo#*"] # Must make sure that no OutStream's have been declared theApp.OutStream = []; #-------------------------------------------------------------- # Event Collection Registration #-------------------------------------------------------------- # Run OutputStream as an algorithm from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream1 = RegistrationStream( "RegStream1" ) RegStream1.CollectionType = "ExplicitROOT" RegStream1.OutputCollection = "NewEventCollection" RegStream1.OutputLevel = INFO # List of DO's to register RegStream1.ItemList += [ "DataHeader#*" ] # Key name of AthenaAttributeList used for the tag: RegStream1.ItemList += [ "AthenaAttributeList#SimpleTag" ] topSequence += RegStream1 #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) #-------------------------------------------------------------- svcMgr.MessageSvc.OutputLevel = INFO svcMgr.MessageSvc.debugLimit = 100000 svcMgr.ClassIDSvc.OutputLevel = INFO
from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__PassNoneFilter topSequence += AthPoolEx__PassNoneFilter("PassNoneFilter") Stream3 = AthenaPoolOutputStream("Stream3", "EmptyPoolFile.root", True) Stream3.RequireAlgs = ["PassNoneFilter"] #-------------------------------------------------------------- # Event Collection Registration #-------------------------------------------------------------- from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream1 = RegistrationStream("RegStream1", CollectionType="ExplicitROOT", Tool=TagTool) RegStream1.WriteInputDataHeader = False RegStream1.OutputCollection = "SimplePoolCollection1.root" RegStream1.ItemList += ["DataHeader#Stream1"] RegStream1.ItemList += ["TagAthenaAttributeList#" + MagicWriteTag.Key] topSequence += RegStream1 RegStream2 = RegistrationStream("RegStream2", CollectionType="ExplicitROOT", Tool=TagTool) RegStream2.WriteInputDataHeader = False RegStream2.OutputCollection = "SimplePoolCollection2.root" RegStream2.ItemList += ["DataHeader#Stream2"] RegStream2.ItemList += ["TagAthenaAttributeList#RunEventTag"] topSequence += RegStream2
from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__ReadData topSequence += AthPoolEx__ReadData("ReadData") from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream Stream1 = AthenaPoolOutputStream("Stream1", "SimplePoolFromRaw.root", True) Stream1.MetadataItemList += ["ByteStreamMetadataContainer#*"] from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__WriteTag topSequence += AthPoolEx__WriteTag("WriteTag") from RegistrationServices.RegistrationServicesConf import RegistrationStreamTagTool TagTool = RegistrationStreamTagTool("TagTool") from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream1 = RegistrationStream("RegStream1", CollectionType="ExplicitROOT", Tool=TagTool) RegStream1.WriteInputDataHeader = False RegStream1.OutputCollection = "SimpleRawCollection.root" RegStream1.ItemList += ["DataHeader#Stream1"] RegStream1.ItemList += ["TagAthenaAttributeList#RunEventTag"] topSequence += RegStream1 #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL) #-------------------------------------------------------------- svcMgr.MessageSvc.OutputLevel = 3 svcMgr.PoolSvc.OutputLevel = 2 svcMgr.AthenaPoolCnvSvc.OutputLevel = 2 svcMgr.MetaDataSvc.OutputLevel = 2 topSequence.ReadBs.OutputLevel = 2
topSequence+=RunEventTagWriter # Converters: include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) #-------------------------------------------------------------- # Event Collection Registration #-------------------------------------------------------------- # Run OutputStream as an algorithm from RegistrationServices.RegistrationServicesConf import RegistrationStream from RegistrationServices.RegistrationServicesConf import RegistrationStreamLCGTool TagTool = RegistrationStreamLCGTool("RegistrationStreamLCGTool") RegStream1 = RegistrationStream( "RegStream1" ) RegStream1.WriteInputDataHeader = True RegStream1.Tool = TagTool # Full path name of output collection: try: RegStream1.OutputCollection = Out except: RegStream1.OutputCollection = "test.coll.root" # Collection type (ExplicitROOT, ExplicitMySQL or ExplicitMySQLlt): try: RegStream1.CollectionType = Type except: RegStream1.CollectionType = "ExplicitROOT"
#RegStream.RequireAlgs = [] # List of Algorithms that this stream is vetoed by #RegStream.VetoAlgs = [] #-------------------------------------------------------------- # Example for Event Collection Registration #-------------------------------------------------------------- # # For each output collection, use a separate registration stream # # Run RegistrationStream as an algorithm from RegistrationServices.RegistrationServicesConf import RegistrationStream topSequence += RegistrationStream("RegStream1", CollectionType="ExplicitROOT", OutputCollection="NewEventCollection", OutputLevel=INFO) ## backward compat RegStream1 = topSequence.RegStream1 # List of DO's to register: # First element is used to obtain a token to the DataHeader RegStream1.ItemList += ["DataHeader#*"] # The second element is the AthenaAttributeList to be written into the # collection as the tag: RegStream1.ItemList += ["AthenaAttributeList#SimpleTag"] ## the following is to examplify how one would filter the output based on ## the decision of some selection algorithm
from AthenaPoolMultiTest.AthenaPoolMultiTestConf import RunEventTagWriter theApp.TopAlg += ["RunEventTagWriter"] # Converters: include("EventAthenaPool/EventAthenaPool_joboptions.py") include("AthenaPoolTools/EventCount_jobOptions.py") #-------------------------------------------------------------- # Event Collection Registration #-------------------------------------------------------------- # Run OutputStream as an algorithm from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream1 = RegistrationStream("RegStream1") RegStream1.OutputLevel = INFO RegStream1.CollectionType = "ExplicitROOT" RegStream1.WriteInputDataHeader = True RegStream1.OutputCollection = "test.coll" # The output file name # List of DO's to register RegStream1.ItemList += ["DataHeader#*"] # Key name of AthenaAttributeList used for the tag: RegStream1.ItemList += ["AthenaAttributeList#RunEventTag"] topSequence += RegStream1 #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) #--------------------------------------------------------------
Stream1.WritingTool = "AthenaPoolOutputStreamTool" # Set processing stage name for <>_ref Stream1.ProcessingTag = 'PROP_ONLY' Stream1.OutputFile = "OutputData.root" # List of data objects to be persistified: Stream1.ItemList += ["EventInfo#*"] topSequence+=Stream1 #-------------------------------------------------------------- # Event tag collection registration #-------------------------------------------------------------- # Registration stream: from RegistrationServices.RegistrationServicesConf import RegistrationStream RegStream1 = RegistrationStream( "RegStream1" ) # List of data object references to be added to collection: RegStream1.ItemList += [ "DataHeader#*" ] RegStream1.ItemList += [ "AthenaAttributeList#SimpleTag" ] # Output collection type: RegStream1.CollectionType = "ExplicitROOT" # Output collection database connection string: RegStream1.Connection = "" # Output collection name: RegStream1.OutputCollection = "OutputCollection" # Output collection open mode: RegStream1.CollectionOpenMode = "CREATE_AND_OVERWRITE" # Specifies whether collection references input or output data file: RegStream1.WriteInputDataHeader = FALSE # Reference to input file