ATLAS Offline Software
Functions | Variables
EventDisplaysOnlineHelpers Namespace Reference

Functions

def GetBFields ()
 
def WaitForPartition (partitionName=None)
 
def EventCanBeSeenByPublic (projectTags)
 
def GetUniqueJobID ()
 
def GetRunNumber (partitionName)
 

Variables

def runNumber = GetRunNumber()
 
def bFields = GetBFields()
 
def isPublicEvent = EventCanBeSeenByPublic(['data24_13p6TeV'])
 

Function Documentation

◆ EventCanBeSeenByPublic()

def EventDisplaysOnlineHelpers.EventCanBeSeenByPublic (   projectTags)

Definition at line 60 of file EventDisplaysOnlineHelpers.py.

60 def EventCanBeSeenByPublic(projectTags):
61 # Is the data allowed to be seen by the general public on atlas live and in the CCC
62  mlog = logging.getLogger( 'EventDisplays' )
63  try:
64  partition = IPCPartition('ATLAS')
65  RunParams = ISObject(partition, 'RunParams.RunParams', 'RunParams')
66  RunParams.checkout()
67 
68  ready4physics = ISInfoAny()
69  ISInfoDictionary(partition).getValue('RunParams.Ready4Physics', ready4physics)
70  print("physicsReady: %s " % ready4physics.get())
71 
72  physicsReady = ISObject(partition, 'RunParams.Ready4Physics','Ready4PhysicsInfo')
73  physicsReady.checkout()
74  print("Ready for physics: %r" % (physicsReady.ready4physics))
75  print("RunParams.T0_project_tag", RunParams.T0_project_tag)
76 
77  sendToPublicStream = False
78  if physicsReady.ready4physics and RunParams.T0_project_tag in projectTags:
79  sendToPublicStream = True
80 
81  return sendToPublicStream
82 
83  except Exception:
84  mlog.warning('Failed to get bool for EventCanBeSeenByPublic, this is expected for offline test and GM test paritions')
85  return False
86 

◆ GetBFields()

def EventDisplaysOnlineHelpers.GetBFields ( )

Definition at line 7 of file EventDisplaysOnlineHelpers.py.

7 def GetBFields():
8  mlog = logging.getLogger( 'EventDisplays' )
9 
10  #BFields are read from initial partition
11  partition='initial'
12  mlog.debug("Trying to read magnetic field configuration from partition %s", partition)
13 
14  #now try and read the information from IS
15  try :
16  #Get hold of the initial partition
17  ipcPart = IPCPartition(partition)
18  if not ipcPart.isValid():
19  raise UserWarning("Partition %s invalid - cannot access magnetic field setting"%partition)
20  #Get the current and valid status
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()
29  #And calculate the flags
30  solenoidOn=((solenoidCurrent.value > 1000.) and (solenoidInvalid.value == 0))
31  toroidOn=((toroidCurrent.value > 1000.) and (toroidInvalid.value == 0))
32  except UserWarning as err:
33  mlog.error(err)
34  #Should always be able to access initial parititon
35  mlog.fatal("Failed to read magnetic field configuration from IS, aborting")
36  sys.exit(1)
37 
38  #print the result
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")
41 
42  #finally return our values
43  return (solenoidOn,toroidOn)
44 
45 

◆ GetRunNumber()

def EventDisplaysOnlineHelpers.GetRunNumber (   partitionName)

Definition at line 97 of file EventDisplaysOnlineHelpers.py.

97 def GetRunNumber(partitionName):
98  part = IPCPartition(partitionName)
99  RunParams = ISObject(part, 'RunParams.RunParams', 'RunParams')
100  RunParams.checkout()
101  run_number = RunParams.getAttributeValue('run_number')
102  return run_number
103 

◆ GetUniqueJobID()

def EventDisplaysOnlineHelpers.GetUniqueJobID ( )

Definition at line 87 of file EventDisplaysOnlineHelpers.py.

87 def GetUniqueJobID():
88  # Setup unique output files (so that multiple Athena jobs on the same machine don't interfere)
89  import os
90  jobId = os.environ.get('TDAQ_APPLICATION_NAME', '').split(':')
91  if not len(jobId) == 5:
92  from random import randint
93  jobId = ['Athena-EventProcessor', 'Athena-EventDisplays-Segment', 'EventDisplays-Rack', 'tmp', '%d' % randint(0, 999)]
94 
95  return jobId
96 

◆ WaitForPartition()

def EventDisplaysOnlineHelpers.WaitForPartition (   partitionName = None)

Definition at line 46 of file EventDisplaysOnlineHelpers.py.

46 def WaitForPartition(partitionName=None):
47  mlog = logging.getLogger( 'EventDisplays' )
48  partitionUp = False
49  while not partitionUp:
50  try:
51  partition = IPCPartition(partitionName)
52  runParams = ISObject(partition, "RunParams.RunParams", "RunParams")
53  runParams.checkout()
54  partitionUp = True
55 
56  except Exception:
57  mlog.info("%s partition is not up, sleeping for 30 seconds", partitionName)
58  time.sleep(30)
59 

Variable Documentation

◆ bFields

def EventDisplaysOnlineHelpers.bFields = GetBFields()

Definition at line 107 of file EventDisplaysOnlineHelpers.py.

◆ isPublicEvent

def EventDisplaysOnlineHelpers.isPublicEvent = EventCanBeSeenByPublic(['data24_13p6TeV'])

Definition at line 109 of file EventDisplaysOnlineHelpers.py.

◆ runNumber

def EventDisplaysOnlineHelpers.runNumber = GetRunNumber()

Definition at line 105 of file EventDisplaysOnlineHelpers.py.

EventDisplaysOnlineHelpers.WaitForPartition
def WaitForPartition(partitionName=None)
Definition: EventDisplaysOnlineHelpers.py:46
EventDisplaysOnlineHelpers.GetUniqueJobID
def GetUniqueJobID()
Definition: EventDisplaysOnlineHelpers.py:87
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
EventDisplaysOnlineHelpers.GetRunNumber
def GetRunNumber(partitionName)
Definition: EventDisplaysOnlineHelpers.py:97
EventDisplaysOnlineHelpers.GetBFields
def GetBFields()
Definition: EventDisplaysOnlineHelpers.py:7
EventDisplaysOnlineHelpers.EventCanBeSeenByPublic
def EventCanBeSeenByPublic(projectTags)
Definition: EventDisplaysOnlineHelpers.py:60
Trk::split
@ split
Definition: LayerMaterialProperties.h:38