286 def makeEDFplot (lumiCont, eventsDict, totalWeight, outputFile, options):
297 if 'time' == options.edfMode:
299 if lumiCont.minRun
or lumiCont.minIntLum:
305 for key, eventList
in sorted( six.iteritems(eventsDict) ):
308 if lumiCont.minRun
and lumiCont.minRun > key[0]
or \
309 lumiCont.maxRun
and lumiCont.maxRun < key[0]:
311 for event
in eventList:
315 factor = weight / totalWeight
317 intLum = lumiCont[key].totalRecorded
319 raise RuntimeError(
"key %s not found in lumi information" \
321 if lumiCont.minIntLum
and lumiCont.minIntLum > intLum
or \
322 lumiCont.maxIntLum
and lumiCont.maxIntLum < intLum:
324 lumFrac = intLum / lumiCont.totalRecLum
325 xVals.append( lumiCont[key].totalRecorded)
326 yVals.append (factor)
327 expectedVals.append (lumFrac)
328 predVals.append (lumFrac * options.pred)
330 if not lumiCont.maxRun
and not lumiCont.maxIntLum:
331 xVals.append (lumiCont.totalRecLum)
333 expectedVals.append (1)
334 predVals.append (options.pred)
338 if options.resetExpected:
339 slope = (yVals[-1] - yVals[0]) / (xVals[-1] - xVals[0])
340 print(
"slope", slope)
341 for index, old
in enumerate (expectedVals):
342 expectedVals[index] = yVals[0] + \
343 slope * (xVals[index] - xVals[0])
347 if options.breakExpectedIntLum:
348 breakExpectedIntLum = []
349 for chunk
in options.breakExpectedIntLum:
350 pieces = sepRE.split (chunk)
353 breakExpectedIntLum.append(
float(piece) )
355 raise RuntimeError(
"'%s' from '%s' is not a valid float" \
357 breakExpectedIntLum.sort()
361 for index, xPos
in enumerate (xVals):
362 if xPos > breakExpectedIntLum[breakIndex]:
363 boundaries.append (index)
364 while breakIndex < len (breakExpectedIntLum):
366 if breakIndex >= len (breakExpectedIntLum):
372 if xPos <= breakExpectedIntLum[breakIndex]:
378 raise RuntimeError(
"No values of 'breakExpectedIntLum' are in current range.")
381 boundaries.insert (0, 0)
384 if boundaries[-1] != len (xVals) - 1:
385 boundaries.append( len (xVals) - 1 )
386 rangeList =
list(zip (boundaries, boundaries[1:]))
387 for thisRange
in rangeList:
390 slope = (yVals[upper] - yVals[lower]) / \
391 (xVals[upper] - xVals[lower])
392 print(
"slope", slope)
395 for index
in range (lower, upper + 1):
396 newExpected = yVals[lower] + \
397 slope * (xVals[index] - xVals[lower])
398 pairList.append( (xVals[index], newExpected) )
399 expectedVals[index] = newExpected
400 expectedChunks.append (pairList)
404 elif 'instLum' == options.edfMode
or 'instIntLum' == options.edfMode:
406 if not lumiCont.xingInfo:
407 raise RuntimeError(
"Luminosity Xing information missing.")
408 for key, eventList
in sorted( six.iteritems(eventsDict) ):
411 instLum = lumi.aveInstLum
412 fracAXIL = lumi.fracAXILrecorded
413 totalAXIL = lumi.totalAXILrecorded
415 raise RuntimeError(
"key %s not found in lumi information" \
417 for event
in eventList:
418 eventTupList.append( (instLum, fracAXIL, totalAXIL, key,
419 event[0], event[1], ) )
421 for eventTup
in eventTupList:
422 weight += eventTup[5]
423 factor = weight / totalWeight
424 if 'instLum' == options.edfMode:
425 xVals.append (eventTup[0])
427 xVals.append (eventTup[2])
428 yVals.append (factor)
429 expectedVals.append (eventTup[1])
430 predVals.append (eventTup[1] * options.pred)
432 raise RuntimeError(
"It looks like Charles screwed up if you are seeing this.")
435 step = int (math.sqrt(size) / 2 + 1)
436 if options.printValues:
437 for index
in range (size):
438 print(
"%8f %8f %8f" % (xVals[index], yVals[index], expectedVals[index]), end=
' ')
440 denom = xVals[index] - xVals[index - step]
441 numer = yVals[index] - yVals[index - step]
443 print(
" %8f" % (numer / denom), end=
' ')
444 if 0 == index % step:
445 print(
" **", end=
' ')
450 xArray = array.array (
'd', xVals)
451 yArray = array.array (
'd', yVals)
452 expected = array.array (
'd', expectedVals)
453 graph = ROOT.TGraph( size, xArray, yArray)
454 graph.SetTitle (options.title)
455 graph.SetMarkerStyle (20)
456 expectedGraph = ROOT.TGraph( size, xArray, expected)
457 expectedGraph.SetLineColor (ROOT.kRed)
458 expectedGraph.SetLineWidth (3)
459 if options.noDataPoints:
460 expectedGraph.SetLineStyle (2)
464 print(
"average weight per event:", weight / ( size - 1))
465 maxDistance = ROOT.TMath.KolmogorovTest (size, yArray,
468 prob = ROOT.TMath.KolmogorovProb( maxDistance * math.sqrt( size ) )
471 ROOT.gROOT.SetStyle(
'Plain')
472 ROOT.gROOT.SetBatch()
474 graph.GetXaxis().SetRangeUser (min (xVals), max (xVals))
475 minValue = min (
min(yVals),
min(expected))
477 minValue = min (minValue, min (predVals))
478 graph.GetYaxis().SetRangeUser (minValue,
479 max (
max(yVals),
max(expected),
max(predVals)))
480 graph.SetLineWidth (3)
481 if options.noDataPoints:
485 if 'instLum' == options.edfMode:
486 graph.GetXaxis().SetTitle (
"Average Xing Inst. Luminosity (1/ub/s)")
487 graph.GetXaxis().SetRangeUser (0., lumiCont.max(
'aveInstLum'))
489 if 'instIntLum' == options.edfMode:
490 graph.GetXaxis().SetTitle (
"Integrated Luminosity - Inst. Lum. Ordered (1/%s)" \
493 graph.GetXaxis().SetTitle (
"Integrated Luminosity (1/%s)" \
495 graph.GetYaxis().SetTitle (
"Fraction of Events Seen")
498 for index, chunk
in enumerate (expectedChunks):
499 expectedXarray = array.array (
'd', [item[0]
for item
in chunk])
500 expectedYarray = array.array (
'd', [item[1]
for item
in chunk])
501 expectedGraph = ROOT.TGraph( len(chunk),
504 expectedGraph.SetLineWidth (3)
505 if options.noDataPoints:
506 expectedGraph.SetLineStyle (2)
508 expectedGraph.SetLineColor (ROOT.kBlue)
510 expectedGraph.SetLineColor (ROOT.kRed)
511 expectedGraph.Draw(
"L")
512 expectedGraphs.append (expectedGraph)
513 exptectedGraph = expectedGraphs[0]
515 expectedGraph.Draw (
"L")
518 predArray = array.array (
'd', predVals)
519 green = ROOT.TGraph (size, xArray, predArray)
520 green.SetLineWidth (3)
521 green.SetLineColor (8)
523 legend = ROOT.TLegend(0.15, 0.65, 0.50, 0.85)
524 legend.SetFillStyle (0)
525 legend.SetLineColor(ROOT.kWhite)
526 observed =
'Observed' 528 observed +=
' (weighted)' 529 legend.AddEntry(graph, observed,
"PL")
530 if options.resetExpected:
531 legend.AddEntry(expectedGraph,
"Expected from partial yield",
"L")
533 legend.AddEntry(expectedGraph,
"Expected from total yield",
"L")
535 legend.AddEntry(green, options.predLabel,
"L")
536 legend.AddEntry(
"",
"D_{stat}=%.3f, N=%d" % (maxDistance, size),
"")
537 legend.AddEntry(
"",
"P_{KS}=%.3f" % prob,
"")
541 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