Exemplo n.º 1
0
    "MuCTPI_RIO/MUCTPI_RIO", "CTP_RIO/CTP_RIO"
]

#-------------------------------------------------------------------------------

########################################
#
#  Define output
#
########################################

#athenaCommonFlags.BSRDOOutput = _o # Expected to be set elsewhere
from ByteStreamCnvSvc import WriteByteStream
StreamBSFileOutput = WriteByteStream.getStream("EventStorage",
                                               "StreamBSFileOutput")
StreamBSFileOutput.OutputFile = athenaCommonFlags.BSRDOOutput()
ServiceMgr.ByteStreamCnvSvc.IsSimulation = True

### # Taken from storegate dump
### StreamBSFileOutput.ItemList += [ "CTP_RDO#*" ]
### #StreamBSFileOutput.ItemList += [ "CTP_RIO#*" ] # No RIO
### #StreamBSFileOutput.ItemList += [ "CscDigitContainer#*" ] # Not relevant
### #StreamBSFileOutput.ItemList += [ "CscRawDataContainer#*" ] # Not relevant
### #StreamBSFileOutput.ItemList += [ "DataHeader#*" ] # Not relevant
### #StreamBSFileOutput.ItemList += [ "DataVector< LVL1::RecEnergyRoI >#*" ] # No converter
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CMMCPHits>#*" ]
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CMMEtSums>#*" ]
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CMMJetHits>#*" ]
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CPMHits>#*" ]
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CPMRoI>#CPMRoIs" ] # Chosen by data address
### StreamBSFileOutput.ItemList += [ "DataVector<LVL1::CPMTower>#CPMTowers" ] # Chosen by data address
Exemplo n.º 2
0
def getStream(type, name):
    # globals in this module
    global svcMgr
    global _streamMap

    # type check
    type = type.upper()
    if type not in ['EVENTSTORAGE', 'TRANSIENT']:
        raise RuntimeError("unsupported StreamType:%s" % type)

    # return existing stream
    if (type, name) in _streamMap:
        return _streamMap[(type, name)]

    # EventStorage
    if type == 'EVENTSTORAGE':
        # OutputSvc
        if not hasattr(svcMgr, "ByteStreamEventStorageOutputSvc"):
            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamEventStorageOutputSvc
            svcMgr += ByteStreamEventStorageOutputSvc()

        # Properties
        ByteStreamCnvSvc = svcMgr.ByteStreamCnvSvc
        ByteStreamCnvSvc.ByteStreamOutputSvcList += [
            "ByteStreamEventStorageOutputSvc"
        ]

        # OutputStream
        from AthenaServices.AthenaServicesConf import AthenaOutputStream
        StreamBS = AthenaOutputStream(
            name,
            EvtConversionSvc="ByteStreamCnvSvc",
            OutputFile="ByteStreamEventStorageOutputSvc",
        )
        theApp.addOutputStream(StreamBS)
        theApp.OutStreamType = "AthenaOutputStream"

        # Define the output as follows:
        ByteStreamEventStorageOutputSvc = svcMgr.ByteStreamEventStorageOutputSvc

        ByteStreamEventStorageOutputSvc.MaxFileMB = 15000
        # maximum number of event (beyond which it creates a new file)
        ByteStreamEventStorageOutputSvc.MaxFileNE = 15000000
        ByteStreamEventStorageOutputSvc.OutputDirectory = "./"
        ByteStreamEventStorageOutputSvc.AppName = "Athena"
        # release variable depends the way the env is configured
        #svcMgr.ByteStreamEventStorageOutputSvc.FileTag = release
        svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = 0
        # does not work
        if hasattr(svcMgr.EventSelector, 'RunNumber'):
            svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = svcMgr.EventSelector.RunNumber

        # decode BSRDOOutput property and overwrite some OutputStream properties if things are there defined
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        props = athenaCommonFlags.BSRDOOutput().split(",")
        if len(props) > 1:
            for p in props:
                if "AppName" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.AppName = p.split(
                        "=")[1]
                if "OutputDirectory" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.OutputDirectory = p.split(
                        "=")[1]
                if "FileTag" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.FileTag = p.split(
                        "=")[1]
                if "Run" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = int(
                        p.split("=")[1])
        else:
            svcMgr.ByteStreamEventStorageOutputSvc.SimpleFileName = athenaCommonFlags.BSRDOOutput(
            )
        # append
        _streamMap[(type, name)] = StreamBS
        return StreamBS

    elif type == 'TRANSIENT':
        # OutputSvc
        if not hasattr(svcMgr, "ROBDataProviderSvc"):
            from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ROBDataProviderSvc
            svcMgr += ROBDataProviderSvc()
        if not hasattr(svcMgr, "ByteStreamRDP_OutputSvc"):
            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamRDP_OutputSvc
            svcMgr += ByteStreamRDP_OutputSvc()

        # Properties
        ByteStreamCnvSvc = svcMgr.ByteStreamCnvSvc
        ByteStreamCnvSvc.ByteStreamOutputSvcList += ["ByteStreamRDP_OutputSvc"]

        # This output stream is created as a regular OutputStream
        from AthenaServices.AthenaServicesConf import AthenaOutputStream
        StreamBS = AthenaOutputStream(
            name,
            EvtConversionSvc="ByteStreamCnvSvc",
            OutputFile="ByteStreamRDP_OutputSvc",
        )
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += StreamBS

        # ByteStreamCnvSvc is an input CnvSvc now.
        EventPersistencySvc = svcMgr.EventPersistencySvc
        EventPersistencySvc.CnvServices += ["ByteStreamCnvSvc"]

        # append
        _streamMap[(type, name)] = StreamBS
        return StreamBS

    else:
        raise RuntimeError("unsupported StreamType:%s" % type)