8 mlog = logging.getLogger(
'EventDisplays' )
12 mlog.debug(
"Trying to read magnetic field configuration from partition %s", partition)
17 ipcPart = IPCPartition(partition)
18 if not ipcPart.isValid():
19 raise UserWarning(
"Partition %s invalid - cannot access magnetic field setting"%partition)
21 toroidCurrent = ISObject(ipcPart,
'DCS_GENERAL.MagnetToroidsCurrent.value',
'DdcFloatInfo')
22 solenoidCurrent = ISObject(ipcPart,
'DCS_GENERAL.MagnetSolenoidCurrent.value',
'DdcFloatInfo')
23 toroidInvalid = ISObject(ipcPart,
'DCS_GENERAL.MagnetToroidsCurrent.invalid',
'DdcIntInfo')
24 solenoidInvalid = ISObject(ipcPart,
'DCS_GENERAL.MagnetSolenoidCurrent.invalid',
'DdcIntInfo')
25 toroidCurrent.checkout()
26 solenoidCurrent.checkout()
27 toroidInvalid.checkout()
28 solenoidInvalid.checkout()
30 solenoidOn=((solenoidCurrent.value > 1000.)
and (solenoidInvalid.value == 0))
31 toroidOn=((toroidCurrent.value > 1000.)
and (toroidInvalid.value == 0))
32 except UserWarning
as err:
35 mlog.fatal(
"Failed to read magnetic field configuration from IS, aborting")
39 mlog.info(
"Magnetic field in solenoid is %s", (solenoidOn
and "ON")
or "OFF")
40 mlog.info(
"Magnetic field in toroid is %s", (toroidOn
and "ON")
or "OFF")
43 return (solenoidOn,toroidOn)