Example #1
0
    def __init__(self,
                 streamName="Stream2",
                 fileName="HLT.root",
                 catalog="xmlcatalog_file:Catalog1.xml",
                 store=None):

        import AthenaPoolCnvSvc.WriteAthenaPool
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from PoolSvc.PoolSvcConf import PoolSvc
        svcMgr += PoolSvc()
        svcMgr.PoolSvc.WriteCatalog = catalog

        from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
        svcMgr += AthenaPoolCnvSvc()
        svcMgr.AthenaPoolCnvSvc.CommitInterval = 10

        from OutputStreamAthenaPool.OutputStreamAthenaPool import AthenaPoolOutputConditionStream
        self.stream = AthenaPoolOutputConditionStream(streamName)

        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
        self.stream = AthenaPoolOutputStream(streamName)

        self.stream.OutputFile = fileName

        if store != None:
            self.stream.Store = store
        else:
            from StoreGate.StoreGateConf import StoreGateSvc
            self.stream.Store = StoreGateSvc("DetectorStore")

        TrigConditionStream.setItemList(self.stream)
Example #2
0
    def  __init__(self, StreamName, FileName, asAlg, isVirtual, noTag=False):
        AugmentedStreamBase.__init__(self,StreamName)
        #event-by-event stream
        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
        self.Stream = AthenaPoolOutputStream( StreamName, FileName, asAlg, noTag=noTag )
        if isVirtual == True:
            self.Stream.WriteOnExecute=False
            self.Stream.WriteOnFinalize=False

        return
Example #3
0
 def evgen_persistency(cls):
     """ EVGEN POOL file persistency
     """
     from G4AtlasApps.SimFlags import simFlags
     from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
     ## NB. Two-arg constructor is needed, since otherwise metadata writing fails!
     if hasattr(simFlags, "WriteTR") and simFlags.WriteTR.statusOn:
         stream2 = AthenaPoolOutputStream("StreamEVGEN", simFlags.WriteTR.get_Value())
         stream2.ItemList += ["IOVMetaDataContainer#*",
                              "EventInfo#*"]
         if simFlags.CavernBG.statusOn and 'Write' in simFlags.CavernBG.get_Value():
             stream2.ItemList += ["TrackRecordCollection#NeutronBG"]
         else:
             stream2.ItemList += ["TrackRecordCollection#CosmicRecord"]
         stream2.AcceptAlgs = ["G4AtlasAlg"]
     if hasattr(simFlags,'StoppedParticleFile') and simFlags.StoppedParticleFile.statusOn:
         stream2 = AthenaPoolOutputStream("StreamEVGEN", simFlags.StoppedParticleFile.get_Value())
         stream2.ItemList += ["IOVMetaDataContainer#*",
                              "EventInfo#*"]
         stream2.ItemList += ["TrackRecordCollection#StoppingPositions"]
         stream2.AcceptAlgs = ["G4AtlasAlg"]
    def __init__(self, StreamName, FileName, asAlg, isVirtual):
        AugmentedStreamBase.__init__(self, StreamName)
        #event-by-event stream
        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
        self.Stream = AthenaPoolOutputStream(StreamName, FileName, asAlg)
        self.Stream.ForceRead = True
        #force read of output data objs
        if isVirtual == True:
            self.Stream.WriteOnExecute = False
            self.Stream.WriteOnFinalize = False

        return
Example #5
0
    def __init__(self,
                 streamName="Stream1",
                 fileName="HLT.root",
                 catalog="xmlcatalog_file:Catalog1.xml",
                 store=None):
        import AthenaPoolCnvSvc.WriteAthenaPool  # noqa: F401
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        svcMgr.PoolSvc.WriteCatalog = catalog

        # revert later from OutputStreamAthenaPool.CreateOutputStreams import createOutputStream
        # revert later self.stream = createOutputStream( streamName )

        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
        self.stream = AthenaPoolOutputStream(streamName)

        self.stream.OutputFile = fileName

        if store is not None:
            self.stream.Store = store
        else:
            from StoreGate.StoreGateConf import StoreGateSvc
            self.stream.Store = StoreGateSvc("StoreGateSvc")

        TrigDecisionStream.setItemList(self.stream)
    pass
theApp.EvtMax = EVTMAX

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------

## schedule a noop algorithm: it just print where it is
from PerfMonTests.PerfMonTestsConf import PerfMonTest__NoopAlg
topSequence += PerfMonTest__NoopAlg("NoopAlg")

