ATLAS Offline Software
Public Member Functions | Static Public Attributes | List of all members
python.DQUtilities.IDBSDefectEncoding Class Reference
Collaboration diagram for python.DQUtilities.IDBSDefectEncoding:

Public Member Functions

def defectToInt (cls, defect)
 
def defectListToInt (cls, defects)
 
def intToDefectList (cls, dint)
 

Static Public Attributes

list defectBitPos
 

Detailed Description

Class to enocode and decode IDBS defects.  No instances fo this class can be instanciated
and it bascially just acts as a poor man's namespace (should really be a module)

Definition at line 349 of file DQUtilities.py.

Member Function Documentation

◆ defectListToInt()

def python.DQUtilities.IDBSDefectEncoding.defectListToInt (   cls,
  defects 
)
Encode list of defects as an int.  If no defect (empty list) returns 0 for bakcward compatibility

Definition at line 368 of file DQUtilities.py.

368  def defectListToInt(cls, defects):
369  """Encode list of defects as an int. If no defect (empty list) returns 0 for bakcward compatibility"""
370  return sum([cls.defectToInt(d) for d in defects])
371 

◆ defectToInt()

def python.DQUtilities.IDBSDefectEncoding.defectToInt (   cls,
  defect 
)
Encode defect as an int.  If defect is unknown raise error

Definition at line 359 of file DQUtilities.py.

359  def defectToInt(cls, defect):
360  """Encode defect as an int. If defect is unknown raise error"""
361 
362  if defect not in IDBSDefectEncoding.defectBitPos:
363  raise DefectError ('ERROR: Unknown defect %s encountered' % defect)
364 
365  return (1 << IDBSDefectEncoding.defectBitPos.index(defect))
366 

◆ intToDefectList()

def python.DQUtilities.IDBSDefectEncoding.intToDefectList (   cls,
  dint 
)
Decode int as list of defects.  Raise error if unkown defect encountered

Definition at line 373 of file DQUtilities.py.

373  def intToDefectList(cls, dint):
374  """Decode int as list of defects. Raise error if unkown defect encountered"""
375 
376  # Convert int to binary string with correct endianess
377  binStr = bin(dint)[2:][::-1]
378 
379  if len(binStr) > len(IDBSDefectEncoding.defectBitPos):
380  raise DefectError ("ERROR: integer %s out of range" % dint)
381 
382  # If dint is odd then has the unknown bit set
383  if bool(dint & 1):
384  raise DefectError ('ERROR: Unknown defect encountered')
385 
386  return [d[0] for d in zip(IDBSDefectEncoding.defectBitPos,binStr) if d[1]=='1']

Member Data Documentation

◆ defectBitPos

list python.DQUtilities.IDBSDefectEncoding.defectBitPos
static
Initial value:
= ['UNKNOWN', 'ID_BS_2010YELLOW', 'ID_BS_RUNAVERAGE', 'ID_BS_PARAMETERSTEP',
'ID_BS_NOBEAMSPOT', 'ID_BS_2010RED', 'LUMI_VDM']

Definition at line 355 of file DQUtilities.py.


The documentation for this class was generated from the following file:
bin
Definition: BinsDiffFromStripMedian.h:43
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60