Пример #1
0
def makeClosureErrorTable():
    for channel in channels:
        print "CHANNEL :", channel
        for variable in variables:
            print "--->", variable
            for whichBin in range(0, len(bin_edges[variable]) - 1):
                fitResults = {}

                for process in processes:
                    fitResults[process] = []
                    for fitVariable in fitVariableCombinations:
                        # Read fit results
                        dir = "data/" + fitVariable + "/" + com + "/"
                        if closureTest:
                            dir = "data/closure_test/simple/" + fitVariable + "/" + com + "/"
                        fit_results_ = read_fit_results(dir, variable, "central", channel, "patType1CorrectedPFMet")
                        fitResults[process].append(fit_results_[process][whichBin])
                        pass
                    pass

                for process in processes:
                    line = samples_latex[process] + " "

                    for fit in fitResults[process]:
                        line += "& %.0f \pm %.1f " % (fit[0], fit[1])
                        pass
                    line += " \\\\"
                    print line
                    pass
                print "\n"
                pass
            print "\n"
            pass
        pass
    pass
Пример #2
0
def makeClosureTestTable():
    fitVariable = "absolute_eta_M3_angle_bl"
    for channel in channels:
        print "CHANNEL :", channel
        for variable in variables:
            print "--->", variable
            # Read fit results
            dir = "data/" + fitVariable + "/" + com + "/"
            if closureTest:
                dir = "data/closure_test/simple/" + fitVariable + "/" + com + "/"
            fit_results = read_fit_results(dir, variable, "central", channel, "patType1CorrectedPFMet")
            # Read initial values
            initial_values = read_fit_input(dir, variable, "central", channel, "patType1CorrectedPFMet")

            #             for whichBin in range (0,len(bin_edges[variable])-1):
            for whichBin in range(0, 1):
                for process in processes:
                    scale = closure_tests["simple"][process]

                    line = "%s " % (samples_latex[process])
                    line += "& %.0f " % initial_values[process][whichBin][0]
                    line += "& %.0f " % (initial_values[process][whichBin][0] * scale)
                    line += "& %.0f \pm %.0f " % (fit_results[process][whichBin][0], fit_results[process][whichBin][1])
                    line += "\\\\"
                    print line
                    #                     print process
                    #                     print scale
                    #                     print initial_values[process][whichBin][0]
                    #                     print initial_values[process][whichBin][0]*scale
                    #                     print fit_results[process][whichBin][0],'+/-',fit_results[process][whichBin][1]

                    pass
                pass
            print "\n"
            pass
        pass
    pass
                       'M3': {'min':0, 'max':1000, 'rebin':5, 'x-title': 'M3 [GeV]', 'y-title': 'Events/25 GeV'},
                       'angle_bl': {'min':0, 'max':3.5, 'rebin':2, 'x-title': 'angle(b,l)', 'y-title': 'Events/(0.2)'},
                       'absolute_eta': {'min':0, 'max':2.6, 'rebin':2, 'x-title': '$\left|\eta(e)\\right|$', 'y-title': 'Events/(0.2)'},
                       }


variables = [ 'MET', 'HT', 'ST', 'WPT', 'MT' ]


for test in closure_tests:
    if test != 'qcd_only' : continue;
    for variable in variables:
        
        fit_results_ = read_fit_results( 'data/closure_test/'+test+'/absolute_eta_M3_angle_bl/8TeV/',
                                    variable,
                                    'central',
                                    'electron',
                                     'patType1CorrectedPFMet' )
    
        fit_templates_ = read_fit_templates( 'data/closure_test/'+test+'/absolute_eta_M3_angle_bl/8TeV/',
                                        variable,
                                        'central',
                                        'electron',
                                         'patType1CorrectedPFMet' )
        
        initial_values_ = read_fit_input( 'data/closure_test/'+test+'/absolute_eta_M3_angle_bl/8TeV/',
                                        variable,
                                        'central',
                                        'electron',
                                         'patType1CorrectedPFMet' )