CMS 3D CMS Logo

Public Member Functions | Private Attributes

normFileParser::normFileParser Class Reference

norm file format spec lines beginning with a semicolon ';' a pound sign '#' or the letters 'REM' (uppercase or lowercase) will be ignored. More...

List of all members.

Public Member Functions

def __init__
def parse

Private Attributes

 __datasectionname
 __defsectionname
 __inifilename
 __parser

Detailed Description

norm file format spec lines beginning with a semicolon ';' a pound sign '#' or the letters 'REM' (uppercase or lowercase) will be ignored.

section uppercase [NORMDEFINITION] #section required only if first create name=HFtest #priority to commandline --name option if present comment= lumitype= istypedefault= [NORMDATA Since] # section required since= corrector= norm_occ1= norm_occ2= amodetag= egev= comment= ...

Definition at line 23 of file normFileParser.py.


Constructor & Destructor Documentation

def normFileParser::normFileParser::__init__ (   self,
  filename 
)

Definition at line 24 of file normFileParser.py.

00025                                :
00026         self.__parser=ConfigParser.ConfigParser()
00027         self.__inifilename=filename
00028         self.__defsectionname='NormDefinition'
        self.__datasectionname='NormData'

Member Function Documentation

void GenParticlePruner::parse (   self)
output:
   [ {defoption:value},[{dataoption:value}] ]

Definition at line 29 of file normFileParser.py.

00030                    :
00031         '''
00032         output:
00033            [ {defoption:value},[{dataoption:value}] ]
00034         '''
00035         if not os.path.exists(self.__inifilename) or not os.path.isfile(self.__inifilename):
00036             raise ValueError(self.__inifilename+' is not a file or does not exist')
00037         self.__parser.read(self.__inifilename)
00038         result=[]
00039         defsectionResult={}
00040         datasectionResult=[]      
00041         sections=self.__parser.sections()
00042         for section in sections:
00043             thisectionresult={}
00044             options=self.__parser.options(section)
00045             for o in options:
00046                 try:
00047                     thisectionresult[o]=self.__parser.get(section,o)
00048                 except:
00049                     continue
00050             if section==self.__defsectionname:
00051                 defsectionResult=thisectionresult
00052             elif self.__datasectionname in section:
00053                 datasectionResult.append(thisectionresult)
        return [defsectionResult,datasectionResult]

Member Data Documentation

Definition at line 24 of file normFileParser.py.

Definition at line 24 of file normFileParser.py.

Definition at line 24 of file normFileParser.py.

Definition at line 24 of file normFileParser.py.