CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
simpleEdmComparison Namespace Reference

Classes

class  ProductNotFoundError
 

Functions

def compareEvents
 

Variables

string action = 'append'
 
tuple chain1 = Events([options.file1], forceEvent=True)
 
tuple chain2 = Events([options.file2], forceEvent=True)
 
int default = 1
 
string help = 'Compare tuple1 to tuple2'
 
tuple label = lName.split(',')
 
int mismatches = 0
 
tuple modeGroup = optparse.OptionGroup(parser, "Mode Conrols")
 
tuple numEvents = min(options.numEvents, chain1.size())
 
tuple optionsGroup = optparse.OptionGroup(parser, "Options")
 
tuple parser = optparse.OptionParser("usage: %prog [options] config.txt file1.root file2.root\nVisit https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePhysicsToolsEdmOneToOneComparison\nfor full documentation.")
 Setup Options ##. More...
 
dictionary plagerDict = {'eventsCompared' : count+1}
 
int productsCompared = 0
 
int totalCount = 0
 
tuple tupleGroup = optparse.OptionGroup(parser, "Tuple Controls")
 
dictionary typeMap
 

Function Documentation

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

Definition at line 25 of file simpleEdmComparison.py.

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

Variable Documentation

string simpleEdmComparison.action = 'append'

Definition at line 101 of file simpleEdmComparison.py.

tuple simpleEdmComparison.chain1 = Events([options.file1], forceEvent=True)

Definition at line 134 of file simpleEdmComparison.py.

tuple simpleEdmComparison.chain2 = Events([options.file2], forceEvent=True)

Definition at line 135 of file simpleEdmComparison.py.

float simpleEdmComparison.default = 1

Definition at line 97 of file simpleEdmComparison.py.

string simpleEdmComparison.help = 'Compare tuple1 to tuple2'

Definition at line 94 of file simpleEdmComparison.py.

tuple simpleEdmComparison.label = lName.split(',')

Definition at line 126 of file simpleEdmComparison.py.

int simpleEdmComparison.mismatches = 0

Definition at line 145 of file simpleEdmComparison.py.

tuple simpleEdmComparison.modeGroup = optparse.OptionGroup(parser, "Mode Conrols")

Definition at line 89 of file simpleEdmComparison.py.

tuple simpleEdmComparison.numEvents = min(options.numEvents, chain1.size())

Definition at line 139 of file simpleEdmComparison.py.

Referenced by hcaldqm::RawRunSummary.endLuminosityBlock(), and hcaldqm::DigiRunSummary.endLuminosityBlock().

tuple simpleEdmComparison.optionsGroup = optparse.OptionGroup(parser, "Options")

Definition at line 91 of file simpleEdmComparison.py.

tuple simpleEdmComparison.parser = optparse.OptionParser("usage: %prog [options] config.txt file1.root file2.root\nVisit https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePhysicsToolsEdmOneToOneComparison\nfor full documentation.")

Setup Options ##.

Definition at line 88 of file simpleEdmComparison.py.

dictionary simpleEdmComparison.plagerDict = {'eventsCompared' : count+1}

Definition at line 159 of file simpleEdmComparison.py.

int simpleEdmComparison.productsCompared = 0

Definition at line 143 of file simpleEdmComparison.py.

int simpleEdmComparison.totalCount = 0

Definition at line 144 of file simpleEdmComparison.py.

Referenced by cms::DDCMSDetElementCreator.~DDCMSDetElementCreator().

tuple simpleEdmComparison.tupleGroup = optparse.OptionGroup(parser, "Tuple Controls")

Definition at line 90 of file simpleEdmComparison.py.

dictionary simpleEdmComparison.typeMap
Initial value:
1 = { 'double' : ['double', 'vector<double>'],
2  'int' : ['int', 'vector<int>'],}

Definition at line 16 of file simpleEdmComparison.py.