Public Member Functions | |
def | __init__ |
def | printParse |
Public Attributes | |
bfield | |
bookingtime | |
components | |
debug | |
endtime | |
events | |
isvalid | |
isvalidHcal | |
key | |
run | |
sequence | |
starttime | |
text | |
triggers |
Takes output from html search, and tries to identify whether HCAL was in the run.
Definition at line 16 of file pyRunSummaryBaseClass.py.
def pyRunSummaryBaseClass::parseResult::__init__ | ( | self, | ||
text, | ||||
debug = False | ||||
) |
This is all stuff for parsing the html results For Hcal, all we care about is that: a) self.run is a valid integer b) self.events is a non-zero integer c) self.components contains "HCAL" However, we fill the class with all the information provided with the expectation that we may want to use more info in our sorting later (such as requiring the B field to be above a certain value, or requiring a specific trigger). A valid list of results (text) will contain 12 lines: <blank line>, Run, Sequence, Booking Time, Key, Start Time, End Time, Triggers, Events, B Field, Components, and a </TR> row end.
Definition at line 21 of file pyRunSummaryBaseClass.py.
00021 : 00022 ''' 00023 This is all stuff for parsing the html results 00024 For Hcal, all we care about is that: 00025 a) self.run is a valid integer 00026 b) self.events is a non-zero integer 00027 c) self.components contains "HCAL" 00028 However, we fill the class with all the information provided with the expectation that we may want to use more info in our sorting later (such as requiring the B field to be above a certain value, or requiring a specific trigger). 00029 00030 A valid list of results (text) will contain 12 lines: <blank line>, Run, Sequence, Booking Time, Key, Start Time, End Time, Triggers, Events, B Field, Components, and a </TR> row end. 00031 ''' 00032 00033 if (debug): 00034 print self.__init__.__doc__ 00035 00036 self.isvalid=False # determines whether run is valid or not (just tests whether text info provided can be properly parsed) 00037 self.isvalidHcal=False # Boolean describing whether run is valid for Hcal 00038 self.debug=debug 00039 00040 self.events=None 00041 self.components=None 00042 self.run=None 00043 # values below aren't used yet for determining Hcal validity, but they could be 00044 self.sequence=None 00045 self.bookingtime=None 00046 self.key=None 00047 self.starttime=None 00048 self.endtime=None 00049 self.triggers=None 00050 self.bfield=None 00051 00052 text=string.replace(text," ","") # get rid of html space format 00053 self.text=string.split(text,"\n")[1:] # ignore initial blank line 00054 00055 # Should really use regular expressions for parsing at some point 00056 try: 00057 self.run=self.text[0] 00058 self.run=string.split(self.run,"</A>")[0] 00059 self.run=string.split(self.run,">")[2] 00060 self.run=string.atoi(self.run) 00061 except: 00062 if (self.debug): 00063 print "Could not determine run info from %s"%self.text[0] 00064 return 00065 00066 try: 00067 self.sequence = self.text[1] 00068 self.sequence = string.split(self.sequence,"</TD>")[0] 00069 self.sequence = string.split(self.sequence,"<TD>")[1] 00070 except: 00071 if (self.debug): 00072 print "Could not determine sequence from %s"%self.text[1] 00073 return 00074 00075 try: 00076 self.bookingtime = self.text[2] 00077 self.bookingtime = string.split(self.bookingtime,"</TD>")[0] 00078 self.bookingtime = string.split(self.bookingtime,"<TD>")[1] 00079 except: 00080 if (self.debug): 00081 print "Could not determine booking time from %s"%self.text[2] 00082 return 00083 00084 try: 00085 self.key = self.text[3] 00086 self.key = string.split(self.key,"</TD>")[0] 00087 self.key = string.split(self.key,"<TD>")[1] 00088 except: 00089 if (self.debug): 00090 print "Could not determine key from %s"%self.text[3] 00091 return 00092 00093 try: 00094 self.starttime = self.text[4] 00095 self.starttime = string.split(self.starttime,"</TD>")[0] 00096 self.starttime = string.split(self.starttime,"<TD>")[1] 00097 except: 00098 if (self.debug): 00099 print "Could not determine start time from %s"%self.text[4] 00100 return 00101 00102 try: 00103 self.endtime = self.text[5] 00104 self.endtime = string.split(self.endtime,"</TD>")[0] 00105 self.endtime = string.split(self.endtime,"<TD>")[1] 00106 except: 00107 if (self.debug): 00108 print "Could not determine end time from %s"%self.text[5] 00109 return 00110 00111 try: 00112 self.triggers = self.text[6] 00113 self.triggers = string.split(self.triggers,"</TD>")[0] 00114 self.triggers = string.split(self.triggers,">")[1] 00115 if (self.triggers<>"null"): 00116 self.triggers=string.atoi(self.triggers) 00117 except: 00118 if (self.debug): 00119 print "Could not determine triggers from %s"%self.text[6] 00120 return 00121 00122 try: 00123 self.events = self.text[7] 00124 self.events = string.split(self.events,"</TD>")[0] 00125 self.events = string.split(self.events,">")[1] 00126 # Make sure read integer value 00127 if (self.events<>"null"): 00128 self.events=string.atoi(self.events) 00129 # If events ="null", try to estimate num. of events from triggers 00130 if (self.events=="null" and self.triggers<>"null"): 00131 self.events=self.triggers 00132 except: 00133 if (self.debug): 00134 print "Could not determine # of events from %s"%self.text[7] 00135 return 00136 00137 try: 00138 self.bfield = self.text[8] 00139 self.bfield = string.split(self.bfield,"</TD>")[0] 00140 self.bfield = string.split(self.bfield,">")[1] 00141 if (self.bfield<>"null"): 00142 self.bfield=string.atof(self.bfield) 00143 except: 00144 if (self.debug): 00145 print "Could not determine B field from %s"%self.text[8] 00146 return 00147 00148 try: 00149 self.components = self.text[9] 00150 self.components = string.split(self.components,"</TD>")[0] 00151 self.components = string.split(self.components,">")[1] 00152 except: 00153 if (self.debug): 00154 print "Could not determine components from %s"%self.text[9] 00155 return 00156 00157 self.isvalid=True # able to read all event info 00158 00159 # Some good runs have 'events' listed as null -- don't use events as a test of goodness? 00160 if (self.components<>None and string.find(self.components,"HCAL")>-1): 00161 self.isvalidHcal=True 00162 return 00163 def printParse(self):
def pyRunSummaryBaseClass::parseResult::printParse | ( | self | ) |
printParse method prints result of parsing input string.\n\n
Definition at line 164 of file pyRunSummaryBaseClass.py.
00164 : 00165 ''' printParse method prints result of parsing input string.\n\n ''' 00166 if (self.debug): 00167 print self.printParse.__doc__ 00168 00169 print "Run # = ", self. run 00170 print "\tsequence = ",self.sequence 00171 print "\tbooking time = ",self.bookingtime 00172 print "\tkey = ",self.key 00173 print "\tstart time = ",self.starttime 00174 print "\tend time = ",self.endtime 00175 print "\ttriggers = ",self.triggers 00176 print "\tevents = ",self.events 00177 print "\tB field = ",self.bfield 00178 print "\tcomponents = ",self.components 00179 print "Is info valid? ",self.isvalid 00180 print "\n\n" 00181 return 00182 00183 class goodHCALRun:
Definition at line 50 of file pyRunSummaryBaseClass.py.
Definition at line 45 of file pyRunSummaryBaseClass.py.
Definition at line 41 of file pyRunSummaryBaseClass.py.
Definition at line 38 of file pyRunSummaryBaseClass.py.
Definition at line 48 of file pyRunSummaryBaseClass.py.
Definition at line 40 of file pyRunSummaryBaseClass.py.
Definition at line 36 of file pyRunSummaryBaseClass.py.
Definition at line 37 of file pyRunSummaryBaseClass.py.
Definition at line 46 of file pyRunSummaryBaseClass.py.
Definition at line 42 of file pyRunSummaryBaseClass.py.
Definition at line 44 of file pyRunSummaryBaseClass.py.
Definition at line 47 of file pyRunSummaryBaseClass.py.
Definition at line 53 of file pyRunSummaryBaseClass.py.
Definition at line 49 of file pyRunSummaryBaseClass.py.