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 1502 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 1509 of file TileCalibTools.py.

1509  def __init__(self, fileName, calibId):
1510  """
1511  Input:
1512  - fileName : input file name
1513  - calibId : like Trip, ...
1514  """
1515 
1516  TileCalibLogger.__init__(self,"TileASCIIParser3")
1517  self.__dataDict = {}
1518  try:
1519  lines = open(fileName,"r").readlines()
1520  except Exception as e:
1521  self.log().error( "TileCalibASCIIParser3::ERROR: Problem opening input file:" )
1522  self.log().error( e )
1523  return
1524 
1525  for line in lines:
1526  fields = line.strip().split()
1527  #=== ignore empty and comment lines
1528  if not len(fields) :
1529  continue
1530  if fields[0].startswith("#"):
1531  continue
1532 
1533  #=== read in fields
1534  type = fields[0]
1535  frag = fields[1]
1536  data = fields[2:]
1537 
1538  #=== check for correct calibId
1539  if type != calibId:
1540  raise Exception("%s is not calibId=%s" % (type, calibId))
1541 
1542  #=== decode fragment
1543  if not (frag.startswith('0x') or frag.startswith('-0x')):
1544  raise Exception("Misformated fragment %s" % frag)
1545 
1546  frg = int(frag,16)
1547  ros = frg>>8
1548  if frg<0:
1549  mod = (-frg)&255
1550  else:
1551  mod = frg&255
1552 
1553  #=== fill dictionary
1554  dictKey = (ros, mod)
1555  self.__dataDict[dictKey] = data
1556 

Member Function Documentation

◆ getData()

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

Definition at line 1558 of file TileCalibTools.py.

1558  def getData(self, ros, drawer):
1559  dictKey = (int(ros), int(drawer))
1560  data = self.__dataDict.get(dictKey,[])
1561  return data
1562 

◆ getDict()

def python.TileCalibTools.TileASCIIParser3.getDict (   self)

Definition at line 1564 of file TileCalibTools.py.

1564  def getDict(self):
1565  import copy
1566  return copy.deepcopy(self.__dataDict)

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict
private

Definition at line 1517 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.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.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:130
error
Definition: IImpactPoint3dEstimator.h:70
Trk::split
@ split
Definition: LayerMaterialProperties.h:38