CMS 3D CMS Logo

Classes | Functions | Variables
simpleEdmComparison Namespace Reference

Classes

class  ProductNotFoundError
 

Functions

def compareEvents (event1, event2, handleName, label, options)
 

Variables

 action
 
 args
 
 chain1
 
 chain2
 
 config
 
 default
 
 dest
 
 ev1
 
 ev2
 
 evCount
 
 event1
 
 event2
 
 evMismatch
 
 file1
 
 file2
 
 forceEvent
 
 handleName
 
 help
 
 label
 
 level
 Setup Options ##. More...
 
 lName
 
 mismatches
 
 modeGroup
 
 numEvents
 
 objName
 
 options
 
 optionsGroup
 
 parser
 
 plagerDict
 
 productsCompared
 
 tName
 
 totalCount
 
 tupleGroup
 
 type
 
 typeMap
 

Function Documentation

def simpleEdmComparison.compareEvents (   event1,
  event2,
  handleName,
  label,
  options 
)
Compare two events

Definition at line 23 of file simpleEdmComparison.py.

23 def compareEvents(event1, event2, handleName, label, options):
24  """
25  Compare two events
26  """
27 
28  # Is it a vector of objects or object (funky ROOT buffer for single value)
29  isSimpleObject = (handleName.find('vector') == -1)
30 
31  # Compare run, lumi, event
32  aux1 = event1.eventAuxiliary()
33  aux2 = event2.eventAuxiliary()
34 
35  rle1 = (aux1.run(), aux1.luminosityBlock(), aux1.event())
36  rle2 = (aux2.run(), aux2.luminosityBlock(), aux2.event())
37 
38  logging.debug("Comparing RLE #'s %s and %s" % (rle1, rle2))
39 
40  if rle1 != rle2:
41  raise RuntimeError("Run/Lumi/Events don't match: %s vs %s" % (rle1, rle2))
42  handle1 = Handle(handleName)
43  handle2 = Handle(handleName)
44 
45  if event1.getByLabel(label, handle1) and event2.getByLabel(label, handle2):
46  objects1 = handle1.product()
47  objects2 = handle1.product()
48  else:
49  raise ProductNotFoundError("Product %s %s not found." % (handleName, label))
50 
51  if isSimpleObject:
52  val1 = objects1[0]
53  val2 = objects2[0]
54  if options.blurRate and options.blur and random.random() < options.blurRate:
55  # This is different than Charles's method, which makes no sense to me
56  val1 += (random.random()-0.5) * options.blur
57  if val1 != val2:
58  logging.error("Mismatch %s and %s in %s" % (val1, val2, aux2.event()))
59  return (1, 1)
60  else:
61  logging.debug("Match of %s in %s" % (objects1[0], aux2.event()))
62  return (1, 0)
63  else:
64  count = 0
65  mismatch = 0
66  for val1, val2 in itertools.izip_longest(objects1, objects2):
67  count += 1
68  if options.blurRate and options.blur and random.random() < options.blurRate:
69  # This is different than Charles's method, which makes no sense to me
70  val1 += (random.random()-0.5) * options.blur * val1
71  if val1 != val2:
72  mismatch += 1
73  logging.error("Comparison problem %s != %s" % (val1, val2))
74  logging.debug("Compared %s elements" % count)
75  return (count, mismatch)
76 
def compareEvents(event1, event2, handleName, label, options)

Variable Documentation

simpleEdmComparison.action

Definition at line 91 of file simpleEdmComparison.py.

simpleEdmComparison.args

Definition at line 114 of file simpleEdmComparison.py.

simpleEdmComparison.chain1

Definition at line 132 of file simpleEdmComparison.py.

simpleEdmComparison.chain2

Definition at line 133 of file simpleEdmComparison.py.

simpleEdmComparison.config

Definition at line 118 of file simpleEdmComparison.py.

simpleEdmComparison.default

Definition at line 95 of file simpleEdmComparison.py.

simpleEdmComparison.dest

Definition at line 91 of file simpleEdmComparison.py.

simpleEdmComparison.ev1

Definition at line 151 of file simpleEdmComparison.py.

Referenced by FcnBeamSpotFitPV.operator()().

simpleEdmComparison.ev2

Definition at line 151 of file simpleEdmComparison.py.

Referenced by FcnBeamSpotFitPV.operator()().

simpleEdmComparison.evCount

Definition at line 151 of file simpleEdmComparison.py.

simpleEdmComparison.event1

Definition at line 151 of file simpleEdmComparison.py.

simpleEdmComparison.event2

Definition at line 151 of file simpleEdmComparison.py.

simpleEdmComparison.evMismatch

Definition at line 151 of file simpleEdmComparison.py.

simpleEdmComparison.file1

Definition at line 119 of file simpleEdmComparison.py.

simpleEdmComparison.file2

Definition at line 120 of file simpleEdmComparison.py.

simpleEdmComparison.forceEvent

Definition at line 132 of file simpleEdmComparison.py.

simpleEdmComparison.handleName

Definition at line 151 of file simpleEdmComparison.py.

simpleEdmComparison.help

Definition at line 92 of file simpleEdmComparison.py.

simpleEdmComparison.label

Definition at line 124 of file simpleEdmComparison.py.

simpleEdmComparison.level

Setup Options ##.

Definition at line 84 of file simpleEdmComparison.py.

simpleEdmComparison.lName
simpleEdmComparison.mismatches

Definition at line 143 of file simpleEdmComparison.py.

simpleEdmComparison.modeGroup

Definition at line 87 of file simpleEdmComparison.py.

simpleEdmComparison.numEvents
simpleEdmComparison.objName

Definition at line 123 of file simpleEdmComparison.py.

simpleEdmComparison.options

Definition at line 114 of file simpleEdmComparison.py.

simpleEdmComparison.optionsGroup

Definition at line 89 of file simpleEdmComparison.py.

simpleEdmComparison.parser

Definition at line 86 of file simpleEdmComparison.py.

simpleEdmComparison.plagerDict

Definition at line 157 of file simpleEdmComparison.py.

simpleEdmComparison.productsCompared

Definition at line 141 of file simpleEdmComparison.py.

simpleEdmComparison.tName
simpleEdmComparison.totalCount

Definition at line 142 of file simpleEdmComparison.py.

simpleEdmComparison.tupleGroup

Definition at line 88 of file simpleEdmComparison.py.

simpleEdmComparison.type

Definition at line 94 of file simpleEdmComparison.py.

simpleEdmComparison.typeMap

Definition at line 14 of file simpleEdmComparison.py.

Referenced by edm::TypeWithDict.byName().