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 ##. | |
dictionary | plagerDict = {'eventsCompared' : count+1} |
int | productsCompared = 0 |
int | totalCount = 0 |
tuple | tupleGroup = optparse.OptionGroup(parser, "Tuple Controls") |
dictionary | typeMap |
def simpleEdmComparison::compareEvents | ( | event1, | |
event2, | |||
handleName, | |||
label, | |||
options | |||
) |
Compare two events
Definition at line 23 of file simpleEdmComparison.py.
00024 : 00025 """ 00026 Compare two events 00027 """ 00028 00029 # Is it a vector of objects or object (funky ROOT buffer for single value) 00030 isSimpleObject = (handleName.find('vector') == -1) 00031 00032 # Compare run, lumi, event 00033 aux1 = event1.eventAuxiliary() 00034 aux2 = event2.eventAuxiliary() 00035 00036 rle1 = (aux1.run(), aux1.luminosityBlock(), aux1.event()) 00037 rle2 = (aux2.run(), aux2.luminosityBlock(), aux2.event()) 00038 00039 logging.debug("Comparing RLE #'s %s and %s" % (rle1, rle2)) 00040 00041 if rle1 != rle2: 00042 raise RuntimeError("Run/Lumi/Events don't match: %s vs %s" % (rle1, rle2)) 00043 handle1 = Handle(handleName) 00044 handle2 = Handle(handleName) 00045 00046 if event1.getByLabel(label, handle1) and event2.getByLabel(label, handle2): 00047 objects1 = handle1.product() 00048 objects2 = handle1.product() 00049 else: 00050 raise ProductNotFoundError("Product %s %s not found." % (handleName, label)) 00051 00052 if isSimpleObject: 00053 val1 = objects1[0] 00054 val2 = objects2[0] 00055 if options.blurRate and options.blur and random.random() < options.blurRate: 00056 # This is different than Charles's method, which makes no sense to me 00057 val1 += (random.random()-0.5) * options.blur 00058 if val1 != val2: 00059 logging.error("Mismatch %s and %s in %s" % (val1, val2, aux2.event())) 00060 return (1, 1) 00061 else: 00062 logging.debug("Match of %s in %s" % (objects1[0], aux2.event())) 00063 return (1, 0) 00064 else: 00065 count = 0 00066 mismatch = 0 00067 for val1, val2 in itertools.izip_longest(objects1, objects2): 00068 count += 1 00069 if options.blurRate and options.blur and random.random() < options.blurRate: 00070 # This is different than Charles's method, which makes no sense to me 00071 val1 += (random.random()-0.5) * options.blur * val1 00072 if val1 != val2: 00073 mismatch += 1 00074 logging.error("Comparison problem %s != %s" % (val1, val2)) 00075 logging.debug("Compared %s elements" % count) 00076 return (count, mismatch)
string simpleEdmComparison::action = 'append' |
Definition at line 99 of file simpleEdmComparison.py.
tuple simpleEdmComparison::chain1 = Events([options.file1], forceEvent=True) |
Definition at line 132 of file simpleEdmComparison.py.
tuple simpleEdmComparison::chain2 = Events([options.file2], forceEvent=True) |
Definition at line 133 of file simpleEdmComparison.py.
float simpleEdmComparison::default = 1 |
Definition at line 95 of file simpleEdmComparison.py.
string simpleEdmComparison::help = 'Compare tuple1 to tuple2' |
Definition at line 92 of file simpleEdmComparison.py.
tuple simpleEdmComparison::label = lName.split(',') |
Definition at line 124 of file simpleEdmComparison.py.
int simpleEdmComparison::mismatches = 0 |
Definition at line 143 of file simpleEdmComparison.py.
tuple simpleEdmComparison::modeGroup = optparse.OptionGroup(parser, "Mode Conrols") |
Definition at line 87 of file simpleEdmComparison.py.
tuple simpleEdmComparison::numEvents = min(options.numEvents, chain1.size()) |
Definition at line 137 of file simpleEdmComparison.py.
tuple simpleEdmComparison::optionsGroup = optparse.OptionGroup(parser, "Options") |
Definition at line 89 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 86 of file simpleEdmComparison.py.
dictionary simpleEdmComparison::plagerDict = {'eventsCompared' : count+1} |
Definition at line 157 of file simpleEdmComparison.py.
Definition at line 141 of file simpleEdmComparison.py.
int simpleEdmComparison::totalCount = 0 |
Definition at line 142 of file simpleEdmComparison.py.
Referenced by SiStripDetVOff::getHVoffCounts(), and SiStripDetVOff::getLVoffCounts().
tuple simpleEdmComparison::tupleGroup = optparse.OptionGroup(parser, "Tuple Controls") |
Definition at line 88 of file simpleEdmComparison.py.
dictionary simpleEdmComparison::typeMap |
00001 { 'double' : ['double', 'vector<double>'], 00002 'int' : ['int', 'vector<int>'],}
Definition at line 14 of file simpleEdmComparison.py.
Referenced by edm::TypeWithDict::byName().