closure = Closure()
    closure.fillData('True', input_files, treeTrue, 'mt', 'Weight',
                     global_weights)
    closure.fillData('Est', input_files, treeEst, 'mt', 'Weight',
                     global_weights)

    closure.computeCDF('True')
    closure.computeCDF('Est')
    forceLowMTLinearDistance(closure, 'True')
    forceLowMTLinearDistance(closure, 'Est')

    for name, bins in mt_bins.items():
        plotClosure(fakeType + '_' + name,
                    closure,
                    bins,
                    smoothWidth=0.1,
                    kernelDistance='Adapt',
                    doErrors=True,
                    xTitle='m_{T} [GeV]')

    #plotSummary(fakeType, closure, 0, 250, xTitle='m_{T} [GeV]')

    output_file.cd()
    writeCorrectionAnderrors(closure, fakeType, output_file)
    closure.clearData()
    closures[fakeType] = closure
    #closure.data['True']['CDF'].Write()
    #closure.data['Est']['CDF'].Write()

plotDataMC('DataMC',
           closures['Data'],
    global_weights = inputs['Weights']
    treeEst    = inputs['TreeEst']
    treeTrue   = inputs['TreeTrue']

    closure = Closure()
    closure.fillData('True', input_files, treeTrue, 'mt', 'Weight', global_weights)
    closure.fillData('Est', input_files, treeEst, 'mt', 'Weight', global_weights)

    closure.computeCDF('True')
    closure.computeCDF('Est')
    forceLowMTLinearDistance(closure, 'True')
    forceLowMTLinearDistance(closure, 'Est')


    for name,bins in mt_bins.items():
        plotClosure(fakeType+'_'+name, closure, bins, smoothWidth=0.1, kernelDistance='Adapt', doErrors=True, xTitle='m_{T} [GeV]')

    #for nbins in [100,50,25]:
        #cdf = closure.data['True']['CDFInvert']
        #bins = [cdf.Eval(i/float(nbins)) for i in xrange(nbins+1)]
        #plotClosure(fakeType+'_NBins'+str(nbins), closure, bins)

    plotSummary(fakeType, closure, 0, 250, xTitle='m_{T} [GeV]')

    output_file.cd()
    writeCorrectionAnderrors(closure, output_file)
    #closure.data['True']['CDF'].Write()
    #closure.data['Est']['CDF'].Write()


    #canvas.Write()
Ejemplo n.º 3
0
setPlotStyle()
for fakeType,inputs in closure_inputs.items():
    input_files = inputs['Files']
    global_weights = inputs['Weights']
    treeEst    = inputs['TreeEst']
    treeTrue   = inputs['TreeTrue']

    closure = Closure()
    closure.fillData('True', input_files, treeTrue, 'mvis', 'Weight', global_weights)
    closure.fillData('Est', input_files, treeEst, 'mvis', 'Weight', global_weights)

    closure.computeCDF('True')
    closure.computeCDF('Est')

    for name,bins in mvis_bins.items():
        plotClosure(fakeType+'_'+name, closure, bins, doErrors=True)

    #for nbins in [100,50,25]:
        #cdf = closure.data['True']['CDFInvert']
        #bins = [cdf.Eval(i/float(nbins)) for i in xrange(nbins+1)]
        #plotClosure(fakeType+'_NBins'+str(nbins), closure, bins)

    plotSummary(fakeType, closure, 0, 600)

    #
    writeNonClosure(closure, output_file, '{FAKETYPE}_Histo_Smooth_Ratio'.format(FAKETYPE=fakeType))

    #canvas.Write()
    ##cdfTrue.SetName('{FAKETYPE}_CDF_True'.format(FAKETYPE=fakeType))
    ##cdfEst.SetName('{FAKETYPE}_CDF_Est'.format(FAKETYPE=fakeType))
    #histoTrue.SetName('{FAKETYPE}_Histo_True_{H}'.format(FAKETYPE=fakeType,H=binid))
Ejemplo n.º 4
0
setPlotStyle()
for fakeType,inputs in closure_inputs.items():
    input_files = inputs['Files']
    global_weights = inputs['Weights']
    treeEst    = inputs['TreeEst']
    treeTrue   = inputs['TreeTrue']

    closure = Closure()
    closure.fillData('True', input_files, treeTrue, 'mvis', 'Weight', global_weights)
    closure.fillData('Est', input_files, treeEst, 'mvis', 'Weight', global_weights)

    closure.computeCDF('True')
    closure.computeCDF('Est')

    for name,bins in mvis_bins.items():
        plotClosure(fakeType+'_'+name, closure, bins, doErrors=True)

    #for nbins in [100,50,25]:
        #cdf = closure.data['True']['CDFInvert']
        #bins = [cdf.Eval(i/float(nbins)) for i in xrange(nbins+1)]
        #plotClosure(fakeType+'_NBins'+str(nbins), closure, bins)

    plotSummary(fakeType, closure, 0, 350)

    #
    writeNonClosure(closure, output_file, '{FAKETYPE}_Histo_Smooth_Ratio'.format(FAKETYPE=fakeType))

    #canvas.Write()
    ##cdfTrue.SetName('{FAKETYPE}_CDF_True'.format(FAKETYPE=fakeType))
    ##cdfEst.SetName('{FAKETYPE}_CDF_Est'.format(FAKETYPE=fakeType))
    #histoTrue.SetName('{FAKETYPE}_Histo_True_{H}'.format(FAKETYPE=fakeType,H=binid))