#---------------------------------------------------------------
# Pool Persistency
#---------------------------------------------------------------
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
outStream = AthenaPoolOutputStream("OutStream")
outStream.ItemList = ["EventInfo#McEventInfo"]

if not 'OUTPUT' in dir():
    OUTPUT = "my.data.pool"
    pass
outStream.OutputFile = OUTPUT

## somehow better configure the AthenaPoolCnvSvc for our small
## persistency output job
svcMgr.AthenaPoolCnvSvc.CommitInterval = 1000

svcMgr.MessageSvc.OutputLevel = ERROR
#==============================================================
#
# End of job options file
# Load POOL support
#--------------------------------------------------------------
import AthenaPoolCnvSvc.WriteAthenaPool

#Set first event number to 20 (to continue previous production)
svcMgr.EventSelector.FirstEvent = 20

#Explicitly specify the output file catalog
svcMgr.PoolSvc.WriteCatalog = "xmlcatalog_file:Catalog2.xml"
#Open file in "update" mode
svcMgr.PoolSvc.FileOpen = "update"

svcMgr.AthenaPoolCnvSvc.CommitInterval = 10

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream("Stream1", "ROOTTREE:SimplePoolFile5.root")
Stream1.ItemList += ["ExampleHitContainer#MyHits"]
Stream1.MetadataItemList += ["ExampleHitContainer#PedestalWriteData"]
Stream1.ProvideDef = True

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
# Load "user algorithm" top algorithms to be run, and the libraries that house them
from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__WriteData, AthPoolEx__WriteCond
topSequence += AthPoolEx__WriteData("WriteData")
from StoreGate.StoreGateConf import StoreGateSvc
topSequence += AthPoolEx__WriteCond("WriteCond",
                                    DetStore=StoreGateSvc("MetaDataStore"),
                                    ConditionName="PedestalWriteData")
Example #8
0
ServiceMgr.AthenaPoolCnvSvc.InputPoolAttributes += [
    "ContainerName = 'CollectionTree'; TREE_CACHE = '-1'"
]
ServiceMgr.AthenaPoolCnvSvc.InputPoolAttributes += [
    "TREE_CACHE_LEARN_EVENTS = '100'"
]
ServiceMgr.AthenaPoolCnvSvc.PrintInputAttrPerEvt += ["FILE_READ_CALLS = 'int'"]

ServiceMgr.AthenaPoolCnvSvc.InputPoolAttributes += ["ASYNC_PREFETCHING = '1'"]

ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True
ServiceMgr.AthenaPoolCnvSvc.SkipFirstChronoCommit = True

# Copy Output
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
StreamAOD = AthenaPoolOutputStream("StreamAOD", "AOD_copy.pool.root", True)
# Base the xAOD branch names just on the SG keys:
StreamAOD.WritingTool.SubLevelBranchName = "<key>"

StreamAOD.ForceRead = True
StreamAOD.TakeItemsFromInput = True
StreamAOD.ExcludeList += ["CaloCellContainer#*"]
StreamAOD.ExcludeList += ["TileCellContainer#*"]
StreamAOD.ExcludeList += ["CaloClusterCellLinkContainer#*"]

#--------------------------------------------------------------
# Performance Monitoring
#--------------------------------------------------------------
from PerfMonComps.PerfMonFlags import jobproperties as pmjp
pmjp.PerfMonFlags.doPostProcessing = True
pmjp.PerfMonFlags.doSemiDetailedMonitoringFullPrint = True
#--------------------------------------------------------------
# Output options
# LAr Hit
# Converters:
include("EventAthenaPool/EventAthenaPool_joboptions.py")
#include( "AFP_EventAthenaPool/AFP_EventAthenaPool_joboptions.py" )

# ItemList:
include("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")
#include( "AFP_EventAthenaPool/AFP_EventAthenaPoolItemList_joboptions.py" )

print fullItemList

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream("Stream1")
Stream1.OutputFile = strOutputRootFile

# List of DO's to write out - we don't use fullItemList, just list a
# few we want
#Stream1.ItemList   += fullItemList
Stream1.ItemList += ["EventInfo#*",
                     "McEventCollection#TruthEvent"]  # mc truth (hepmc)
#Stream1.ItemList+= ["AFP_TDDigiCollection#*"]
Stream1.ItemList += ["AFP_TDLocRecoEvCollection#*"]
#Stream1.ItemList+= ["AFP_SiDigiCollection#*"]
Stream1.ItemList += ["AFP_SIDLocRecoEvCollection#*"]

