7    from ispy 
import ISObject, IPCPartition
 
    9       r4p = ISObject(IPCPartition(
"ATLAS"), 
'RunParams.Ready4Physics', 
'RunParams')
 
   11       return r4p.ready4physics
 
   13       print (
"#### Failed to determine if we are ready for physics")
 
   17   """Get the run type by reading the run-type setting in the partition from IS """ 
   20   from AthenaCommon.Logging 
import logging
 
   21   mlog = logging.getLogger(
'RecExOnline')
 
   26     partition = os.environ[
'TDAQ_PARTITION']
 
   27     if partition == 
"EventDisplays":
 
   31     mlog.warning(
"TDAQ_PARTITION not defined in environment, using %s as default", partition)
 
   35     from ipc 
import IPCPartition
 
   36     from ispy 
import ISObject
 
   37     ipcPart = IPCPartition(partition)
 
   38     if not ipcPart.isValid():
 
   39       raise UserWarning(
"Partition %s invalid - cannot access run type settings" % partition)
 
   40     runparams = ISObject(ipcPart, 
'RunParams.RunParams', 
'RunParams')
 
   42     beamEnergy = runparams.beam_energy
 
   43     projectTag = runparams.T0_project_tag
 
   44   except UserWarning 
as err:
 
   49   mlog.info(
"Setting project tag to %s", projectTag)
 
   50   return (
None, beamEnergy, projectTag) 
 
   54   from AthenaCommon.Logging 
import logging
 
   55   mlog = logging.getLogger(
'RecExOnline')
 
   59   mlog.debug(
"Trying to read magnetic field configuration from partition %s", partition)
 
   63     from ipc 
import IPCPartition
 
   64     ipcPart = IPCPartition(partition)
 
   65     if not ipcPart.isValid():
 
   66       raise UserWarning(
"Partition %s invalid - cannot access magnetic field setting" % partition)
 
   79     torCurrent   = ispy.ISInfoDynAny(ipcPart, 
'DdcFloatInfo')
 
   80     solCurrent   = ispy.ISInfoDynAny(ipcPart, 
'DdcFloatInfo')
 
   81     torInvalid   = ispy.ISInfoDynAny(ipcPart, 
'DdcIntInfo')
 
   82     solInvalid   = ispy.ISInfoDynAny(ipcPart, 
'DdcIntInfo')
 
   88     mlog.info(
"toroidCurrent = %f", torCurrent.value)
 
   89     mlog.info(
"toroidInvalid = %f", torInvalid.value)
 
   90     mlog.info(
"solenoidCurrent = %f", solCurrent.value)
 
   91     mlog.info(
"solenoidInvalid = %f", solInvalid.value)
 
   95     solOn = ((solCurrent.value > 1000.) 
and (solInvalid.value == 0))
 
   96     torOn = ((torCurrent.value > 1000.) 
and (torInvalid.value == 0))
 
   97   except UserWarning 
as err:
 
  100     mlog.fatal(
"Failed to read magnetic field configuration from IS, aborting")
 
  105   mlog.info(
"Magnetic field in solenoid is %s", ((solOn 
and "ON") 
or "OFF"))
 
  106   mlog.info(
"Magnetic field in toroid is %s",   ((torOn 
and "ON") 
or "OFF"))
 
  109   return (solCurrent, torCurrent)
 
  111 if __name__ == 
"__main__":
 
  113   print (
"(BeamType, BeamEnergy, ProjectTag): ", runType)
 
  115   print (
"(SolCurrent, TorCurrent):", (bFields[0].value, bFields[1].value))