285 def makeEDFplot (lumiCont, eventsDict, totalWeight, outputFile, options):
296 if 'time' == options.edfMode:
298 if lumiCont.minRun
or lumiCont.minIntLum:
304 for key, eventList
in sorted( six.iteritems(eventsDict) ):
307 if lumiCont.minRun
and lumiCont.minRun > key[0]
or \
308 lumiCont.maxRun
and lumiCont.maxRun < key[0]:
310 for event
in eventList:
314 factor = weight / totalWeight
316 intLum = lumiCont[key].totalRecorded
318 raise RuntimeError(
"key %s not found in lumi information" \
320 if lumiCont.minIntLum
and lumiCont.minIntLum > intLum
or \
321 lumiCont.maxIntLum
and lumiCont.maxIntLum < intLum:
323 lumFrac = intLum / lumiCont.totalRecLum
324 xVals.append( lumiCont[key].totalRecorded)
325 yVals.append (factor)
326 expectedVals.append (lumFrac)
327 predVals.append (lumFrac * options.pred)
329 if not lumiCont.maxRun
and not lumiCont.maxIntLum:
330 xVals.append (lumiCont.totalRecLum)
332 expectedVals.append (1)
333 predVals.append (options.pred)
337 if options.resetExpected:
338 slope = (yVals[-1] - yVals[0]) / (xVals[-1] - xVals[0])
340 for index, old
in enumerate (expectedVals):
341 expectedVals[index] = yVals[0] + \
342 slope * (xVals[index] - xVals[0])
346 if options.breakExpectedIntLum:
347 breakExpectedIntLum = []
348 for chunk
in options.breakExpectedIntLum:
349 pieces = sepRE.split (chunk)
352 breakExpectedIntLum.append(
float(piece) )
354 raise RuntimeError(
"'%s' from '%s' is not a valid float" \
356 breakExpectedIntLum.sort()
360 for index, xPos
in enumerate (xVals):
361 if xPos > breakExpectedIntLum[breakIndex]:
362 boundaries.append (index)
363 while breakIndex < len (breakExpectedIntLum):
365 if breakIndex >= len (breakExpectedIntLum):
371 if xPos <= breakExpectedIntLum[breakIndex]:
377 raise RuntimeError(
"No values of 'breakExpectedIntLum' are in current range.")
380 boundaries.insert (0, 0)
383 if boundaries[-1] != len (xVals) - 1:
384 boundaries.append( len (xVals) - 1 )
385 rangeList =
list(zip (boundaries, boundaries[1:]))
386 for thisRange
in rangeList:
389 slope = (yVals[upper] - yVals[lower]) / \
390 (xVals[upper] - xVals[lower])
394 for index
in range (lower, upper + 1):
395 newExpected = yVals[lower] + \
396 slope * (xVals[index] - xVals[lower])
397 pairList.append( (xVals[index], newExpected) )
398 expectedVals[index] = newExpected
399 expectedChunks.append (pairList)
403 elif 'instLum' == options.edfMode
or 'instIntLum' == options.edfMode:
405 if not lumiCont.xingInfo:
406 raise RuntimeError(
"Luminosity Xing information missing.")
407 for key, eventList
in sorted( six.iteritems(eventsDict) ):
410 instLum = lumi.aveInstLum
411 fracAXIL = lumi.fracAXILrecorded
412 totalAXIL = lumi.totalAXILrecorded
414 raise RuntimeError(
"key %s not found in lumi information" \
416 for event
in eventList:
417 eventTupList.append( (instLum, fracAXIL, totalAXIL, key,
418 event[0], event[1], ) )
420 for eventTup
in eventTupList:
421 weight += eventTup[5]
422 factor = weight / totalWeight
423 if 'instLum' == options.edfMode:
424 xVals.append (eventTup[0])
426 xVals.append (eventTup[2])
427 yVals.append (factor)
428 expectedVals.append (eventTup[1])
429 predVals.append (eventTup[1] * options.pred)
431 raise RuntimeError(
"It looks like Charles screwed up if you are seeing this.")
434 step = int (math.sqrt(size) / 2 + 1)
435 if options.printValues:
436 for index
in range (size):
437 print "%8f %8f %8f" % (xVals[index], yVals[index], expectedVals[index]),
439 denom = xVals[index] - xVals[index - step]
440 numer = yVals[index] - yVals[index - step]
442 print " %8f" % (numer / denom),
443 if 0 == index % step:
449 xArray = array.array (
'd', xVals)
450 yArray = array.array (
'd', yVals)
451 expected = array.array (
'd', expectedVals)
452 graph = ROOT.TGraph( size, xArray, yArray)
453 graph.SetTitle (options.title)
454 graph.SetMarkerStyle (20)
455 expectedGraph = ROOT.TGraph( size, xArray, expected)
456 expectedGraph.SetLineColor (ROOT.kRed)
457 expectedGraph.SetLineWidth (3)
458 if options.noDataPoints:
459 expectedGraph.SetLineStyle (2)
463 print "average weight per event:", weight / ( size - 1)
464 maxDistance = ROOT.TMath.KolmogorovTest (size, yArray,
467 prob = ROOT.TMath.KolmogorovProb( maxDistance * math.sqrt( size ) )
470 ROOT.gROOT.SetStyle(
'Plain')
471 ROOT.gROOT.SetBatch()
473 graph.GetXaxis().SetRangeUser (min (xVals), max (xVals))
474 minValue = min (
min(yVals),
min(expected))
476 minValue = min (minValue, min (predVals))
477 graph.GetYaxis().SetRangeUser (minValue,
478 max (
max(yVals),
max(expected),
max(predVals)))
479 graph.SetLineWidth (3)
480 if options.noDataPoints:
484 if 'instLum' == options.edfMode:
485 graph.GetXaxis().SetTitle (
"Average Xing Inst. Luminosity (1/ub/s)")
486 graph.GetXaxis().SetRangeUser (0., lumiCont.max(
'aveInstLum'))
488 if 'instIntLum' == options.edfMode:
489 graph.GetXaxis().SetTitle (
"Integrated Luminosity - Inst. Lum. Ordered (1/%s)" \
492 graph.GetXaxis().SetTitle (
"Integrated Luminosity (1/%s)" \
494 graph.GetYaxis().SetTitle (
"Fraction of Events Seen")
497 for index, chunk
in enumerate (expectedChunks):
498 expectedXarray = array.array (
'd', [item[0]
for item
in chunk])
499 expectedYarray = array.array (
'd', [item[1]
for item
in chunk])
500 expectedGraph = ROOT.TGraph( len(chunk),
503 expectedGraph.SetLineWidth (3)
504 if options.noDataPoints:
505 expectedGraph.SetLineStyle (2)
507 expectedGraph.SetLineColor (ROOT.kBlue)
509 expectedGraph.SetLineColor (ROOT.kRed)
510 expectedGraph.Draw(
"L")
511 expectedGraphs.append (expectedGraph)
512 exptectedGraph = expectedGraphs[0]
514 expectedGraph.Draw (
"L")
517 predArray = array.array (
'd', predVals)
518 green = ROOT.TGraph (size, xArray, predArray)
519 green.SetLineWidth (3)
520 green.SetLineColor (8)
522 legend = ROOT.TLegend(0.15, 0.65, 0.50, 0.85)
523 legend.SetFillStyle (0)
524 legend.SetLineColor(ROOT.kWhite)
525 observed =
'Observed' 527 observed +=
' (weighted)' 528 legend.AddEntry(graph, observed,
"PL")
529 if options.resetExpected:
530 legend.AddEntry(expectedGraph,
"Expected from partial yield",
"L")
532 legend.AddEntry(expectedGraph,
"Expected from total yield",
"L")
534 legend.AddEntry(green, options.predLabel,
"L")
535 legend.AddEntry(
"",
"D_{stat}=%.3f, N=%d" % (maxDistance, size),
"")
536 legend.AddEntry(
"",
"P_{KS}=%.3f" % prob,
"")
540 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