コード例 #1
0
                                  (binning31, binning32))
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)
コード例 #2
0
ファイル: print_120.py プロジェクト: eshwen/cutflowirl
treeName = 'tree'
outPath = os.path.join(args.outdir, 'tbl_met.txt')

binning = RoundLog(0.1, 1)
keyComposer = GenericKeyComposer(('met_pt', ), (binning, ))

eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents)

outFile = open(outPath, 'w')
columnnames = ("component", "met", "n", "nvar")
print >> outFile, "{:>22s} {:>12s} {:>6s} {:>6s}".format(*columnnames)

heppyResult = HeppyResult(args.heppydir)
for component in heppyResult.components():

    counts = Counts()

    events = eventBuilder.build(component)
    for event in events:

        keys = keyComposer(event)
        for key in keys:
            counts.count(key)

    results = counts.results()
    keys = results.keys()
    keys.sort()
    for k in keys:
        row = (component.name, k[0], results[k]['n'], results[k]['nvar'])
        print >> outFile, "{:>22s} {:12.6f} {:6.0f} {:6.0f}".format(*row)
コード例 #3
0
ファイル: print_150.py プロジェクト: eshwen/cutflowirl
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)

##__________________________________________________________________||
コード例 #4
0
ファイル: print_260.py プロジェクト: eshwen/cutflowirl
    "-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)
コード例 #5
0
analyzerName = 'treeProducerSusyAlphaT'
fileName = 'tree.root'
treeName = 'tree'
outPath = os.path.join(args.outdir, 'tbl_met.txt')

eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents)

outFile = open(outPath, 'w')
columnnames = ("component", "met", "n", "nvar")
print >>outFile, "{:>22s} {:>12s} {:>6s} {:>6s}".format(*columnnames)

heppyResult = HeppyResult(args.heppydir)
for component in heppyResult.components():

    binning = RoundLog(0.1, 1)
    counts = Counts()

    events = eventBuilder.build(component)
    for event in events:

        met = event.met_pt
        met_bin = binning(met)
        counts.count(met_bin)

    results = counts.results()
    keys = results.keys()
    keys.sort()
    for k in  keys:
        row = (component.name, k, results[k]['n'], results[k]['nvar'])
        print >>outFile, "{:>22s} {:12.6f} {:6.0f} {:6.0f}".format(*row)