nextKeyComposer3 = NextKeyComposer((binning31, binning32)) resultsCombinationMethod3 = CombineIntoList(('njets', 'nbjets')) deliveryMethod3 = WriteListToFile(outPath3) collector3 = Collector(resultsCombinationMethod3, deliveryMethod3) eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents) progressBar = ProgressBar() progressMonitor = ProgressMonitor(progressBar) progressReporter = progressMonitor.createReporter() 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)
"-n", "--nevents", default=-1, type=int, help="maximum number of events to process for each component") args = parser.parse_args() analyzerName = 'treeProducerSusyAlphaT' fileName = 'tree.root' treeName = 'tree' outPath1 = os.path.join(args.outdir, 'tbl_met.txt') binning1 = RoundLog(0.1, 1) keyComposer1 = GenericKeyComposer(('met_pt', ), (binning1, )) nextKeyComposer1 = NextKeyComposer((binning1, )) counter1 = Counter(keyComposer1, Counts(), nextKeyComposer1) resultsCombinationMethod1 = CombineIntoList(('met', )) deliveryMethod1 = WriteListToFile(outPath1) collector1 = Collector(resultsCombinationMethod1, deliveryMethod1) associator1 = Associator(counter1, collector1) outPath2 = os.path.join(args.outdir, 'tbl_jetpt.txt') binning2 = RoundLog(0.1, 1) keyComposer2 = GenericKeyComposer(('jet_pt', ), (binning2, ), (0, )) nextKeyComposer2 = NextKeyComposer((binning2, )) counter2 = Counter(keyComposer2, Counts(), nextKeyComposer2) resultsCombinationMethod2 = CombineIntoList(('jet_pt', )) deliveryMethod2 = WriteListToFile(outPath2) collector2 = Collector(resultsCombinationMethod2, deliveryMethod2) associator2 = Associator(counter2, collector2)
collector1 = Collector(resultsCombinationMethod1, deliveryMethod1) outPath2 = os.path.join(args.outdir, 'tbl_jetpt.txt') binning2 = RoundLog(0.1, 1) keyComposer2 = GenericKeyComposer(('jet_pt', ), (binning2, ), (0, )) resultsCombinationMethod2 = CombineIntoList(('jet_pt', )) deliveryMethod2 = WriteListToFile(outPath2) collector2 = Collector(resultsCombinationMethod2, deliveryMethod2) eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents) heppyResult = HeppyResult(args.heppydir) for component in heppyResult.components(): counts1 = Counts() counter1 = Counter(keyComposer1, counts1) collector1.addReader(component.name, counter1) counts2 = Counts() counter2 = Counter(keyComposer2, counts2) collector2.addReader(component.name, counter2) events = eventBuilder.build(component) for event in events: counter1.event(event) counter2.event(event) collector1.collect() collector2.collect() ##__________________________________________________________________||
analyzerName = 'treeProducerSusyAlphaT' fileName = 'tree.root' treeName = 'tree' outPath = os.path.join(args.outdir, 'tbl_met.txt') binning = RoundLog(0.1, 1) keyComposer = GenericKeyComposer(('met_pt', ), (binning, )) resultsCombinationMethod = CombineIntoList(('met', )) deliveryMethod = WriteListToFile(outPath) datasetReaderPairs = [] eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents) heppyResult = HeppyResult(args.heppydir) for component in heppyResult.components(): counts = Counts() counter = Counter(keyComposer, counts) datasetReaderPairs.append((component.name, counter)) events = eventBuilder.build(component) for event in events: counter.event(event) results = resultsCombinationMethod.combine(datasetReaderPairs) deliveryMethod.deliver(results) ##__________________________________________________________________||