#--------------------------------------------------------------
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
MessageSvc = Service("MessageSvc")
Example #10
0
#--------------------------------------------------------------
#---  Set up the streams for the filters
#     Note that this uses a cascading exclusive stream model
#     for the outstreams and uses inclusive only for the collections.
#     Cascading means that the first stream in the list for which an
#     event qualifies gets it. Another exclusive model that has been
#     explored puts all multistream events in a single overlap stream.
#--------------------------------------------------------------

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream

ToolSvc = Service("ToolSvc")

# Filtered stream 2
Stream2 = AthenaPoolOutputStream("Stream2",
                                 "AthenaPoolMultiTest_Split2.root",
                                 False,
                                 noTag=False)
Stream2.CheckNumberOfWrites = False
# Filtered stream 1
Stream1 = AthenaPoolOutputStream("Stream1",
                                 "AthenaPoolMultiTest_Split1.root",
                                 False,
                                 noTag=False)
Stream1.CheckNumberOfWrites = False
# Filtered stream 3
Stream3 = AthenaPoolOutputStream("Stream3",
                                 "AthenaPoolMultiTest_Split3.root",
                                 False,
                                 noTag=False)
Stream3.CheckNumberOfWrites = False
# Events that didn't satisfy any filters
Example #11
0
#--------------------------------------------------------------
# Setup Output
#--------------------------------------------------------------
if hasattr(runArgs, "outputRDO_MRGFile"):
  outputFile = runArgs.outputRDO_MRGFile
else:
  outputFile = "DidNotSetOutputName.root"

if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi():
  from OverlayCommonAlgs.OverlayFlags import overlayFlags
  eventInfoKey = overlayFlags.bkgPrefix() + "EventInfo"
else:
  eventInfoKey = "EventInfo"

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
StreamRDO = AthenaPoolOutputStream( "StreamRDO", outputFile, asAlg=True, noTag=True, eventInfoKey=eventInfoKey )
StreamRDO.TakeItemsFromInput=TRUE;
# The next line is an example on how to exclude clid's if they are causing a  problem
#StreamRDO.ExcludeList = ['6421#*']

# Look for lists of filter algorithms
try:
  StreamRDO.AcceptAlgs = AcceptList
except:
  print("No accept algs indicated in AcceptList")
try:
  StreamRDO.RequireAlgs = RequireList
except:
  print("No accept algs indicated in RequireList")
try:
  StreamRDO.VetoAlgs = VetoList
EventBoost.DoGaussianVertexSmearing = False
EventBoost.GaussianWidth += [
    0.01, 0.01, 56.0
]  # mm  x, y, z. Default taken from: Simulation/G4Sim/MCTruth/MCTruth/VertexPositioner.hh
EventBoost.GaussianMean += [0.0, 0.0, 0.0]  # mm  x, y, z
EventBoost.DoFlatVertexSmearing = False
EventBoost.FlatSmearingBoundaryMin += [-0.01, -0.01, -0.01]  #mm  x, y, z
EventBoost.FlatSmearingBoundaryMax += [0.01, 0.01, 0.01]  #mm  x, y, z
EventBoost.OutputLevel = 3

######### Streams & persistency #########
##################################################
# Setup output stream.                           #
##################################################
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
myOutStream = AthenaPoolOutputStream("myOutStream")
myOutStream.EvtConversionSvc = "AthenaPoolCnvSvc"
myOutStream.OutputFile = "boosted.pool.root"
myOutStream.ItemList += ["EventInfo#*", "McEventCollection#*"]
myOutStream.ForceRead = TRUE

##################################################
# Do consistency checks                          #
##################################################

#from TruthExamples.TruthExamplesConf import TestHepMC
#job += TestHepMC()
#job.TestHepMC.EnergyDifference = 0.001*GeV # tolerance on energy conservation
#job.TestHepMC.OutputLevel = WARNING

##################################################
Example #13
0
from Starlight_i.Starlight_iConf import Starlight_i
genSeq += Starlight_i("Starlight")
genSeq.Starlight.McEventKey = "GEN_EVENT"

evgenConfig.generators += ["Starlight"]

## Extra stream persistency
## 2101 == EventInfo, 133273 == MCTruth (HepMC)
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
_evgenstream = AthenaPoolOutputStream("StreamEVGEN")
_evgenstream.ItemList = ["2101#*", "133273#GEN_EVENT"]
del _evgenstream
include("EventOverlayJobTransforms/MuonMcSignal_jobOptions.py")

