Esempio n. 1
0
def GetBFields():

    #Get a logger so we can show formated messages
    from AthenaCommon.Logging import logging
    mlog = logging.getLogger('EventDisplays')

    #BFields are read from initial partition
    partition = 'initial'
    mlog.debug(
        "Trying to read magnetic field configuration from partition %s" %
        partition)

    #now try and read the information from IS
    try:
        from ipc import IPCPartition
        from ispy import ISObject
        #Get hold of the initial partition
        ipcPart = IPCPartition(partition)
        if not ipcPart.isValid():
            raise UserWarning(
                "Partition %s invalid - cannot access magnetic field setting" %
                partition)
        #Get the current and valid status
        toroidCurrent = ISObject(ipcPart,
                                 'DCS_GENERAL.MagnetToroidsCurrent.value',
                                 'DdcFloatInfo')
        solenoidCurrent = ISObject(ipcPart,
                                   'DCS_GENERAL.MagnetSolenoidCurrent.value',
                                   'DdcFloatInfo')
        toroidInvalid = ISObject(ipcPart,
                                 'DCS_GENERAL.MagnetToroidsCurrent.invalid',
                                 'DdcIntInfo')
        solenoidInvalid = ISObject(
            ipcPart, 'DCS_GENERAL.MagnetSolenoidCurrent.invalid', 'DdcIntInfo')
        toroidCurrent.checkout()
        solenoidCurrent.checkout()
        toroidInvalid.checkout()
        solenoidInvalid.checkout()
        #And calculate the flags
        solenoidOn = ((solenoidCurrent.value > 1000.)
                      and (solenoidInvalid.value == 0))
        toroidOn = ((toroidCurrent.value > 1000.)
                    and (toroidInvalid.value == 0))
    except UserWarning, err:
        mlog.error(err)
        #Should always be able to access initial parititon
        mlog.fatal(
            "Failed to read magnetic field configuration from IS, aborting")
        import sys
        sys.exit(1)
Esempio n. 2
0
ByteStreamEmonInputSvc = svcMgr.ByteStreamInputSvc

# ############################################################
# The name of the partition you want to connect to is taken
# from 'TDAQ_PARTITION' if it exists, otherwise from here.
# ############################################################

if 'Partition' not in dir():
    Partition="ATLAS"
ByteStreamEmonInputSvc.Partition = Partition

from ipc import IPCPartition
from ispy import ISObject
ipc_partition = IPCPartition(Partition);

if not ipc_partition.isValid():
    tilemon_log.error( 'Partition: ' + ipc_partition.name() + ' is not valid' )
    sys.exit(1)

### ATLAS partition: Read Global Run Parameters to configure the jobs
if ByteStreamEmonInputSvc.Partition == 'ATLAS':
    try:
        run_params = ISObject(ipc_partition, 'RunParams.SOR_RunParams', 'RunParams')
    except:
        tilemon_log.warning( "Could not find Run Parameters in IS - Set default beam type to 'cosmics'")
        beamType = 'cosmics'
    else:
        run_params.checkout()
        beam_type = run_params.beam_type
        beam_energy = run_params.beam_energy
        RunNumber = run_params.run_number