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)
def GetRunType(): """Get the run type by reading the run-type setting in the partition from IS """ #Get a logger so we can show formated messages from AthenaCommon.Logging import logging mlog = logging.getLogger('EventDisplays') #Try to get the partition name try: import os partition = os.environ['TDAQ_PARTITION'] except KeyError: partition = "EventDisplays" mlog.warning( "TDAQ_PARTITION not defined in environment, using %s as default" % partition) mlog.debug('Probing partition %s for RunType' % partition) #now try and read the information from IS try: from ipc import IPCPartition from ispy import ISObject runparams = ISObject(IPCPartition(partition), 'RunParams.RunParams', 'RunParams') runparams.checkout() runType = runparams.run_type except UserWarning, err: mlog.error(err) #Set the default runtype runType = "collisions" mlog.warning("Failed to read run type from IS, using %s as default" % runType)
def initialize(self): incidentSvc = PyAthena.py_svc('IncidentSvc', iface='IIncidentSvc') incidentSvc.addListener(self, 'BeginEvent') incidentSvc.addListener(self, 'StoreCleared') self.partition = IPCPartition('ATLAS') self.dict = ISInfoDictionary(self.partition) self.DQMgid = grp.getgrnam("DQM").gr_gid return StatusCode.Success
def execute(self): if self.checkrun: try: eventInfo = PyEventTools.getEventInfo("") except LookupError as err: self.msg.warning("Could not retrieve EventInfo: %s", err) self.setFilterPassed(False) try: partition = IPCPartition("ATLAS") dictionary = ISInfoDictionary(partition) readyForPhysics = ISInfoAny() dictionary.getValue("RunParams.Ready4Physics", readyForPhysics) ready = readyForPhysics.get() runParams = ISObject(partition, 'RunParams.RunParams', 'RunParams') runParams.checkout() except UserWarning as err: self.msg.warning("Could not retrieve data from IS: %s", err) self.setFilterPassed(False) time.sleep(5) self.msg.debug( "IS publishes T0_project_tag %s and readyForPhysics %s for run %d", runParams.T0_project_tag, ready, runParams.run_number) if self.checkready and not ready: self.msg.info("ReadyForPhysics not set... rejecting event") self.setFilterPassed(False) time.sleep(1) elif runParams.T0_project_tag != self.t0project: self.msg.info("T0_project_tag is not %s (%s)... rejecting event", self.t0project, runParams.T0_project_tag) self.setFilterPassed(False) time.sleep(1) elif self.checkrun and runParams.run_number != eventInfo.event_ID( ).run_number(): self.msg.info( "Information in IS is not for this run (%d != %d)... rejecting event", runParams.run_number, eventInfo.event_ID().run_number()) self.setFilterPassed(False) else: self.msg.info("Good event, passing into the public stream...") self.setFilterPassed(True) return StatusCode.Success
# Define the input 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
from ipc import IPCPartition from ispy import ISObject p2 = ispy.IPCPartition(partitionName) obj = ispy.ISObject(p2, 'RunParams.RunParams', 'RunParams') obj.checkout() is_T0_project_tag = obj.T0_project_tag is_run_number = obj.run_number is_beam_type = obj.beam_type logRecExOnline_globalconfig.info("is_run_number = %s" % is_run_number) logRecExOnline_globalconfig.info("is_beam_type = %s" % is_beam_type) logRecExOnline_globalconfig.info("is_T0_project_tag = %s" % is_T0_project_tag) part_name = 'initial' p = IPCPartition(part_name) toroidCurrent = 0 toroidInvalid = 1 solenoidCurrent = 0 solenoidInvalid = 1 # AL playing around: start #toroidCurrent = ispy.ISInfoDynAny(p2, 'DdcFloatInfo') #solenoidCurrent = ispy.ISInfoDynAny(p2, 'DdcFloatInfo') #toroidInvalid = ispy.ISInfoDynAny(p2, 'DdcIntInfo') #solenoidInvalid = ispy.ISInfoDynAny(p2, 'DdcIntInfo') solenoidCurrent = ISObject(p, 'DCS_GENERAL.MagnetSolenoidCurrent.value', 'DdcFloatInfo') solenoidCurrent.checkout() toroidCurrent = ISObject(p, 'DCS_GENERAL.MagnetToroidsCurrent.value', 'DdcFloatInfo')