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

◆ compareEvents()

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

Definition at line 25 of file simpleEdmComparison.py.

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

Variable Documentation

◆ action

simpleEdmComparison.action

Definition at line 93 of file simpleEdmComparison.py.

◆ args

simpleEdmComparison.args

Definition at line 116 of file simpleEdmComparison.py.

◆ chain1

simpleEdmComparison.chain1

Definition at line 134 of file simpleEdmComparison.py.

◆ chain2

simpleEdmComparison.chain2

Definition at line 135 of file simpleEdmComparison.py.

◆ config

simpleEdmComparison.config

Definition at line 120 of file simpleEdmComparison.py.

◆ default

simpleEdmComparison.default

Definition at line 97 of file simpleEdmComparison.py.

◆ dest

simpleEdmComparison.dest

Definition at line 93 of file simpleEdmComparison.py.

◆ ev1

simpleEdmComparison.ev1

◆ ev2

simpleEdmComparison.ev2

◆ evCount

simpleEdmComparison.evCount

Definition at line 153 of file simpleEdmComparison.py.

◆ event1

simpleEdmComparison.event1

Definition at line 153 of file simpleEdmComparison.py.

◆ event2

simpleEdmComparison.event2

Definition at line 153 of file simpleEdmComparison.py.

◆ evMismatch

simpleEdmComparison.evMismatch

Definition at line 153 of file simpleEdmComparison.py.

◆ file1

simpleEdmComparison.file1

Definition at line 121 of file simpleEdmComparison.py.

◆ file2

simpleEdmComparison.file2

Definition at line 122 of file simpleEdmComparison.py.

◆ forceEvent

simpleEdmComparison.forceEvent

Definition at line 134 of file simpleEdmComparison.py.

◆ handleName

simpleEdmComparison.handleName

Definition at line 153 of file simpleEdmComparison.py.

◆ help

simpleEdmComparison.help

Definition at line 94 of file simpleEdmComparison.py.

◆ label

simpleEdmComparison.label

Definition at line 126 of file simpleEdmComparison.py.

◆ level

simpleEdmComparison.level

Setup Options ##.

Definition at line 86 of file simpleEdmComparison.py.

◆ lName

simpleEdmComparison.lName

◆ mismatches

simpleEdmComparison.mismatches

Definition at line 145 of file simpleEdmComparison.py.

◆ modeGroup

simpleEdmComparison.modeGroup

Definition at line 89 of file simpleEdmComparison.py.

◆ numEvents

simpleEdmComparison.numEvents

◆ objName

simpleEdmComparison.objName

Definition at line 125 of file simpleEdmComparison.py.

◆ options

simpleEdmComparison.options

Definition at line 116 of file simpleEdmComparison.py.

◆ optionsGroup

simpleEdmComparison.optionsGroup

Definition at line 91 of file simpleEdmComparison.py.

◆ parser

simpleEdmComparison.parser

Definition at line 88 of file simpleEdmComparison.py.

◆ plagerDict

simpleEdmComparison.plagerDict

Definition at line 159 of file simpleEdmComparison.py.

◆ productsCompared

simpleEdmComparison.productsCompared

Definition at line 143 of file simpleEdmComparison.py.

◆ tName

simpleEdmComparison.tName

◆ totalCount

simpleEdmComparison.totalCount

◆ tupleGroup

simpleEdmComparison.tupleGroup

Definition at line 90 of file simpleEdmComparison.py.

◆ type

simpleEdmComparison.type

Definition at line 96 of file simpleEdmComparison.py.

◆ typeMap

simpleEdmComparison.typeMap

Definition at line 16 of file simpleEdmComparison.py.

Referenced by edm::TypeWithDict.byName().

Handle
compareEvents
bool compareEvents(Event *e1, Event *e2)
Definition: Forest.cc:165