include("EventOverlayJobTransforms/LArMcSignal_jobOptions.py")

include("EventOverlayJobTransforms/TileMcSignal_jobOptions.py")

include("EventOverlayJobTransforms/L1Signal_jobOptions.py")

from OverlayCommonAlgs.OverlayCommonAlgsConf import UpdateEventInfo
job += UpdateEventInfo()
job.UpdateEventInfo.InfoType = "McEventInfo"

# The output - signal
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
signalStream = AthenaPoolOutputStream("StreamRDO_MC")
signalStream.OutputFile = SignalCollection
signalStream.Store = "TemporaryStore"

signalStream.ItemList += [
    "EventInfo#*", "EventStreamInfo#*", "PileUpEventInfo#*"
]

if DetFlags.overlay.Truth_on():
    signalStream.ItemList += ["McEventCollection#*", "TrackRecordCollection#*"]
    if DetFlags.overlay.CSC_on():
        signalStream.ItemList += ["CscSimDataCollection#CSC_SDO"]
    if DetFlags.overlay.MDT_on():
        signalStream.ItemList += ["MuonSimDataCollection#MDT_SDO"]
    if DetFlags.overlay.RPC_on():
        signalStream.ItemList += ["MuonSimDataCollection#RPC_SDO"]
#job.InDetOverlay.mainInputPixelName = 'PixelTest'

# McEventCollection copying
from OverlayCommonAlgs.OverlayCommonAlgsConf import CopyMcEventCollection
job += CopyMcEventCollection()

#--------------------------------------------------------------
# Output options
#--------------------------------------------------------------

from StoreGate.StoreGateConf import StoreGateSvc
ServiceMgr += StoreGateSvc("StoreGateSvc")
ServiceMgr.StoreGateSvc.Dump = True

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
outStream = AthenaPoolOutputStream("OverlayOutputStream")
outStream.Store = ServiceMgr.StoreGateSvc

# Stream's output file
outStream.OutputFile = "InDetOverlayOut.pool.root"

#FIXME: ### FIXME: this does not work because I and O stores are separate.
#FIXME: # Copy everything from the input and must force reading of all input
#FIXME: # objects
#FIXME: #outStream.ForceRead          = True
#FIXME: #outStream.TakeItemsFromInput = True  # Need to set this to False if an explicit list is to be used

# Can use an explicit list to avoid broken classes. Requires TakeItemsFromInput=False.

outStream.ItemList = []
Example #16
0
    pass
theApp.EvtMax = EVTMAX

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------

## schedule a noop algorithm: it just print where it is
from PerfMonTests.PerfMonTestsConf import PerfMonTest__NoopAlg
topSequence += PerfMonTest__NoopAlg( "NoopAlg" )

#---------------------------------------------------------------
# Pool Persistency
#---------------------------------------------------------------
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
outStream = AthenaPoolOutputStream("OutStream", noTag=True)
outStream.ItemList  = [ "EventInfo#McEventInfo"]

if not 'OUTPUT' in dir():
  OUTPUT = "my.data.pool"
  pass
outStream.OutputFile = OUTPUT

## somehow better configure the AthenaPoolCnvSvc for our small
## persistency output job

svcMgr.MessageSvc.OutputLevel = ERROR
#==============================================================
#
# End of job options file
#
Example #17
0
from AthenaPoolTest.AthenaPoolTestConf import EventInfoWriter
topSequence += EventInfoWriter("EventInfoWriter")

#--------------------------------------------------------------
# Input options
#--------------------------------------------------------------

# ItemList:
include("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")

printfunc(fullItemList)

# Run OutputStream as an algorithm
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream("Stream1",
                                 "SimplePoolFile3.root",
                                 asAlg=True,
                                 noTag=True)

# List of DO's to write out
Stream1.ItemList += fullItemList

#--------------------------------------------------------------
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
#--------------------------------------------------------------
svcMgr.MessageSvc.OutputLevel = INFO
svcMgr.MessageSvc.debugLimit = 100000

from AthenaServices import AthenaServicesConf
AthenaEventLoopMgr = AthenaServicesConf.AthenaEventLoopMgr()
AthenaEventLoopMgr.OutputLevel = INFO
Example #18
0
#Explicitly specify the output file catalog
from PoolSvc.PoolSvcConf import PoolSvc
svcMgr += PoolSvc()
svcMgr.PoolSvc.WriteCatalog = "xmlcatalog_file:Catalog1.xml"

