TofPmtBrSvc::TofPmtBrSvc Class Reference

List of all members.

Public Member Functions

def __init__
def do
def write

Private Attributes

 __rootPath
 __file
 __fileLines

Detailed Description

Definition at line 3 of file TofPmtBrSvc.py.


Member Function Documentation

def TofPmtBrSvc::TofPmtBrSvc::__init__ (   self  ) 

Definition at line 4 of file TofPmtBrSvc.py.

00004                     :
00005     import os
00006     self.__rootPath = os.getenv('TOFSIMROOT') + '/dat/'
00007     self.__file = open(self.__rootPath + 'srcTofPmtBr.txt', 'r')
00008     self.__fileLines = self.__file.readlines()
00009     self.__file.close()
00010 
  def do(self, no, key, value): 

def TofPmtBrSvc::TofPmtBrSvc::do (   self,
  no,
  key,
  value 
)

Definition at line 11 of file TofPmtBrSvc.py.

00011                               : 
00012     upperKey = key.upper()
00013     oldLines = self.__fileLines
00014     
00015     upperKeys = oldLines[1].upper()
00016     keys = upperKeys.split()
00017     keyNo = 0
00018     wantKey = 0
00019     for eachKey in keys:
00020       if eachKey == upperKey:
00021         wantKey = keyNo
00022         break
00023       keyNo = keyNo + 1
00024     
00025     oldLine = oldLines[no + 2]
00026     oldValues = oldLine.split()
00027     newValues = []
00028     for i in xrange(oldValues.__len__()):
00029       if i == wantKey:
00030         newValues.append(value)
00031       else:
00032         newValues.append(oldValues[i])
00033     newLine = ' '.join(newValues)
00034     newLine = newLine + '\n'
00035     
00036     self.__fileLines = []
00037     for i in xrange(2):
00038       self.__fileLines.append(oldLines[i])
00039     for i in xrange(oldLines[2:].__len__()):
00040       if i == no:
00041         self.__fileLines.append(newLine)
00042       else:
00043         self.__fileLines.append(oldLines[i + 2])
00044 

def TofPmtBrSvc::TofPmtBrSvc::write (   self  ) 

Definition at line 45 of file TofPmtBrSvc.py.

00045                  :
00046     outFile = open(self.__rootPath + 'TofPmtBr.txt', 'w')
00047     outFile.writelines(self.__fileLines)
00048     outFile.close()
00049 
00050 
if __name__ == '__main__':


Member Data Documentation

TofPmtBrSvc::TofPmtBrSvc::__file [private]

Definition at line 7 of file TofPmtBrSvc.py.

TofPmtBrSvc::TofPmtBrSvc::__fileLines [private]

Definition at line 8 of file TofPmtBrSvc.py.

TofPmtBrSvc::TofPmtBrSvc::__rootPath [private]

Definition at line 6 of file TofPmtBrSvc.py.


Generated on Tue Nov 29 23:36:38 2016 for BOSS_7.0.2 by  doxygen 1.4.7