Example #1
0
def loadOldCLHEPStreamers():
    """
    Helper method to load and configure the AthenaRootStreamerSvc to be able
    to read Old CLHEP classes (v1.8)
    """
    from AthenaCommon.Logging import logging
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon import CfgMgr

    msg = logging.getLogger('loadOldCLHEPStreamers')
    msg.debug("Loading Old CLHEP streamers...")

    # ROOT streaming service
    if not hasattr(svcMgr, 'AthenaRootStreamerSvc'):
        svcMgr += CfgMgr.AthenaRootStreamerSvc()
    streamerSvc = svcMgr.AthenaRootStreamerSvc

    # active ROOT streamers list
    streamerSvc.Streamers += ["CLHEPVec3dStreamer"]
    streamerSvc.Streamers += ["CLHEPPoint3dStreamer"]
    streamerSvc.Streamers += ["CLHEPRotationStreamer"]
    streamerSvc.Streamers += ["CLHEPGenMatrixStreamer"]
    streamerSvc.Streamers += ["CLHEPMatrixStreamer"]
    streamerSvc.Streamers += ["CLHEPLorVecStreamer"]
    streamerSvc.Streamers += ["CLHEPTransform3DStreamer"]
    streamerSvc.Streamers += ["CLHEP3VectorStreamer"]
    streamerSvc.Streamers += ["CLHEPBasicVectorStreamer"]

    msg.debug("Loading Old CLHEP streamers... [DONE]")
    return
def _loadBasicAthenaRoot():
    """Loads the basic services for AthenaRoot"""

    from AthenaCommon import CfgMgr
    ## make sure we have been -at least- minimally correctly configured
    import AthenaCommon.AtlasUnixStandardJob

    from AthenaCommon.Logging import logging
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr

    msg = logging.getLogger('loadBasicAthenaRoot')
    msg.debug("Loading basic services for AthenaRoot...")

    svcMgr += CfgMgr.Athena__RootSvc("AthenaRootSvc")
    svcMgr += CfgMgr.Athena__RootCnvSvc("AthenaRootCnvSvc")

    from AthenaCommon.AppMgr import theApp

    if not hasattr(svcMgr, 'EventPersistencySvc'):
        svcMgr += CfgMgr.EvtPersistencySvc("EventPersistencySvc")
        svcMgr.EventPersistencySvc.CnvServices += ["AthenaRootCnvSvc"]
    if not hasattr(svcMgr, 'ProxyProviderSvc'):
        svcMgr += CfgMgr.ProxyProviderSvc()

    #
    # Make sure AthenaSealSvc is loaded for dict check
    svcMgr += CfgMgr.AthenaSealSvc()

    #
    # Make sure AthenaPoolServices is loaded for custom streamer
    try:
        svcMgr += CfgMgr.AthenaRootStreamerSvc()
    except TypeError:
        msg.info("could not load AthenaRootStreamerSvc")
        pass

    # Load streamer allowing conversion of old CLHEP classes
    try:
        import AtlasSealCLHEP.OldCLHEPStreamers
    except ImportError:
        msg.info("could not load AtlasSealCLHEP")
        pass

    if not hasattr(svcMgr, 'InputMetaDataStore'):
        svcMgr += CfgMgr.StoreGateSvc("InputMetaDataStore")
        pass

    if not hasattr(svcMgr, 'MetaDataStore'):
        svcMgr += CfgMgr.StoreGateSvc("MetaDataStore")
        pass

    msg.debug("Loading basic services for AthenaRoot... [DONE]")
    return