132def CreateStreamOverlapTooltip(run,k):
133 if not run.stats[k.ResultKey]['StrOverlap']:
134 ovstr = '<tr><td width="200"><b><i>None (or not available for this run)</i></b></td></tr>'
135 else:
136 ovstr = ''
137 nacc=0
138 for stream, fraction in run.stats[k.ResultKey]['StrOverlap']:
139 nacc+=1
140 tdstr = '<td class="tdov%i">' % (nacc%2+1)
141 fs = "%.2g" % fraction
142 if fraction==100:
143 fs = "100"
144 ovstr += '<tr>%s%s</td>%s = </td>%s%s%%</td></tr>' % (tdstr, stream, tdstr, tdstr, fs)
145 strpairs = [('STR:physics_MuonswBeam', 'physics_L1Calo'),
146 ('STR:physics_MinBias', 'physics_L1Calo'),
147 ('STR:physics_Muons', 'physics_Egamma'),
148 ('STR:physics_Muons', 'physics_JetTauEtmiss'),
149 ('STR:physics_Egamma', 'physics_JetTauEtmiss'),
150 ('STR:physics_MinBias', 'physics_JetTauEtmiss')]
151 for st in strpairs:
152 if k==st[0] and stream==st[1]:
154 fname =
'data_' + s1.strip() +
'_' + st[1].
strip() +
'.txt'
155 f = open(QC.datapath + '/' + fname,'a')
156 f.write('%i %f\n' % (run.runNr,fraction))
157 f.close()
158 break
159
160 boxcontent = '<table class="streamtiptable"><tr><td>'
161 boxcontent += '<strong><b>Info for stream: <font color="#AA0000">%s</font></b></strong>' % k.Header[4:]
162 boxcontent += '</td></tr><tr><td>'
163 boxcontent += '<hr style="width:100%; background-color: #999999; height:1px; margin-left:0; border:0"/>'
164 boxcontent += '</td></tr>'
165 boxcontent += '<tr><td>'
166 boxcontent += '<strong><b>Stream overlaps</b></strong> (nonzero overlaps only):'
167 boxcontent += '</td></tr><tr><td>'
168 boxcontent += '<table class="overlaptable">%s</table><strong>' % ovstr
169 boxcontent += '</td></tr>'
170
171
172 prodsteps = ['StrTier0TypesRAW', 'StrTier0TypesESD' ]
173 allt0text = ''
174 for p in prodsteps:
175 if p in run.stats[k.ResultKey]:
176 typelist = list(run.stats[k.ResultKey][p])
177 if not typelist:
178 continue
179
180 typelist.sort()
181 t0text = ''
182 for i, t0out in enumerate(typelist):
183 if 'TMP' not in t0out:
184 if i%4==0 and i>0:
185 t0text += '<br>'
186 if t0out == 'NTUP':
187 t0outtxt = 'NTUP_... <font size="-2">(types as above)</font>'
188 else:
189 t0outtxt = t0out
190 if run.stats[k.ResultKey][p][t0out]:
191 t0text += '<font color="#BB0000">%s</font>, ' % t0outtxt
192 else:
193 t0text += '%s, ' % t0outtxt
194
195 if t0text != '':
196 allt0text += '<strong><b><i>'
197 if 'RAW' in p:
198 allt0text += 'Produced by reconstruction step'
199 if 'StrTier0AMI' in run.stats[k.ResultKey] and run.stats[k.ResultKey]['StrTier0AMI']:
200 if p in run.stats[k.ResultKey]['StrTier0AMI']:
201 allt0text += ' (AMI tag: %s)' % run.stats[k.ResultKey]['StrTier0AMI'][p]
202 else:
203 allt0text += ' (AMI tag: %s)' % 'UNKNOWN'
204 else:
205 allt0text += 'Produced by merge step'
206
207 allt0text += ':</i></b></strong>'
208
209 allt0text += '<table class="overlaptable"><tr><td style="padding-left:10px">' + t0text[:len(t0text)-2] + '</td></tr></table>'
210 if p != prodsteps[-1]:
211 allt0text += ''
212
213 if allt0text != '':
214 boxcontent += '<tr><td>'
215 boxcontent += '<hr style="width:100%; background-color:#999999; height:1px; margin-left:0; border:0"/>'
216 boxcontent += '</td></tr><tr><td>'
217 boxcontent += '<strong><b>Tier-0 output types for this stream:</b></strong><br>(Datasets in <font color="#BB000"><strong><b>red</b></strong></font> are <font color="#BB000">replicated to CAF</font>'
218 boxcontent += '</td></tr><tr><td>'
219 boxcontent += '<table class="overlaptable" style="color:#222222"><tr><td>%s</td></tr></table>' % allt0text
220 boxcontent += '</td></tr>'
221
222
223 lbrecinfo = run.stats[k.ResultKey]['LBRecInfo']
224 if not lbrecinfo:
225 lbrecinfo = '<tr><td style="font-size:75%"><i>No LB information in SFO DB. <br> Probably because files for this stream <br>were not closed at LB boundaries by SFO.</i></td></tr>'
226 else:
227 ev = dict(lbrecinfo)
228 for lb in ev:
229 ev[lb]=0
230 for lb,nev in lbrecinfo:
231 ev[lb] += nev
232 lbs = sorted(ev.keys())
233 output = '<tr>'
234 idx = 0
235 while idx <len(lbs):
236 output += '<td style="font-size:75%%;text-align:right">%i (%s)</td>' % (lbs[idx],ev[lbs[idx]])
237 if len(lbs)>50 and idx==23:
238 output += '</tr><tr><td style="font-size:75%; text-align:left" colspan="8"> ... <i>too many LBs ... show begin and end of run only...</i></td></tr>'
239 idx = len(lbs) - 23
240 elif (idx+1)%8==0:
241 output += '</tr><tr>'
242 idx += 1
243 output += '</tr>'
244 lbrecinfo = output
245
246 boxcontent += '<tr><td>'
247 boxcontent += '<hr style="width:100%; background-color:#999999; height:1px; margin-left:0; border:0"/>'
248 boxcontent += '<strong><b>Recorded LB (#Events)</b></strong></strong>:'
249 boxcontent += '</td></tr><tr><td>'
250 boxcontent += '<table class="eventsperlbstreamtable" style="color:#222222">%s</table>' % lbrecinfo
251 boxcontent += '</td></tr></table>'
252 if 'No LB information' not in lbrecinfo:
253 boxcontent += '<font color="#AA0000"><strong><b>Click to obtain the full LB list and plots in independent window!</b></strong></font>'
254
255 run.addToolTip("STROV_%i_%s" % (run.runNr, k.ResultKey[4:]), boxcontent)
256
257
258
259
260