2 from ispy
import ISObject, IPCPartition
4 from AthenaCommon.Logging
import logging
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)
47 mlog = logging.getLogger(
'EventDisplays' )
49 while not partitionUp:
51 partition = IPCPartition(partitionName)
52 runParams = ISObject(partition,
"RunParams.RunParams",
"RunParams")
57 mlog.info(
"%s partition is not up, sleeping for 30 seconds", partitionName)
61 mlog = logging.getLogger(
'EventDisplays, Ready4Physics' )
63 partition = IPCPartition(
'ATLAS')
64 physicsReady = ISObject(partition,
'RunParams.Ready4Physics',
'Ready4PhysicsInfo')
65 physicsReady.checkout()
66 return bool(physicsReady.ready4physics)
69 mlog.warning(
'Failed to get physicsReady bool, this is expected for offline test and GM test paritions')
74 mlog = logging.getLogger(
'EventDisplays' )
76 partition = IPCPartition(
'ATLAS')
77 RunParams = ISObject(partition,
'RunParams.RunParams',
'RunParams')
80 physicsReady = ISObject(partition,
'RunParams.Ready4Physics',
'Ready4PhysicsInfo')
81 physicsReady.checkout()
83 sendToPublicStream =
False
84 if physicsReady.ready4physics
and RunParams.T0_project_tag
in projectTags:
85 sendToPublicStream =
True
87 return sendToPublicStream
90 mlog.warning(
'Failed to get bool for EventCanBeSeenByPublic, this is expected for offline test and GM test paritions')
96 jobId = os.environ.get(
'TDAQ_APPLICATION_NAME',
'').
split(
':')
97 if not len(jobId) == 5:
98 from random
import randint
99 jobId = [
'Athena-EventProcessor',
'Athena-EventDisplays-Segment',
'EventDisplays-Rack',
'tmp',
'%d' % randint(0, 999)]
104 part = IPCPartition(partitionName)
105 RunParams = ISObject(part,
'RunParams.RunParams',
'RunParams')
107 run_number = RunParams.getAttributeValue(
'run_number')
110 if __name__ ==
"__main__":
112 print (
"RunNumber: %s"%runNumber)
114 print (
"BFields (Sol,Tor):", bFields)
116 print(
"isPublicEvent:", isPublicEvent)