284 def makeEDFplot (lumiCont, eventsDict, totalWeight, outputFile, options):
295 if 'time' == options.edfMode:
297 if lumiCont.minRun
or lumiCont.minIntLum:
303 for key, eventList
in sorted( eventsDict.iteritems() ):
306 if lumiCont.minRun
and lumiCont.minRun > key[0]
or \
307 lumiCont.maxRun
and lumiCont.maxRun < key[0]:
309 for event
in eventList:
313 factor = weight / totalWeight
315 intLum = lumiCont[key].totalRecorded
317 raise RuntimeError(
"key %s not found in lumi information" \
319 if lumiCont.minIntLum
and lumiCont.minIntLum > intLum
or \
320 lumiCont.maxIntLum
and lumiCont.maxIntLum < intLum:
322 lumFrac = intLum / lumiCont.totalRecLum
323 xVals.append( lumiCont[key].totalRecorded)
324 yVals.append (factor)
325 expectedVals.append (lumFrac)
326 predVals.append (lumFrac * options.pred)
328 if not lumiCont.maxRun
and not lumiCont.maxIntLum:
329 xVals.append (lumiCont.totalRecLum)
331 expectedVals.append (1)
332 predVals.append (options.pred)
336 if options.resetExpected:
337 slope = (yVals[-1] - yVals[0]) / (xVals[-1] - xVals[0])
339 for index, old
in enumerate (expectedVals):
340 expectedVals[index] = yVals[0] + \
341 slope * (xVals[index] - xVals[0])
345 if options.breakExpectedIntLum:
346 breakExpectedIntLum = []
347 for chunk
in options.breakExpectedIntLum:
348 pieces = sepRE.split (chunk)
351 breakExpectedIntLum.append(
float(piece) )
353 raise RuntimeError(
"'%s' from '%s' is not a valid float" \
355 breakExpectedIntLum.sort()
359 for index, xPos
in enumerate (xVals):
360 if xPos > breakExpectedIntLum[breakIndex]:
361 boundaries.append (index)
362 while breakIndex < len (breakExpectedIntLum):
364 if breakIndex >= len (breakExpectedIntLum):
370 if xPos <= breakExpectedIntLum[breakIndex]:
376 raise RuntimeError(
"No values of 'breakExpectedIntLum' are in current range.")
379 boundaries.insert (0, 0)
382 if boundaries[-1] != len (xVals) - 1:
383 boundaries.append( len (xVals) - 1 )
384 rangeList =
list(zip (boundaries, boundaries[1:]))
385 for thisRange
in rangeList:
388 slope = (yVals[upper] - yVals[lower]) / \
389 (xVals[upper] - xVals[lower])
393 for index
in range (lower, upper + 1):
394 newExpected = yVals[lower] + \
395 slope * (xVals[index] - xVals[lower])
396 pairList.append( (xVals[index], newExpected) )
397 expectedVals[index] = newExpected
398 expectedChunks.append (pairList)
402 elif 'instLum' == options.edfMode
or 'instIntLum' == options.edfMode:
404 if not lumiCont.xingInfo:
405 raise RuntimeError(
"Luminosity Xing information missing.")
406 for key, eventList
in sorted( eventsDict.iteritems() ):
409 instLum = lumi.aveInstLum
410 fracAXIL = lumi.fracAXILrecorded
411 totalAXIL = lumi.totalAXILrecorded
413 raise RuntimeError(
"key %s not found in lumi information" \
415 for event
in eventList:
416 eventTupList.append( (instLum, fracAXIL, totalAXIL, key,
417 event[0], event[1], ) )
419 for eventTup
in eventTupList:
420 weight += eventTup[5]
421 factor = weight / totalWeight
422 if 'instLum' == options.edfMode:
423 xVals.append (eventTup[0])
425 xVals.append (eventTup[2])
426 yVals.append (factor)
427 expectedVals.append (eventTup[1])
428 predVals.append (eventTup[1] * options.pred)
430 raise RuntimeError(
"It looks like Charles screwed up if you are seeing this.")
433 step = int (math.sqrt(size) / 2 + 1)
434 if options.printValues:
435 for index
in range (size):
436 print "%8f %8f %8f" % (xVals[index], yVals[index], expectedVals[index]),
438 denom = xVals[index] - xVals[index - step]
439 numer = yVals[index] - yVals[index - step]
441 print " %8f" % (numer / denom),
442 if 0 == index % step:
448 xArray = array.array (
'd', xVals)
449 yArray = array.array (
'd', yVals)
450 expected = array.array (
'd', expectedVals)
451 graph = ROOT.TGraph( size, xArray, yArray)
452 graph.SetTitle (options.title)
453 graph.SetMarkerStyle (20)
454 expectedGraph = ROOT.TGraph( size, xArray, expected)
455 expectedGraph.SetLineColor (ROOT.kRed)
456 expectedGraph.SetLineWidth (3)
457 if options.noDataPoints:
458 expectedGraph.SetLineStyle (2)
462 print "average weight per event:", weight / ( size - 1)
463 maxDistance = ROOT.TMath.KolmogorovTest (size, yArray,
466 prob = ROOT.TMath.KolmogorovProb( maxDistance * math.sqrt( size ) )
469 ROOT.gROOT.SetStyle(
'Plain')
470 ROOT.gROOT.SetBatch()
472 graph.GetXaxis().SetRangeUser (min (xVals), max (xVals))
473 minValue = min (
min(yVals),
min(expected))
475 minValue = min (minValue, min (predVals))
476 graph.GetYaxis().SetRangeUser (minValue,
477 max (
max(yVals),
max(expected),
max(predVals)))
478 graph.SetLineWidth (3)
479 if options.noDataPoints:
483 if 'instLum' == options.edfMode:
484 graph.GetXaxis().SetTitle (
"Average Xing Inst. Luminosity (1/ub/s)")
485 graph.GetXaxis().SetRangeUser (0., lumiCont.max(
'aveInstLum'))
487 if 'instIntLum' == options.edfMode:
488 graph.GetXaxis().SetTitle (
"Integrated Luminosity - Inst. Lum. Ordered (1/%s)" \
491 graph.GetXaxis().SetTitle (
"Integrated Luminosity (1/%s)" \
493 graph.GetYaxis().SetTitle (
"Fraction of Events Seen")
496 for index, chunk
in enumerate (expectedChunks):
497 expectedXarray = array.array (
'd', [item[0]
for item
in chunk])
498 expectedYarray = array.array (
'd', [item[1]
for item
in chunk])
499 expectedGraph = ROOT.TGraph( len(chunk),
502 expectedGraph.SetLineWidth (3)
503 if options.noDataPoints:
504 expectedGraph.SetLineStyle (2)
506 expectedGraph.SetLineColor (ROOT.kBlue)
508 expectedGraph.SetLineColor (ROOT.kRed)
509 expectedGraph.Draw(
"L")
510 expectedGraphs.append (expectedGraph)
511 exptectedGraph = expectedGraphs[0]
513 expectedGraph.Draw (
"L")
516 predArray = array.array (
'd', predVals)
517 green = ROOT.TGraph (size, xArray, predArray)
518 green.SetLineWidth (3)
519 green.SetLineColor (8)
521 legend = ROOT.TLegend(0.15, 0.65, 0.50, 0.85)
522 legend.SetFillStyle (0)
523 legend.SetLineColor(ROOT.kWhite)
524 observed =
'Observed' 526 observed +=
' (weighted)' 527 legend.AddEntry(graph, observed,
"PL")
528 if options.resetExpected:
529 legend.AddEntry(expectedGraph,
"Expected from partial yield",
"L")
531 legend.AddEntry(expectedGraph,
"Expected from total yield",
"L")
533 legend.AddEntry(green, options.predLabel,
"L")
534 legend.AddEntry(
"",
"D_{stat}=%.3f, N=%d" % (maxDistance, size),
"")
535 legend.AddEntry(
"",
"P_{KS}=%.3f" % prob,
"")
539 c1.Print (outputFile)
def makeEDFplot(lumiCont, eventsDict, totalWeight, outputFile, options)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run