from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
svcMgr += AthenaPoolCnvSvc()
svcMgr.AthenaPoolCnvSvc.CommitInterval = 10;

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
# Load "user algorithm" top algorithms to be run, and the libraries that house them

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream( "Stream1" , "SimplePoolReplica1.root" , True )
Stream1.ItemList += [ "ExampleHitContainer#MyHits" ]
Stream1.ExtendProvenanceRecord = FALSE;
Stream1.ForceRead = True
#Stream1.PersToPers = True

#--------------------------------------------------------------
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL)
#--------------------------------------------------------------
svcMgr.MessageSvc.OutputLevel = 3

svcMgr.EventSelector.OutputLevel = 2
svcMgr.AthenaPoolAddressProviderSvc.OutputLevel = 2
svcMgr.PoolSvc.OutputLevel = 2 
svcMgr.AthenaPoolCnvSvc.OutputLevel = 2
Stream1.OutputLevel = 2
#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration

#############################
## basic jobO configuration
include("PATJobTransforms/CommonSkeletonJobOptions.py")
## load pool support
import AthenaPoolCnvSvc.ReadAthenaPool
import AthenaPoolCnvSvc.WriteAthenaPool

## input
ServiceMgr.EventSelector.InputCollections = runArgs.inputEVNTFile

## output stream
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream

outStream = AthenaPoolOutputStream("StreamEVGEN", runArgs.outputEVNT_MRGFile)

# Pre-exec
if hasattr(runArgs,"preExec"):
    recoLog.info("transform pre-exec")
    for cmd in runArgs.preExec:
        recoLog.info(cmd)
        exec(cmd)

## Pre-include
if hasattr(runArgs,"preInclude"): 
    for fragment in runArgs.preInclude:
        print "preInclude",fragment
        include(fragment)

Example #20
0
    # --- load writing BS file
    include("InDetRawDataByteStreamCnv/PixelWriteBS_jobOptions.py")

# ------------------------------------------------------------
# persistency
# ------------------------------------------------------------

if doWriteESD or doWriteAOD or ('doCopyRDO' in dir() and doCopyRDO):
    # --- load setup
    from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
    # --- check dictionary
    ServiceMgr.AthenaSealSvc.CheckDictionary = True

    if doWriteESD:
        # --- create stream
        StreamESD = AthenaPoolOutputStream("StreamESD")
        StreamESD.OutputFile = "InDetRecESD.root"
        # --- save MC collection if truth turned on
        if InDetFlags.doTruth():
            StreamESD.ItemList += ["McEventCollection#*"]
        # ---- load list of objects
        include("InDetRecExample/WriteInDetESD.py")

    if doWriteAOD:
        # --- create stream
        StreamAOD = AthenaPoolOutputStream("StreamAOD")
        StreamAOD.OutputFile = "InDetRecAOD.root"
        # --- save MC collection if truth turned on
        if InDetFlags.doTruth():
            StreamAOD.ItemList += ["McEventCollection#*"]
        # --- load list of objects
Example #21
0
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

include.block('EventOverlayJobTransforms/OverlayOutput_jobOptions.py')

from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
from OverlayCommonAlgs.OverlayFlags import overlayFlags

outStream = AthenaPoolOutputStream('StreamRDO',
                                   athenaCommonFlags.PoolRDOOutput(),
                                   asAlg=True)
outStream.ItemList = []

# Event info
outStream.ItemList += [
    'xAOD::EventInfo#EventInfo', 'xAOD::EventAuxInfo#EventInfoAux.'
]

# Timings
outStream.ItemList += ['RecoTimingObj#EVNTtoHITS_timings']
if not overlayFlags.isDataOverlay():
    outStream.ItemList += ['RecoTimingObj#HITStoRDO_timings']

# Truth
if DetFlags.overlay.Truth_on():
    outStream.ItemList += ['McEventCollection#TruthEvent']

    if 'TrackRecordCollection' in overlayFlags.optionalContainerMap():
        for collection in overlayFlags.optionalContainerMap(
        )['TrackRecordCollection']:
Example #22
0
    include("EvgenJobTransforms/Generate_TruthJets.py")

## Configure POOL streaming to the output EVNT format file
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
#from PoolSvc.PoolSvcConf import PoolSvc
svcMgr.AthenaPoolCnvSvc.CommitInterval = 10 #< tweak for MC needs
if hasattr(runArgs, "outputEVNTFile"):
  poolFile = runArgs.outputEVNTFile
elif hasattr(runArgs, "outputEVNT_PreFile"):
  poolFile = runArgs.outputEVNT_PreFile
