ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
python.TileCalibTools.TileASCIIParser3 Class Reference
Inheritance diagram for python.TileCalibTools.TileASCIIParser3:
Collaboration diagram for python.TileCalibTools.TileASCIIParser3:

Public Member Functions

def __init__ (self, fileName, calibId)
 
def getData (self, ros, drawer)
 
def getDict (self)
 

Private Attributes

 __dataDict
 

Detailed Description

This is a class capable of parsing TileCal conditions data stored in
ASCII files.

Definition at line 1454 of file TileCalibTools.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TileCalibTools.TileASCIIParser3.__init__ (   self,
  fileName,
  calibId 
)
Input:
- fileName          : input file name
- calibId           : like Trip, ...

Definition at line 1461 of file TileCalibTools.py.

1461  def __init__(self, fileName, calibId):
1462  """
1463  Input:
1464  - fileName : input file name
1465  - calibId : like Trip, ...
1466  """
1467 
1468  TileCalibLogger.__init__(self,"TileASCIIParser3")
1469  self.__dataDict = {}
1470  try:
1471  lines = open(fileName,"r").readlines()
1472  except Exception as e:
1473  self.log().error( "TileCalibASCIIParser3::ERROR: Problem opening input file:" )
1474  self.log().error( e )
1475  return
1476 
1477  for line in lines:
1478  fields = line.strip().split()
1479  #=== ignore empty and comment lines
1480  if not len(fields) :
1481  continue
1482  if fields[0].startswith("#"):
1483  continue
1484 
1485  #=== read in fields
1486  type = fields[0]
1487  frag = fields[1]
1488  data = fields[2:]
1489 
1490  #=== check for correct calibId
1491  if type != calibId:
1492  raise Exception("%s is not calibId=%s" % (type, calibId))
1493 
1494  #=== decode fragment
1495  if not (frag.startswith('0x') or frag.startswith('-0x')):
1496  raise Exception("Misformated fragment %s" % frag)
1497 
1498  frg = int(frag,16)
1499  ros = frg>>8
1500  if frg<0:
1501  mod = (-frg)&255
1502  else:
1503  mod = frg&255
1504 
1505  #=== fill dictionary
1506  dictKey = (ros, mod)
1507  self.__dataDict[dictKey] = data
1508 

Member Function Documentation

◆ getData()

def python.TileCalibTools.TileASCIIParser3.getData (   self,
  ros,
  drawer 
)

Definition at line 1510 of file TileCalibTools.py.

1510  def getData(self, ros, drawer):
1511  dictKey = (int(ros), int(drawer))
1512  data = self.__dataDict.get(dictKey,[])
1513  return data
1514 

◆ getDict()

def python.TileCalibTools.TileASCIIParser3.getDict (   self)

Definition at line 1516 of file TileCalibTools.py.

1516  def getDict(self):
1517  import copy
1518  return copy.deepcopy(self.__dataDict)

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict
private

Definition at line 1469 of file TileCalibTools.py.


The documentation for this class was generated from the following file:
InDetSimDataHelpers::getData
const InDetSimData * getData(const InDetSimDataCollection &coll, const Identifier &id)
Definition: InDetSimDataDict.h:24
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
error
Definition: IImpactPoint3dEstimator.h:70
Trk::split
@ split
Definition: LayerMaterialProperties.h:38