Functions | |
def | genObjectDef |
def | genObjNameDef |
def | getObjectList |
Variables | |
string | action = 'store_true' |
tuple | alphaRE = re.compile(r'(\w+)') |
tuple | colonRE = re.compile(r':') |
string | default = '' |
dictionary | defsDict |
string | defTemplate |
tuple | dotRE = re.compile(r'\.') |
tuple | goName = options.goNameorcolonRE.sub('', objectName) |
string | help = 'GenObject name' |
tuple | nonAlphaRE = re.compile(r'\W') |
tuple | objectName = GenObject.decodeNonAlphanumerics(args[0]) |
string | outputFile = '.txt' |
parser = optparse.OptionParser\ | |
dictionary | root2GOtypeDict |
string | startString |
tuple | targetFile = open(outputFile, 'w') |
tuple | vetoedTypes = set() |
def useReflexToDescribeForGenObject::genObjectDef | ( | mylist, | |
tuple, | |||
alias, | |||
label, | |||
type, | |||
etaPhiFound | |||
) |
Does something, but I can't remembrer what...
Definition at line 142 of file useReflexToDescribeForGenObject.py.
00143 : 00144 """Does something, but I can't remembrer what... """ 00145 print "tuple %s alias %s label %s type %s" % (tuple, alias, label, type) 00146 # first get the name of the object 00147 firstName = mylist[0][0] 00148 match = alphaRE.match (firstName) 00149 if not match: 00150 raise RuntimeError, "firstName doesn't parse correctly. (%s)" \ 00151 % firstName 00152 genName = match.group (1) 00153 genDef = " ## GenObject %s Definition ##\n[%s]\n" % \ 00154 (genName, genName) 00155 if options.index or not etaPhiFound: 00156 # either we told it to always use index OR either eta or phi 00157 # is missing. 00158 genDef += "-equiv: index,0\n"; 00159 else: 00160 genDef += "-equiv: eta,0.1 phi,0.1 index,100000\n"; 00161 tupleDef = '[%s:%s:%s label=%s type=%s]\n' % \ 00162 (genName, tuple, alias, label, type) 00163 00164 for variable in mylist: 00165 name, func = genObjNameDef (variable[0]) 00166 typeInfo = variable[1] 00167 form = defsDict[ typeInfo ] 00168 genDef += form % name + '\n' 00169 tupleDef += "%-40s : %s\n" % (name, func) 00170 return genDef, tupleDef 00171
def useReflexToDescribeForGenObject::genObjNameDef | ( | line | ) |
Returns GenObject name and ntuple definition function
Definition at line 133 of file useReflexToDescribeForGenObject.py.
def useReflexToDescribeForGenObject::getObjectList | ( | objectName, | |
base, | |||
verbose = False , |
|||
memberData = False |
|||
) |
Get a list of interesting things from this object
Definition at line 63 of file useReflexToDescribeForGenObject.py.
00064 : 00065 """Get a list of interesting things from this object""" 00066 # The autoloader needs an object before it loads its dictionary. 00067 # So let's give it one. 00068 rootObjConstructor = getattr (ROOT, objectName) 00069 obj = rootObjConstructor() 00070 alreadySeenFunction = set() 00071 etaFound, phiFound = False, False 00072 global vetoedTypes 00073 retval = [] 00074 # Put the current class on the queue and start the while loop 00075 reflexList = [ ROOT.Reflex.Type.ByName (objectName) ] 00076 if verbose: print reflexList 00077 while reflexList: 00078 reflex = reflexList.pop (0) # get first element 00079 print "Looking at %s" % reflex.Name (0xffffffff) 00080 if verbose: 00081 print "baseSize", reflex.BaseSize() 00082 print "FunctionMemberSize", reflex.FunctionMemberSize() 00083 for baseIndex in range( reflex.BaseSize() ) : 00084 reflexList.append( reflex.BaseAt(baseIndex).ToType() ) 00085 for index in range( reflex.FunctionMemberSize() ): 00086 funcMember = reflex.FunctionMemberAt (index) 00087 # if we've already seen this, don't bother again 00088 name = funcMember.Name() 00089 if verbose: 00090 print "name", name 00091 if name == 'eta': 00092 etaFound = True 00093 elif name == 'phi': 00094 phiFound = True 00095 if name in alreadySeenFunction: 00096 continue 00097 # make sure this is an allowed return type 00098 returnType = funcMember.TypeOf().ReturnType().Name (0xffffffff) 00099 goType = root2GOtypeDict.get (returnType, None) 00100 if verbose: 00101 print " type", returnType, goType 00102 if not goType: 00103 vetoedTypes.add (returnType) 00104 if verbose: 00105 print " skipped" 00106 continue 00107 elif verbose: 00108 print " good" 00109 # only bother printout out lines where it is a const function 00110 # and has no input parameters. 00111 if funcMember.IsConst() and not funcMember.FunctionParameterSize(): 00112 retval.append( ("%s.%s()" % (base, name), goType)) 00113 alreadySeenFunction.add( name ) 00114 if verbose: 00115 print " added" 00116 elif verbose: 00117 print " failed IsConst() and FunctionParameterSize()" 00118 if not memberData: 00119 continue 00120 for index in range( reflex.DataMemberSize() ): 00121 data = reflex.DataMemberAt( index ); 00122 name = data.Name() 00123 dataType = data.MemberType().__class__.__name__ 00124 goType = root2GOtypeDict.get (dataType, None) 00125 if not goType: 00126 continue 00127 if verbose: 00128 print "name", name, "dataType", dataType, "goType", goType 00129 retval.append ( ("%s.%s" % (base, name), goType) ) 00130 retval.sort() 00131 return retval, etaFound and phiFound 00132
string useReflexToDescribeForGenObject::action = 'store_true' |
Definition at line 192 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::alphaRE = re.compile(r'(\w+)') |
Definition at line 60 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::colonRE = re.compile(r':') |
Definition at line 57 of file useReflexToDescribeForGenObject.py.
string useReflexToDescribeForGenObject::default = '' |
Definition at line 178 of file useReflexToDescribeForGenObject.py.
dictionary useReflexToDescribeForGenObject::defsDict |
00001 { 00002 'int' : '%-40s : form=%%%%8d type=int', 00003 'float' : '%-40s : form=%%%%7.2f prec=', 00004 'str' : '%-40s : form=%%%%20s type=string', 00005 'long' : '%-40s : form=%%%%10d type=long', 00006 }
Definition at line 10 of file useReflexToDescribeForGenObject.py.
00001 """ 00002 ##################### 00003 ## %(OBJS)s Definition ## 00004 ##################### 00005 00006 # Nickname and Tree 00007 [%(objs)s:FWLite] 00008 00009 # 'reco'-tupe 'runevent' 'tofill' information 00010 [runevent:%(objs)s:EventAuxiliary shortcut=eventAuxiliary()] 00011 run: run() 00012 event: event() 00013 00014 """
Definition at line 42 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::dotRE = re.compile(r'\.') |
Definition at line 58 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::goName = options.goNameorcolonRE.sub('', objectName) |
Definition at line 210 of file useReflexToDescribeForGenObject.py.
string useReflexToDescribeForGenObject::help = 'GenObject name' |
Definition at line 179 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::nonAlphaRE = re.compile(r'\W') |
Definition at line 59 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::objectName = GenObject.decodeNonAlphanumerics(args[0]) |
Definition at line 209 of file useReflexToDescribeForGenObject.py.
string useReflexToDescribeForGenObject::outputFile = '.txt' |
Definition at line 211 of file useReflexToDescribeForGenObject.py.
useReflexToDescribeForGenObject::parser = optparse.OptionParser\ |
Definition at line 174 of file useReflexToDescribeForGenObject.py.
00001 { 00002 'int' : 'int', 00003 'float' : 'float', 00004 'double' : 'float', 00005 'long' : 'long', 00006 'long int' : 'long', 00007 'unsigned int' : 'int', 00008 'bool' : 'int', 00009 'string' : 'str', 00010 'std::basic_string<char>' : 'str', 00011 }
Definition at line 17 of file useReflexToDescribeForGenObject.py.
00001 """ 00002 # -*- sh -*- For Font lock mode 00003 00004 ########################### 00005 ## GenObject Definitions ## 00006 ########################### 00007 00008 # GenObject 'event' definition 00009 [runevent singleton] 00010 run: type=int 00011 event: type=int 00012 """
Definition at line 29 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::targetFile = open(outputFile, 'w') |
Definition at line 223 of file useReflexToDescribeForGenObject.py.
tuple useReflexToDescribeForGenObject::vetoedTypes = set() |
Definition at line 61 of file useReflexToDescribeForGenObject.py.