else:
  raise RuntimeError("Output pool file, either EVNT or EVNT_Pre, is not known.")

#StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", runArgs.outputEVNTFile)
StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", poolFile)

StreamEVGEN.ForceRead = True
StreamEVGEN.ItemList += ["EventInfo#*", "McEventCollection#*"]
StreamEVGEN.RequireAlgs += ["EvgenFilterSeq"]
## Used for pile-up (remove dynamic variables except flavour labels)
if evgenConfig.saveJets:
    StreamEVGEN.ItemList += ["xAOD::JetContainer_v1#*"]
    StreamEVGEN.ItemList += ["xAOD::JetAuxContainer_v1#*.TruthLabelID.PartonTruthLabelID"]

# Remove any requested items from the ItemList so as not to write out
for removeItem in evgenConfig.doNotSaveItems: StreamEVGEN.ItemList.remove( removeItem )

# Allow (re-)addition to the output stream
for addItem in evgenConfig.extraSaveItems: StreamEVGEN.ItemList += [ addItem ]
Example #23
0
        RDOFilePeeker(runArgs, ftkLog)  # not sure what it does
        # enable the detector flag
        from AthenaCommon.DetFlags import DetFlags
        DetFlags.all_setOn()
        DetFlags.ALFA_setOff()
        DetFlags.ZDC_setOff()
        # other services
        from AthenaCommon.AppMgr import ServiceMgr
        from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
        ServiceMgr += AthenaPoolCnvSvc()
        import AthenaPoolCnvSvc.ReadAthenaPool
        ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput(
        )
        # Add the FTK collections to the RDO
        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
        StreamRDO = AthenaPoolOutputStream("StreamRDO",
                                           runArgs.outputRDO_FTKFile)
        #StreamRDO.TakeItemsFromInput=True
        StreamRDO.ForceRead = TRUE
        StreamRDO.ItemList += ["FTK_RawTrackContainer#*"]
    else:
        # generate RDO file from scratch, this represents an RDO
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        StreamRDO = MSMgr.NewPoolStream("StreamRDO", runArgs.outputRDO_FTKFile)
        StreamRDO.AddItem(["FTK_RawTrackContainer#*"])
        StreamRDO.AddItem(["TrigInDetTrackCollection#*"])
else:
    ftkLog.error('No output file for merge given')
    raise RuntimeError, 'No output file for merge given'
alg += FTKMerger
Example #24
0
    print "Reading from file"

SkipEvents = 0
if hasattr(runArgs, "skipEvents"):
    SkipEvents = runArgs.skipEvents
ServiceMgr.EventSelector.SkipEvents = SkipEvents

#--------------------------------------------------------------
# Setup Output
#--------------------------------------------------------------
if not hasattr(runArgs, "outputHITS_MRGFile"):
    raise RuntimeError("No outputHITS_MRGFile provided.")
Out = runArgs.outputHITS_MRGFile
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
try:
    StreamHITS = AthenaPoolOutputStream("StreamHITS", Out, True)
except:
    StreamHITS = AthenaPoolOutputStream("StreamHITS",
                                        "DidNotSetOutputName.root", True)
StreamHITS.TakeItemsFromInput = TRUE
StreamHITS.ForceRead = TRUE
#force read of output data objs
# The next line is an example on how to exclude clid's if they are causing a  problem
#StreamHITS.ExcludeList = ['6421#*']

# Look for lists of filter algorithms
try:
    StreamHITS.AcceptAlgs = AcceptList
except:
    print "No accept algs indicated in AcceptList"
try:
svcMgr.AthenaPoolCnvSvc.CommitInterval = 10;

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
# Load "user algorithm" top algorithms to be run, and the libraries that house them
from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__WriteData
topSequence += AthPoolEx__WriteData("WriteData")

from AthenaPoolExampleAlgorithms.AthenaPoolExampleAlgorithmsConf import AthPoolEx__WriteTag
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" ]
Example #26
0
topSequence += AthPoolEx__WriteData("WriteData")

#Explicitly specify the output file catalog
from PoolSvc.PoolSvcConf import PoolSvc
svcMgr += PoolSvc()
svcMgr.PoolSvc.WriteCatalog = "xmlcatalog_file:SplittableData.xml"

from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
svcMgr += AthenaPoolCnvSvc()
svcMgr.AthenaPoolCnvSvc.CommitInterval = 10

include("AthenaPoolMultiTest/ExampleStreamConfig.py")

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
DataStream = AthenaPoolOutputStream("DataStream",
                                    "AthenaPoolMultiTest_Splittable0.root",
                                    True)
