heppyResult = HeppyResult(args.heppydir) for component in heppyResult.components(): counts1 = Counts() counter1 = Counter(keyComposer1, counts1, nextKeyComposer1) collector1.addReader(component.name, counter1) counts2 = Counts() counter2 = Counter(keyComposer2, counts2, nextKeyComposer2) collector2.addReader(component.name, counter2) counts3 = Counts() counter3 = Counter(keyComposer3, counts3, nextKeyComposer3) collector3.addReader(component.name, counter3) events = eventBuilder.build(component) counter1.begin(events) counter2.begin(events) counter3.begin(events) for event in events: report = ProgressReport(component.name, event.iEvent + 1, event.nEvents) progressReporter.report(report) counter1.event(event) counter2.event(event) counter3.event(event)
eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents) outFile = open(outPath, 'w') print >> outFile, "{:>22s} {:>12s} {:>6s}".format("component", "met", "n") for componentName in os.listdir(args.heppydir): if componentName in ('Chunks', 'failed'): continue componentPath = os.path.join(args.heppydir, componentName) if not os.path.isdir(componentPath): continue component = Component(componentPath) boundaries = [10**(i * 0.1) for i in range(-10, 36)] counts = {} for event in eventBuilder.build(component): met = event.met_pt met_bin = max([b for b in boundaries if b < met]) if not met_bin in counts: counts[met_bin] = 0 counts[met_bin] += 1 keys = counts.keys() keys.sort() for k in keys: print >> outFile, "{:>22s} {:12.6f} {:6d}".format( componentName, k, counts[k]) ##__________________________________________________________________||