287 def makeEDFplot (lumiCont, eventsDict, totalWeight, outputFile, options):
298 if 'time' == options.edfMode:
300 if lumiCont.minRun
or lumiCont.minIntLum:
306 for key, eventList
in sorted( six.iteritems(eventsDict) ):
309 if lumiCont.minRun
and lumiCont.minRun > key[0]
or \
310 lumiCont.maxRun
and lumiCont.maxRun < key[0]:
312 for event
in eventList:
316 factor = weight / totalWeight
318 intLum = lumiCont[key].totalRecorded
320 raise RuntimeError(
"key %s not found in lumi information" \
322 if lumiCont.minIntLum
and lumiCont.minIntLum > intLum
or \
323 lumiCont.maxIntLum
and lumiCont.maxIntLum < intLum:
325 lumFrac = intLum / lumiCont.totalRecLum
326 xVals.append( lumiCont[key].totalRecorded)
327 yVals.append (factor)
328 expectedVals.append (lumFrac)
329 predVals.append (lumFrac * options.pred)
331 if not lumiCont.maxRun
and not lumiCont.maxIntLum:
332 xVals.append (lumiCont.totalRecLum)
334 expectedVals.append (1)
335 predVals.append (options.pred)
339 if options.resetExpected:
340 slope = (yVals[-1] - yVals[0]) / (xVals[-1] - xVals[0])
341 print(
"slope", slope)
342 for index, old
in enumerate (expectedVals):
343 expectedVals[index] = yVals[0] + \
344 slope * (xVals[index] - xVals[0])
348 if options.breakExpectedIntLum:
349 breakExpectedIntLum = []
350 for chunk
in options.breakExpectedIntLum:
351 pieces = sepRE.split (chunk)
354 breakExpectedIntLum.append(
float(piece) )
356 raise RuntimeError(
"'%s' from '%s' is not a valid float" \
358 breakExpectedIntLum.sort()
362 for index, xPos
in enumerate (xVals):
363 if xPos > breakExpectedIntLum[breakIndex]:
364 boundaries.append (index)
365 while breakIndex < len (breakExpectedIntLum):
367 if breakIndex >= len (breakExpectedIntLum):
373 if xPos <= breakExpectedIntLum[breakIndex]:
379 raise RuntimeError(
"No values of 'breakExpectedIntLum' are in current range.")
382 boundaries.insert (0, 0)
385 if boundaries[-1] != len (xVals) - 1:
386 boundaries.append( len (xVals) - 1 )
387 rangeList =
list(zip (boundaries, boundaries[1:]))
388 for thisRange
in rangeList:
391 slope = (yVals[upper] - yVals[lower]) / \
392 (xVals[upper] - xVals[lower])
393 print(
"slope", slope)
396 for index
in range (lower, upper + 1):
397 newExpected = yVals[lower] + \
398 slope * (xVals[index] - xVals[lower])
399 pairList.append( (xVals[index], newExpected) )
400 expectedVals[index] = newExpected
401 expectedChunks.append (pairList)
405 elif 'instLum' == options.edfMode
or 'instIntLum' == options.edfMode:
407 if not lumiCont.xingInfo:
408 raise RuntimeError(
"Luminosity Xing information missing.")
409 for key, eventList
in sorted( six.iteritems(eventsDict) ):
412 instLum = lumi.aveInstLum
413 fracAXIL = lumi.fracAXILrecorded
414 totalAXIL = lumi.totalAXILrecorded
416 raise RuntimeError(
"key %s not found in lumi information" \
418 for event
in eventList:
419 eventTupList.append( (instLum, fracAXIL, totalAXIL, key,
420 event[0], event[1], ) )
422 for eventTup
in eventTupList:
423 weight += eventTup[5]
424 factor = weight / totalWeight
425 if 'instLum' == options.edfMode:
426 xVals.append (eventTup[0])
428 xVals.append (eventTup[2])
429 yVals.append (factor)
430 expectedVals.append (eventTup[1])
431 predVals.append (eventTup[1] * options.pred)
433 raise RuntimeError(
"It looks like Charles screwed up if you are seeing this.")
436 step = int (math.sqrt(size) / 2 + 1)
437 if options.printValues:
438 for index
in range (size):
439 print(
"%8f %8f %8f" % (xVals[index], yVals[index], expectedVals[index]), end=
' ')
441 denom = xVals[index] - xVals[index - step]
442 numer = yVals[index] - yVals[index - step]
444 print(
" %8f" % (numer / denom), end=
' ')
445 if 0 == index % step:
446 print(
" **", end=
' ')
451 xArray = array.array (
'd', xVals)
452 yArray = array.array (
'd', yVals)
453 expected = array.array (
'd', expectedVals)
454 graph = ROOT.TGraph( size, xArray, yArray)
455 graph.SetTitle (options.title)
456 graph.SetMarkerStyle (20)
457 expectedGraph = ROOT.TGraph( size, xArray, expected)
458 expectedGraph.SetLineColor (ROOT.kRed)
459 expectedGraph.SetLineWidth (3)
460 if options.noDataPoints:
461 expectedGraph.SetLineStyle (2)
465 print(
"average weight per event:", weight / ( size - 1))
466 maxDistance = ROOT.TMath.KolmogorovTest (size, yArray,
469 prob = ROOT.TMath.KolmogorovProb( maxDistance * math.sqrt( size ) )
472 ROOT.gROOT.SetStyle(
'Plain')
473 ROOT.gROOT.SetBatch()
475 graph.GetXaxis().SetRangeUser (min (xVals), max (xVals))
476 minValue = min (
min(yVals),
min(expected))
478 minValue = min (minValue, min (predVals))
479 graph.GetYaxis().SetRangeUser (minValue,
480 max (
max(yVals),
max(expected),
max(predVals)))
481 graph.SetLineWidth (3)
482 if options.noDataPoints:
486 if 'instLum' == options.edfMode:
487 graph.GetXaxis().SetTitle (
"Average Xing Inst. Luminosity (1/ub/s)")
488 graph.GetXaxis().SetRangeUser (0., lumiCont.max(
'aveInstLum'))
490 if 'instIntLum' == options.edfMode:
491 graph.GetXaxis().SetTitle (
"Integrated Luminosity - Inst. Lum. Ordered (1/%s)" \
494 graph.GetXaxis().SetTitle (
"Integrated Luminosity (1/%s)" \
496 graph.GetYaxis().SetTitle (
"Fraction of Events Seen")
499 for index, chunk
in enumerate (expectedChunks):
500 expectedXarray = array.array (
'd', [item[0]
for item
in chunk])
501 expectedYarray = array.array (
'd', [item[1]
for item
in chunk])
502 expectedGraph = ROOT.TGraph( len(chunk),
505 expectedGraph.SetLineWidth (3)
506 if options.noDataPoints:
507 expectedGraph.SetLineStyle (2)
509 expectedGraph.SetLineColor (ROOT.kBlue)
511 expectedGraph.SetLineColor (ROOT.kRed)
512 expectedGraph.Draw(
"L")
513 expectedGraphs.append (expectedGraph)
514 exptectedGraph = expectedGraphs[0]
516 expectedGraph.Draw (
"L")
519 predArray = array.array (
'd', predVals)
520 green = ROOT.TGraph (size, xArray, predArray)
521 green.SetLineWidth (3)
522 green.SetLineColor (8)
524 legend = ROOT.TLegend(0.15, 0.65, 0.50, 0.85)
525 legend.SetFillStyle (0)
526 legend.SetLineColor(ROOT.kWhite)
527 observed =
'Observed' 529 observed +=
' (weighted)' 530 legend.AddEntry(graph, observed,
"PL")
531 if options.resetExpected:
532 legend.AddEntry(expectedGraph,
"Expected from partial yield",
"L")
534 legend.AddEntry(expectedGraph,
"Expected from total yield",
"L")
536 legend.AddEntry(green, options.predLabel,
"L")
537 legend.AddEntry(
"",
"D_{stat}=%.3f, N=%d" % (maxDistance, size),
"")
538 legend.AddEntry(
"",
"P_{KS}=%.3f" % prob,
"")
542 c1.Print (outputFile)
S & print(S &os, JobReport::InputFile const &f)
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