DataStream.ItemList = exampleItemList  # comes from ExampleStreamConfig
DataStream.ItemList += ["FauxTriggerMap#*"]  # add item not in StreamConfig
DataStream.MetadataItemList += exampleMetadataList
DataStream.AcceptAlgs = ["PassAllFilter"]
DataStream.RequireAlgs = ["PassAllFilter"]
DataStream.VetoAlgs = ["PassNoneFilter"]

#--------------------------------------------------------------
# Consequently, should have 3 output files
#    Numbers 3, 4, from PassAll and 1 from Passnone
#--------------------------------------------------------------
#
#  Now configure output collection
#
from TruthExamples.TruthExamplesConf import PrintMC
topAlg += PrintMC()
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 10
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
Pythia = topAlg.Pythia
Pythia.PythiaCommand = ["pyinit user madgraph"]


from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream( "StreamEVGEN" )
Stream1.OutputFile = "baur.pool.root"
Stream1.ItemList += [ 'EventInfo#*', 'McEventCollection#*' ]
###############################################################


#
###############################################################
#from AthenaCommon.AppMgr import ServiceMgr
#ServiceMgr.EventSelector.RunNumber = runArgs.runNumber
#ServiceMgr.EventSelector.FirstEvent = runArgs.firstEvent
#----------------------------------------------------------------
# Ntuple service output
#----------------------------------------------------------------

#---------------------------------------------------------------
Example #28
0
    def hits_persistency():
        """ HITS POOL file persistency
        """
        from G4AtlasApps.SimFlags import simFlags
        from AthenaCommon.DetFlags import DetFlags
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream

        ## Not yet understood, but need to treat StreamHITS as alg in Hive.
        ## Seems to also work fine outside of Hive, but to be extra safe I'm
        ## only changing it in Hive.
        from AthenaCommon.ConcurrencyFlags import jobproperties as concurrencyProps
        if concurrencyProps.ConcurrencyFlags.NumThreads() > 0:
            as_alg = True
        else:
            as_alg = False
        ## NB. Two-arg constructor is needed, since otherwise metadata writing fails!
        stream1 = AthenaPoolOutputStream("StreamHITS",
                                         athenaCommonFlags.PoolHitsOutput(),
                                         asAlg=as_alg)

        ## Write geometry tag info - move to main method
        #import EventInfoMgt.EventInfoMgtInit

        ## EventInfo & TruthEvent always written by default
        stream1.ForceRead = True
        stream1.ItemList = [
            "EventInfo#*", "McEventCollection#TruthEvent", "JetCollection#*"
        ]

        ## If we are running quasi-stable particle simulation, include the original event record
        if hasattr(
                simFlags, 'IncludeParentsInG4Event'
        ) and simFlags.IncludeParentsInG4Event.statusOn and simFlags.IncludeParentsInG4Event(
        ):
            stream1.ItemList += ["McEventCollection#GEN_EVENT"]

        stream1.ItemList += ["xAOD::JetContainer#*", "xAOD::JetAuxContainer#*"]

        ## Make stream aware of aborted events
        stream1.AcceptAlgs = ["G4AtlasAlg"]

        ## Detectors

        ## Inner Detector
        if DetFlags.ID_on():
            stream1.ItemList += [
                "SiHitCollection#*", "TRTUncompressedHitCollection#*",
                "TrackRecordCollection#CaloEntryLayer"
            ]
        ## Calo
        if DetFlags.Calo_on():
            stream1.ItemList += [
                "CaloCalibrationHitContainer#*",
                "LArHitContainer#*",
                "TileHitVector#*",
                #"SimpleScintillatorHitCollection#*",
                "TrackRecordCollection#MuonEntryLayer"
            ]
        ## Muon
        if DetFlags.Muon_on():
            stream1.ItemList += [
                "RPCSimHitCollection#*", "TGCSimHitCollection#*",
                "CSCSimHitCollection#*", "MDTSimHitCollection#*",
                "TrackRecordCollection#MuonExitLayer"
            ]
            if hasattr(simFlags, 'SimulateNewSmallWheel'):
                if simFlags.SimulateNewSmallWheel():
                    stream1.ItemList += ["GenericMuonSimHitCollection#*"]
        ## Lucid
        if DetFlags.Lucid_on():
            stream1.ItemList += ["LUCID_SimHitCollection#*"]

        ## FwdRegion
        if DetFlags.FwdRegion_on():
            stream1.ItemList += ["SimulationHitCollection#*"]

        ## ZDC
        if DetFlags.ZDC_on():
            stream1.ItemList += [
                "ZDC_SimPixelHit_Collection#*", "ZDC_SimStripHit_Collection#*"
            ]
        ## ALFA
        if DetFlags.ALFA_on():
            stream1.ItemList += [
                "ALFA_HitCollection#*", "ALFA_ODHitCollection#*"
            ]

        ## AFP
        if DetFlags.AFP_on():
            stream1.ItemList += [
                "AFP_TDSimHitCollection#*", "AFP_SIDSimHitCollection#*"
            ]

        ### Ancillary scintillators
        #stream1.ItemList += ["ScintillatorHitCollection#*"]

        ## TimingAlg
        stream1.ItemList += ["RecoTimingObj#EVNTtoHITS_timings"]

        ## Add cosmics and test beam configuration hit persistency if required cf. geom tag
        layout = simFlags.SimLayout.get_Value()
        if "tb" not in layout:
            from AthenaCommon.BeamFlags import jobproperties
            if jobproperties.Beam.beamType() == 'cosmics' or \
                    (hasattr(simFlags, "WriteTR") and simFlags.WriteTR.statusOn) or \
                    (hasattr(simFlags, "ReadTR") and simFlags.ReadTR.statusOn):
                stream1.ItemList += [
                    "TrackRecordCollection#CosmicRecord",
                    "TrackRecordCollection#CosmicPerigee"
                ]
        else:
            ## CTB-specific
            if layout.startswith("ctb"):
                if simFlags.LArFarUpstreamMaterial.statusOn and simFlags.LArFarUpstreamMaterial.get_Value(
                ):
                    stream1.ItemList.append(
                        "TrackRecordCollection#LArFarUpstreamMaterialExitLayer"
                    )
            ## Persistency of test-beam layout
            if layout.startswith('ctb') or layout.startswith('tb_Tile2000_'):
                stream1.ItemList += ["TBElementContainer#*"]
