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 1449 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 1456 of file TileCalibTools.py.

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

Member Function Documentation

◆ getData()

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

Definition at line 1505 of file TileCalibTools.py.

1505  def getData(self, ros, drawer):
1506  dictKey = (int(ros), int(drawer))
1507  data = self.__dataDict.get(dictKey,[])
1508  return data
1509 

◆ getDict()

def python.TileCalibTools.TileASCIIParser3.getDict (   self)

Definition at line 1511 of file TileCalibTools.py.

1511  def getDict(self):
1512  import copy
1513  return copy.deepcopy(self.__dataDict)

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict
private

Definition at line 1464 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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py: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
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