Example #29
0
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc

## add the material step recording action
SimFlags.OptionalUserActionList.addAction('G4UA::MaterialStepRecorderTool',
                                          ['Run', 'Event', 'Step'])

############### The Material hit collection ##################

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
# --- check dictionary
ServiceMgr.AthenaSealSvc.CheckDictionary = True
# --- commit interval (test)
ServiceMgr.AthenaPoolCnvSvc.OutputLevel = DEBUG
ServiceMgr.AthenaPoolCnvSvc.CommitInterval = 10
MaterialStream = AthenaPoolOutputStream('MaterialStream')
MaterialStream.OutputFile = "MaterialStepFile.root"
MaterialStream.ItemList += ['Trk::MaterialStepCollection#*']

##############################################################

include("G4AtlasApps/G4Atlas.flat.configuration.py")

# Add the beam effects algorithm
from AthenaCommon.CfgGetter import getAlgorithm
topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True)

## Populate alg sequence
topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)

#--- End jobOptions.GeantinoMapping.py file  ------------------------------
Example #30
0
        TUPLEFILENAME = 'mc.aod.root'
        pass
    from McParticleTools.McParticleToolsConf import McAodTupleWriterTool
    from McParticleAlgs.McParticleAlgsConf   import McAodTupleWriter
    topSequence += McAodTupleWriter(
        McWriter = McAodTupleWriterTool( TruthParticles = "SpclMC",
                                         Output         = TUPLEFILENAME ),
        OutputLevel = DEBUG
        )
    pass
   
#---------------------------------------------------------------
# Pool Persistency
#---------------------------------------------------------------
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
outStream = AthenaPoolOutputStream("StreamAOD", noTag=True)
outStream.ItemList  = [ "EventInfo#McEventInfo" ]
outStream.ItemList += [ "McEventCollection#GEN_EVENT" ]
outStream.ItemList += [ "McEventCollection#GEN_AOD" ]
outStream.ItemList += [ "TruthParticleContainer#SpclMC" ]
outStream.ItemList += [ "TruthEtIsolationsContainer#TruthEtIsol_GEN_EVENT" ]
outStream.ItemList += [ "TruthEtIsolationsContainer#TruthEtIsol_GEN_AOD" ]

if 'OUTPUT' not in dir():
  OUTPUT = "mc.aod.pool"
  pass
outStream.OutputFile = OUTPUT

svcMgr.MessageSvc.defaultLimit = 4000000
svcMgr.MessageSvc.OutputLevel  = ERROR