def get_met_filter_acceptance(passed_list, total, parameters):
    print('')
    print('*** start get_met_filter_acceptance')

    canvas = ROOT.TCanvas("c", "c", 1000, 600)
    canvas.SetLogy()

    n_bins = len(parameters['from_to'])
    bin_width = (parameters['from_to'][-1] - parameters['from_to'][0]) / n_bins
    histo = [
        ROOT.TH1F('histo' + str(x),
                  ';MET_LocHadTopo Threshold [GeV];Acceptance', n_bins,
                  parameters['from_to'][0] - bin_width / 2.,
                  parameters['from_to'][-1] + bin_width / 2.)
        for x in range(len(passed_list))
    ]

    legend = ROOT.TLegend(0.6, 0.50, 0.85, 0.85)
    denominator = total.Integral(0, -1)
    for (ii, passed) in enumerate(passed_list):
        utils.decorate_histogram(histo[ii], BasicConfig.colors[ii])
        for threshold in parameters['from_to']:
            numerator = passed.Integral(passed.FindBin(threshold), -1)
            acceptance, error = utils.division_error_propagation(
                numerator, denominator)
            histo[ii].SetBinContent(histo[ii].FindBin(threshold), acceptance)
            histo[ii].SetBinError(histo[ii].FindBin(threshold), error)
            if ii == 0:
                if 'max_min' in parameters:
                    histo[ii].SetMaximum(parameters['max_min'][0])
                    histo[ii].SetMinimum(parameters['max_min'][1])
                histo[ii].Draw('e1')
            else:
                histo[ii].Draw('same,e1')
        legend.AddEntry(histo[ii], parameters['legend'][ii], 'ple')

    if 'reference' in parameters:
        ref_acceptance = parameters['reference'].Integral(0, -1) / denominator
        print ref_acceptance
        canvas.Update()
        tl = ROOT.TLine(canvas.GetUxmin(), ref_acceptance, canvas.GetUxmax(),
                        ref_acceptance)
        tl.SetLineColor(ROOT.kGray + 1)
        tl.SetLineStyle(2)
        tl.Draw()

    utils.decorate_legend(legend)
    legend.Draw()

    AtlasStyle.ATLASLabel(0.19, 0.85, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, ROOT.kBlack, parameters['label'], 0.035)
    if 'label2' in parameters:
        AtlasStyle.myText(0.20, 0.74, ROOT.kBlack, parameters['label2'], 0.035)

    utils.save_as(
        canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' +
        str(date.today()))
Пример #2
0
    def draw_mass_distributions_and_ratio(self, ntrk, region, h_data, h_model):
        canvas2 = ROOT.TCanvas('canvas2', 'canvas2', 1000, 750)
        # mass distributions
        pad1 = ROOT.TPad('pad1', 'pad1', 0, 0.3, 1, 1.0)
        pad2 = ROOT.TPad('pad2', 'pad2', 0, 0.05, 1, 0.3)
        self.prepare_pads(canvas2, pad1, pad2)

        pad1.cd()
        self.configure_data_histogram(h_data)
        h_data.SetMaximum(h_data.GetMaximum() * 8)
        self.configure_model_histogram(h_model)
        h_data.Draw('e')
        h_model.SetLineWidth(2)
        h_model.Draw('same,hist')
        h_data.Draw('same,e')
        # list_diff3[ipad-1].SetLineWidth(2)
        AtlasStyle.ATLASLabel(self.ax, self.ay, 'Work in Progress')
        AtlasStyle.myText(self.tx, self.ty, ROOT.kBlack, self.beam_condition,
                          0.038)
        leg = ROOT.TLegend(self.x_min, self.y_min, self.x_max, self.y_max)
        leg.AddEntry(h_data,
                     str(ntrk) + '-trk vertices Region' + str(region), 'lep')
        leg.AddEntry(h_model,
                     str(ntrk - 1) + '-trk vert + 1 random track', 'f')
        utils.decorate_legend(leg)
        leg.Draw()

        line = ROOT.TLine(self.m_cut, h_data.GetMinimum(), self.m_cut,
                          h_data.GetMaximum() * 0.1)
        utils.decorate_line(line, ROOT.kGray + 1, 5)
        line.Draw()

        # Ratio plot
        pad2.cd()
        h_ratio = h_data.Clone(str(ntrk) + 'trk_ratio' + str(region))
        h_ratio.Sumw2()
        h_ratio.Divide(h_model)
        self.decorate_ratio_plot(h_ratio, 0.1, 1.9)
        h_ratio.Draw('e2p')
        line2 = ROOT.TLine(self.m_cut, h_ratio.GetMinimum(), self.m_cut,
                           h_ratio.GetMaximum())
        utils.decorate_line(line2, ROOT.kGray + 1, 5)
        line2.Draw()

        directory = BasicConfig.plotdir + 'bg_est/' + str(date.today())
        os.system('mkdir -p ' + directory)
        utils.save_as(
            canvas2,
            directory + '/pseudoFit_' + str(ntrk) + 'Trk_Region' + str(region))
        canvas2.Close()
def get_met_filter_acceptance(passed_list, total, parameters):
    print('')
    print('*** start get_met_filter_acceptance')

    canvas = ROOT.TCanvas("c", "c", 1000, 600)
    canvas.SetLogy()

    n_bins = len(parameters['from_to'])
    bin_width = (parameters['from_to'][-1] - parameters['from_to'][0]) / n_bins
    histo = [ROOT.TH1F('histo' + str(x), ';MET_LocHadTopo Threshold [GeV];Acceptance', n_bins,
                       parameters['from_to'][0] - bin_width / 2.,
                       parameters['from_to'][-1] + bin_width / 2.) for x in range(len(passed_list))]

    legend = ROOT.TLegend(0.6, 0.50, 0.85, 0.85)
    denominator = total.Integral(0, -1)
    for (ii, passed) in enumerate(passed_list):
        utils.decorate_histogram(histo[ii], BasicConfig.colors[ii])
        for threshold in parameters['from_to']:
            numerator = passed.Integral(passed.FindBin(threshold), -1)
            acceptance, error = utils.division_error_propagation(numerator, denominator)
            histo[ii].SetBinContent(histo[ii].FindBin(threshold), acceptance)
            histo[ii].SetBinError(histo[ii].FindBin(threshold), error)
            if ii == 0:
                if 'max_min' in parameters:
                    histo[ii].SetMaximum(parameters['max_min'][0])
                    histo[ii].SetMinimum(parameters['max_min'][1])
                histo[ii].Draw('e1')
            else:
                histo[ii].Draw('same,e1')
        legend.AddEntry(histo[ii], parameters['legend'][ii], 'ple')

    if 'reference' in parameters:
        ref_acceptance = parameters['reference'].Integral(0, -1) / denominator
        print ref_acceptance
        canvas.Update()
        tl = ROOT.TLine(canvas.GetUxmin(), ref_acceptance, canvas.GetUxmax(), ref_acceptance)
        tl.SetLineColor(ROOT.kGray+1)
        tl.SetLineStyle(2)
        tl.Draw()

    utils.decorate_legend(legend)
    legend.Draw()

    AtlasStyle.ATLASLabel(0.19, 0.85, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, ROOT.kBlack, parameters['label'], 0.035)
    if 'label2' in parameters:
        AtlasStyle.myText(0.20, 0.74, ROOT.kBlack, parameters['label2'], 0.035)

    utils.save_as(canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' + str(date.today()))
def superpose_tocs(passed_list, total, parameters):
    print('')
    print('*** start create_toc_plot')

    #if len(passed_list) != len(total_list):
    #    print('lengths of passed_list and total_list are different.')
    #    print('aborted.')
    #    sys.exit()

    canvas = ROOT.TCanvas("c", "c", 1000, 600)

    legend = ROOT.TLegend(0.6, 0.20, 0.85, 0.60)
    tgs = []
    for index, passed in enumerate(passed_list):
        if 'rebin' in parameters:
            passed.Rebin(parameters['rebin'])
            if index == 0:  # only once
                if passed.GetNbinsX() != total.GetNbinsX():
                    total.Rebin(parameters['rebin'])
        tg = ROOT.TGraphAsymmErrors(passed, total)
        utils.decorate_histogram(tg, BasicConfig.colors[index])
        if index == 0:
            tg.SetMaximum(1.09)
            tg.GetXaxis().SetRangeUser(0, 400)
            tg.GetYaxis().SetTitle('Efficiency')
            if 'x_title' in parameters:
                tg.GetXaxis().SetTitle(parameters['x_title'])
            tg.Draw('AP')
        else:
            tg.Draw('P,same')
        legend.AddEntry(tg, parameters['legend'][index], 'pl')
        tgs.append(tg)  # stored temporarily

    utils.decorate_legend(legend)
    legend.Draw()

    AtlasStyle.ATLASLabel(0.19, 0.85, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, ROOT.kBlack, parameters['label'], 0.035)
    if 'label2' in parameters:
        AtlasStyle.myText(0.20, 0.74, ROOT.kBlack, parameters['label2'], 0.035)

    utils.save_as(
        canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' +
        str(date.today()))
Пример #5
0
    def draw_mass_distributions_and_ratio(self, ntrk, region, h_data, h_model):
        canvas2 = ROOT.TCanvas('canvas2', 'canvas2', 1000, 750)
        # mass distributions
        pad1 = ROOT.TPad('pad1', 'pad1', 0, 0.3, 1, 1.0)
        pad2 = ROOT.TPad('pad2', 'pad2', 0, 0.05, 1, 0.3)
        self.prepare_pads(canvas2, pad1, pad2)

        pad1.cd()
        self.configure_data_histogram(h_data)
        h_data.SetMaximum(h_data.GetMaximum() * 8)
        self.configure_model_histogram(h_model)
        h_data.Draw('e')
        h_model.SetLineWidth(2)
        h_model.Draw('same,hist')
        h_data.Draw('same,e')
        # list_diff3[ipad-1].SetLineWidth(2)
        AtlasStyle.ATLASLabel(self.ax, self.ay, 'Work in Progress')
        AtlasStyle.myText(self.tx, self.ty, ROOT.kBlack, self.beam_condition, 0.038)
        leg = ROOT.TLegend(self.x_min, self.y_min, self.x_max, self.y_max)
        leg.AddEntry(h_data, str(ntrk) + '-trk vertices Region' + str(region), 'lep')
        leg.AddEntry(h_model, str(ntrk-1) + '-trk vert + 1 random track', 'f')
        utils.decorate_legend(leg)
        leg.Draw()

        line = ROOT.TLine(self.m_cut, h_data.GetMinimum(), self.m_cut, h_data.GetMaximum() * 0.1)
        utils.decorate_line(line, ROOT.kGray+1, 5)
        line.Draw()

        # Ratio plot
        pad2.cd()
        h_ratio = h_data.Clone(str(ntrk) + 'trk_ratio' + str(region))
        h_ratio.Sumw2()
        h_ratio.Divide(h_model)
        self.decorate_ratio_plot(h_ratio, 0.1, 1.9)
        h_ratio.Draw('e2p')
        line2 = ROOT.TLine(self.m_cut, h_ratio.GetMinimum(), self.m_cut, h_ratio.GetMaximum())
        utils.decorate_line(line2, ROOT.kGray+1, 5)
        line2.Draw()

        directory = BasicConfig.plotdir + 'bg_est/' + str(date.today())
        os.system('mkdir -p ' + directory)
        utils.save_as(canvas2, directory + '/pseudoFit_' + str(ntrk) + 'Trk_Region' + str(region))
        canvas2.Close()
def superpose_tocs(passed_list, total, parameters):
    print('')
    print('*** start create_toc_plot')

    #if len(passed_list) != len(total_list):
    #    print('lengths of passed_list and total_list are different.')
    #    print('aborted.')
    #    sys.exit()

    canvas = ROOT.TCanvas("c", "c", 1000, 600)

    legend = ROOT.TLegend(0.6, 0.20, 0.85, 0.60)
    tgs = []
    for index, passed in enumerate(passed_list):
        if 'rebin' in parameters:
            passed.Rebin(parameters['rebin'])
            if index == 0:  # only once
                if passed.GetNbinsX() != total.GetNbinsX():
                    total.Rebin(parameters['rebin'])
        tg = ROOT.TGraphAsymmErrors(passed, total)
        utils.decorate_histogram(tg, BasicConfig.colors[index])
        if index == 0:
            tg.SetMaximum(1.09)
            tg.GetXaxis().SetRangeUser(0, 400)
            tg.GetYaxis().SetTitle('Efficiency')
            if 'x_title' in parameters:
                tg.GetXaxis().SetTitle(parameters['x_title'])
            tg.Draw('AP')
        else:
            tg.Draw('P,same')
        legend.AddEntry(tg, parameters['legend'][index], 'pl')
        tgs.append(tg)  # stored temporarily

    utils.decorate_legend(legend)
    legend.Draw()

    AtlasStyle.ATLASLabel(0.19, 0.85, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, ROOT.kBlack, parameters['label'], 0.035)
    if 'label2' in parameters:
        AtlasStyle.myText(0.20, 0.74, ROOT.kBlack, parameters['label2'], 0.035)

    utils.save_as(canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' + str(date.today()))
def compare_signal_efficiencies_2d(passed, ref, total, dsids, parameters):
    print('')
    print('*** start compare_signal_efficiencies')

    canvas = ROOT.TCanvas("c", "c", 1000, 600)
    canvas.SetLogz()

    y_labels = ['30', '50', '80', '130', 'M_{#tilde{g}} - 100']
    histo = ROOT.TH2F('histo', ';M_{#tilde{g}} [GeV];#DeltaM [GeV]', 8, 500,
                      2100, 5, 0, 5)
    histo_ref = ROOT.TH2F('histo_ref', ';M_{#tilde{g}} [GeV];#Delta M', 8, 500,
                          2100, 5, 0, 5)
    for ii, y_label in enumerate(y_labels):
        histo.GetYaxis().SetBinLabel(ii + 1, y_label)
        histo_ref.GetYaxis().SetBinLabel(ii + 1, y_label)

    for ii, (met, trackless, all,
             dsid) in enumerate(zip(passed, ref, total, dsids)):
        numerator = met[8].Integral(met[8].FindBin(250), -1)
        reference = trackless[0].Integral(trackless[0].FindBin(220), -1)
        denominator = all[0].Integral(0, -1)
        print(numerator, reference, denominator)
        m_g = mc.parameters[dsid]['g']
        m_chi0 = mc.parameters[dsid]['chi0']
        dM = m_g - m_chi0 if m_chi0 != 100 else 'M_{#tilde{g}} - 100'
        histo.Fill(mc.parameters[dsid]['g'], str(dM), numerator / denominator)
        histo_ref.Fill(mc.parameters[dsid]['g'], str(dM),
                       reference / denominator)

    histo.Draw('colz,TEXT45')
    utils.save_as(
        canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' +
        str(date.today()))

    canvas_ref = ROOT.TCanvas("c_ref", "c_ref", 1000, 600)
    canvas_ref.SetLogz()
    histo_ref.Draw('colz,TEXT45')
    utils.save_as(
        canvas_ref, BasicConfig.plotdir + parameters['plot_name_ref'] + '_' +
        str(date.today()))

    canvas_ratio = ROOT.TCanvas("c_ratio", "c_ratio", 1000, 600)
    canvas_ratio.SetLogz()
    histo.Divide(histo_ref)
    histo.Draw('colz,TEXT45')
    utils.save_as(
        canvas_ratio, BasicConfig.plotdir + parameters['plot_name_ratio'] +
        '_' + str(date.today()))
def compare_signal_efficiencies_2d(passed, ref, total, dsids, parameters):
    print('')
    print('*** start compare_signal_efficiencies')

    canvas = ROOT.TCanvas("c", "c", 1000, 600)
    canvas.SetLogz()

    y_labels = ['30', '50', '80', '130', 'M_{#tilde{g}} - 100']
    histo = ROOT.TH2F('histo', ';M_{#tilde{g}} [GeV];#DeltaM [GeV]', 8, 500, 2100, 5, 0, 5)
    histo_ref = ROOT.TH2F('histo_ref', ';M_{#tilde{g}} [GeV];#Delta M', 8, 500, 2100, 5, 0, 5)
    for ii, y_label in enumerate(y_labels):
        histo.GetYaxis().SetBinLabel(ii+1, y_label)
        histo_ref.GetYaxis().SetBinLabel(ii+1, y_label)

    for ii, (met, trackless, all, dsid) in enumerate(zip(passed, ref, total, dsids)):
        numerator = met[8].Integral(met[8].FindBin(250), -1)
        reference = trackless[0].Integral(trackless[0].FindBin(220), -1)
        denominator = all[0].Integral(0, -1)
        print(numerator, reference, denominator)
        m_g = mc.parameters[dsid]['g']
        m_chi0 = mc.parameters[dsid]['chi0']
        dM = m_g - m_chi0 if m_chi0 != 100 else 'M_{#tilde{g}} - 100'
        histo.Fill(mc.parameters[dsid]['g'], str(dM), numerator / denominator)
        histo_ref.Fill(mc.parameters[dsid]['g'], str(dM), reference / denominator)

    histo.Draw('colz,TEXT45')
    utils.save_as(canvas, BasicConfig.plotdir + parameters['plot_name'] + '_' + str(date.today()))

    canvas_ref = ROOT.TCanvas("c_ref", "c_ref", 1000, 600)
    canvas_ref.SetLogz()
    histo_ref.Draw('colz,TEXT45')
    utils.save_as(canvas_ref, BasicConfig.plotdir + parameters['plot_name_ref'] + '_' + str(date.today()))

    canvas_ratio = ROOT.TCanvas("c_ratio", "c_ratio", 1000, 600)
    canvas_ratio.SetLogz()
    histo.Divide(histo_ref)
    histo.Draw('colz,TEXT45')
    utils.save_as(canvas_ratio, BasicConfig.plotdir + parameters['plot_name_ratio'] + '_' + str(date.today()))
Пример #9
0
def draw_cross_section_limit_dM(tree, dM, flavor_of_sample='MET_TLJets'):
    AtlasStyle.SetAtlasStyle()
    entries = tree.GetEntries()
    current_mass = 0
    upper_limits = []
    mass_g = []
    index = -1
    point = 0
    for entry in range(entries):
        tree.GetEntry(entry)
        if tree.deltaM == dM or (dM == 'large' and tree.mGluino - tree.deltaM == 100):
            if current_mass != tree.mGluino:
                print('*** {0}, {1}'.format(tree.mGluino, tree.deltaM))
                upper_limits.append(TGraphErrors())
                mass_g.append(int(tree.mGluino))
                index += 1
                point = 0
            current_mass = tree.mGluino
            upper_limits[index].SetPoint(point, tree.ctau * 1e3, tree.xsUL)
            #upper_limits[index].SetPointError(point, 0, tree.xsUL*tree.effRelStatErr+tree.xsUL*tree.effRelSystErr)
            point += 1
            print(tree.ctau, tree.xsUL)
    canvas = TCanvas('c', 'c', 1000, 800)
    canvas.SetLogx()
    canvas.SetLogy()
    h_xs = TH1F('xs', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    h_xs.GetYaxis().SetRangeUser(0.1, 100)
    h_xs.Draw()
    #h_xs_line = TH1F('xs_line', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    #print(mc.mass_xs_err[mass_g]['xs'] * 1e3)
    legend = TLegend(0.60, 0.75, 0.83, 0.90)
    for ii, upper_limit in enumerate(upper_limits):
        #upper_limit.RemovePoint(0)
        upper_limit.SetMarkerSize(0)
        upper_limit.SetFillStyle(3001)
        index = ii
        #if dM[ii] == 130:
        #    index = 1
        #elif dM[ii] == 80:
        #    index = 2
        #    continue
        #elif dM[ii] == 50:
        #    index = 3
        #elif dM[ii] == 30:
        #    index = 4
        #print(upper_limit)
        upper_limit.SetFillColor(BasicConfig.colors[index+1])
        upper_limit.SetLineColor(BasicConfig.colors[index+1])
        upper_limit.Draw('lp,same')
        #upper_limit.Draw('c,same')
        #if dM[ii] > 100:
        #    #legend.AddEntry(upper_limit, 'M_{#tilde{g}} = '+str(mass_g)+' GeV, #DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #    legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        legend.AddEntry(upper_limit, 'Mass G = ' + str(mass_g[ii]) + ' GeV', 'lf')
    utils.decorate_legend(legend)
    legend.Draw()
    AtlasStyle.ATLASLabel(0.19, 0.87, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, kBlack, '#sqrt{s} = 13 TeV, #int L dt = 30 fb^{-1}', 0.035)
    #AtlasStyle.myText(0.20, 0.73, kBlack, 'Split-SUSY Model, M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.032)
    #AtlasStyle.myText(0.20, 0.67, kBlack, 'M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.035)
    #if dM == 'large' and tree.mGluino - tree.deltaM == 100:
    #    print('test')
    utils.save_as(canvas, BasicConfig.plotdir + 'xs_limit_large_dM_' + flavor_of_sample)
Пример #10
0
def main():
    pil_im = Image.open(PATH_TO_IMG)
    thumbnail = make_thumbnail(pil_im, 256, 128)
    save_as(pil_im, OUTPUT_IMG, "png")
Пример #11
0
    def draw_breakdown(self, mode, use_multiple_models=True):
        print('***********************')
        print('draw_breakdown')
        print(mode)
        canvas3 = ROOT.TCanvas('canvas3_' + mode['mode'], 'canvas3', 1000, 800)
        canvas3.SetLeftMargin(0.15)
        #canvas3.SetLogy()

        #mat = MaterialVolume.MaterialVolume()
        #bins = array('f', [0] + mat.region_list)
        #h_factor = mode['h_factor']
        #if mode['mode'] == 'cross_factor':
        #    self.h_factor = ROOT.TH1F('h_value_' + mode['mode'], ';R [mm];' + mode['y_axis'],
        #                              len(mat.region_list), bins)
        #h_value = ROOT.TH1F('h_value_' + mode['mode'], ';R [mm];' + mode['y_axis'],
        #                    len(mat.region_list), bins)
        #h_est = ROOT.TH1F('h_est_' + mode['mode'], '', len(mat.region_list), bins)
        h_fill = ROOT.TH1F('h_fill_' + mode['mode'], '', len(mat.region_list), bins)
        for ii in range(len(mat.region_list)):
            if ii in self.vetoed_region:
                h_fill.SetBinContent(ii + 1, 99999.)
                h_fill.SetBinError(ii + 1, 0.)
                h_factor.SetBinContent(ii+1, 0)
                h_factor.SetBinError(ii+1, 0)
                h_factor_large.SetBinContent(ii+1, 0)
                h_factor_large.SetBinError(ii+1, 0)
                if not mode['mode'] == 'cross_factor':
                    self.h_obs[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_obs[mode['mode']].SetBinError(ii+1, 0)
                    self.h_est[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_est[mode['mode']].SetBinError(ii+1, 0)
                    self.h_est_large[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_est_large[mode['mode']].SetBinError(ii+1, 0)
                    # 8to10
                    self.h_obs_8to10[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_obs_8to10[mode['mode']].SetBinError(ii+1, 0)
                    self.h_est_8to10[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_est_8to10[mode['mode']].SetBinError(ii+1, 0)
                    self.h_est_large_8to10[mode['mode']].SetBinContent(ii+1, 0)
                    self.h_est_large_8to10[mode['mode']].SetBinError(ii+1, 0)
            else:
                pass
                #h_fill.SetBinContent(ii + 1, -99999.)
                #h_fill.SetBinError(ii + 1, 0.)
                #if mode['mode'] == 'cross_factor':
                    #pass
                    #self.h_factor.SetBinContent(ii + 1, self.crossfactor_list[ii])
                    #self.h_factor.SetBinError(ii + 1, self.error_list[ii])
                    #self.h_factor.Sumw2()
                #elif mode['mode'] == '4':
                    ##print(ii, self.obs_list[4][ii])
                    #h_value.SetBinContent(ii + 1, self.obs_list[4][ii])
                    #h_value.SetBinError(ii + 1, ROOT.TMath.Sqrt(self.obs_list[4][ii]))
                    ##print(ii, self.est_list[4][ii])
                    #h_est.SetBinContent(ii + 1, self.est_list[4][ii])
                    #h_est.SetBinError(ii + 1, ROOT.TMath.Sqrt(self.est_list[4][ii]))
                #elif mode['mode'] == '5' or mode['mode'] == '6':
                #    h_value.SetBinContent(ii + 1, self.obs_list[5][ii])
                #    h_value.SetBinError(ii + 1, ROOT.TMath.Sqrt(self.obs_list[5][ii]))
                #else:
                #    print('invalid mode')
        h_fill.SetLineWidth(0)
        h_fill.SetFillColor(ROOT.kPink)
        h_fill.SetFillStyle(3001)
        if mode['mode'] == 'cross_factor':
            #h_factor.SetMaximum(0.0105)
            #h_factor.SetMaximum(0.0305)
            #h_factor.SetMaximum(0.905)
            #h_factor.SetMaximum(90.5)
            h_factor.SetMaximum(0.004)
            h_factor.GetYaxis().SetTitleOffset(1.80)
            h_factor.SetMinimum(0)
            #h_factor.SetMinimum(0.00002)
            #h_factor.SetMinimum(0.00002)
            h_factor.SetLineWidth(2)
            h_factor.SetLineColor(ROOT.kBlack)
            h_factor.SetMarkerColor(ROOT.kBlack)
            h_factor.SetMarkerStyle(20)
            h_factor.Draw('e')
            if use_multiple_models:
                h_factor_large.SetLineWidth(2)
                h_factor_large.SetLineColor(ROOT.kBlue+1)
                h_factor_large.SetMarkerColor(ROOT.kBlue+1)
                h_factor_large.SetMarkerStyle(20)
                h_factor_large.Draw('e,same')
            output_factor = ROOT.TFile('output_factor_{}.root'.format(self.m_cut), 'recreate')
            h_factor.Write()
            h_fill.Write()
        else:
            utils.decorate_histogram(self.h_obs[mode['mode']], ROOT.kGray+3)
            #self.h_obs[mode['mode']].SetMaximum(self.h_obs[mode['mode']].GetMaximum() * 3.1)
            #self.h_obs[mode['mode']].SetMaximum(self.h_obs[mode['mode']].GetMaximum() * 200)
            #self.h_obs[mode['mode']].SetMinimum(2e-2)
            self.h_obs[mode['mode']].SetMaximum(self.h_obs[mode['mode']].GetMaximum() * 3)
            self.h_obs[mode['mode']].SetMinimum(0)
            self.h_obs[mode['mode']].Draw('e')
            utils.decorate_histogram(self.h_est[mode['mode']], ROOT.kGreen+2, fill_style=3002)
            self.h_est[mode['mode']].Add(self.h_est_large[mode['mode']])
            self.h_est[mode['mode']].SetLineWidth(0)
            self.h_est[mode['mode']].Draw('e2,same')
            ## 8to10
            #utils.decorate_histogram(self.h_obs_8to10[mode['mode']], ROOT.kGray+3)
            #self.h_obs_8to10[mode['mode']].SetMaximum(self.h_obs_8to10[mode['mode']].GetMaximum() * 200)
            #self.h_obs_8to10[mode['mode']].Draw('e')
            #utils.decorate_histogram(self.h_est_8to10[mode['mode']], ROOT.kGreen+2, fill_style=3002)
            self.h_est_8to10[mode['mode']].Add(self.h_est_large_8to10[mode['mode']])
            #self.h_est[mode['mode']].SetLineWidth(0)
            #self.h_est[mode['mode']].Draw('e2,same')
        h_fill.Draw('same')
        AtlasStyle.ATLASLabel(self.ax, self.ay, 'Work in Progress')
        AtlasStyle.myText(self.tx, self.ty, ROOT.kBlack, self.beam_condition, 0.038)
        leg3 = ROOT.TLegend(self.x_min, self.y_min, self.x_max, self.y_max)
        if mode['mode'] == 'cross_factor':
            if use_multiple_models:
                leg3.AddEntry(h_factor, 'Crossing Factor (NoLarge)', 'lep')
                leg3.AddEntry(h_factor_large, 'Crossing Factor (Large)', 'lep')
            else:
                leg3.AddEntry(h_factor, 'Crossing Factor', 'lep')
        elif mode['mode'] == '4':
            leg3.AddEntry(self.h_obs[mode['mode']], 'Observed', 'lep')
            leg3.AddEntry(self.h_est[mode['mode']], 'Predicted', 'epf')
        elif mode['mode'] == '5' or mode['mode'] == 6:
            leg3.AddEntry(self.h_obs[mode['mode']], 'Observed (Blinded)', 'lep')
            leg3.AddEntry(self.h_est[mode['mode']], 'Predicted', 'epf')
        utils.decorate_legend(leg3)
        leg3.Draw()
        directory = BasicConfig.plotdir + 'bg_est/' + str(date.today())
        utils.save_as(canvas3, directory + '/dv_mass_fitter_summary_' + mode['mode'])
        canvas3.Close()
Пример #12
0
def draw_cross_section_limit(tree, mass_g, flavor_of_sample='MET_TLJets'):
    AtlasStyle.SetAtlasStyle()
    entries = tree.GetEntries()
    current_delta_mass = 0
    upper_limits = []
    dM = []
    index = -1
    for entry in range(entries):
        tree.GetEntry(entry)
        if tree.mGluino == mass_g:
            if current_delta_mass != tree.deltaM:
                print('*** {0}, {1}'.format(tree.mGluino, tree.deltaM))
                upper_limits.append(TGraphErrors())
                dM.append(int(tree.deltaM))
                index += 1
                point = 0
            current_delta_mass = tree.deltaM
            #if current_delta_mass < 100:
            #    continue
            upper_limits[index].SetPoint(point, tree.ctau * 1e3, tree.xsUL)
            upper_limits[index].SetPointError(
                point, 0, tree.xsUL * tree.effRelStatErr +
                tree.xsUL * tree.effRelSystErr)
            point += 1
            print(tree.ctau, tree.xsUL)
    canvas = TCanvas('c', 'c', 1000, 800)
    canvas.SetLogx()
    canvas.SetLogy()
    #upper_limits[0].SetMinimum(0.8)
    #upper_limits[0].SetMinimum(0.05)
    #upper_limits[0].SetMaximum(30000)
    #upper_limits[0].GetXaxis().SetRangeUser(0.9, 310)
    #upper_limits[0].GetXaxis().SetTitle('c#tau [mm]')
    #upper_limits[0].GetYaxis().SetTitle('Cross Section [fb]')
    #upper_limits[0].Draw('A3')
    #if mass_g == 1400:
    #    upper_limits[1].RemovePoint(0)
    #upper_limits[0].RemovePoint(2)
    #upper_limits[1].RemovePoint(0)
    h_xs = TH1F('xs', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    h_xs_line = TH1F('xs_line', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9,
                     310)
    print(mc.mass_xs_err[mass_g]['xs'] * 1e3)
    for bin in range(1, 1000 + 1):
        h_xs.SetBinContent(bin, mc.mass_xs_err[mass_g]['xs'] * 1e3)
        h_xs_line.SetBinContent(bin, mc.mass_xs_err[mass_g]['xs'] * 1e3)
        h_xs.SetBinError(
            bin, mc.mass_xs_err[mass_g]['xs'] * 1e3 *
            mc.mass_xs_err[mass_g]['xs_err'] * 0.01)
    h_xs.SetMarkerSize(0)
    h_xs.SetFillStyle(3001)
    h_xs.SetFillColor(kGray + 2)
    #h_xs.SetMinimum(0.8)
    h_xs.SetMinimum(0.05)
    h_xs.SetMaximum(30000)
    #h_xs.Draw('same,e2')
    h_xs.Draw('e2')
    h_xs_line.SetLineColor(kGray + 3)
    h_xs_line.SetLineStyle(2)
    h_xs_line.Draw('same')
    legend = TLegend(0.60, 0.75, 0.83, 0.90)
    for ii, upper_limit in enumerate(upper_limits):
        #upper_limit.RemovePoint(0)
        upper_limit.SetMarkerSize(0)
        upper_limit.SetFillStyle(3001)
        index = ii
        if dM[ii] == 130:
            index = 1
        elif dM[ii] == 80:
            index = 2
            continue
        elif dM[ii] == 50:
            index = 3
        elif dM[ii] == 30:
            index = 4
        upper_limit.SetFillColor(BasicConfig.colors[index + 1])
        upper_limit.SetLineColor(BasicConfig.colors[index + 1])
        upper_limit.Draw('3,same')
        #upper_limit.Draw('c,same')
        #if dM[ii] > 100:
        #    #legend.AddEntry(upper_limit, 'M_{#tilde{g}} = '+str(mass_g)+' GeV, #DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #    legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        legend.AddEntry(upper_limit, '#DeltaM = ' + str(dM[ii]) + ' GeV', 'lf')
    utils.decorate_legend(legend)
    legend.Draw()
    AtlasStyle.ATLASLabel(0.19, 0.87, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, kBlack,
                      '#sqrt{s} = 13 TeV, #int L dt = 30 fb^{-1}', 0.035)
    AtlasStyle.myText(
        0.20, 0.73, kBlack,
        'Split-SUSY Model, M_{#tilde{g}} = ' + str(mass_g) + ' GeV', 0.032)
    #AtlasStyle.myText(0.20, 0.67, kBlack, 'M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.035)
    utils.save_as(
        canvas, BasicConfig.plotdir + 'xs_limit_mGluino' + str(mass_g) +
        flavor_of_sample)
Пример #13
0
def draw_cross_section_limit_dM(tree, dM, flavor_of_sample='MET_TLJets'):
    AtlasStyle.SetAtlasStyle()
    entries = tree.GetEntries()
    current_mass = 0
    upper_limits = []
    mass_g = []
    index = -1
    point = 0
    for entry in range(entries):
        tree.GetEntry(entry)
        if tree.deltaM == dM or (dM == 'large'
                                 and tree.mGluino - tree.deltaM == 100):
            if current_mass != tree.mGluino:
                print('*** {0}, {1}'.format(tree.mGluino, tree.deltaM))
                upper_limits.append(TGraphErrors())
                mass_g.append(int(tree.mGluino))
                index += 1
                point = 0
            current_mass = tree.mGluino
            upper_limits[index].SetPoint(point, tree.ctau * 1e3, tree.xsUL)
            #upper_limits[index].SetPointError(point, 0, tree.xsUL*tree.effRelStatErr+tree.xsUL*tree.effRelSystErr)
            point += 1
            print(tree.ctau, tree.xsUL)
    canvas = TCanvas('c', 'c', 1000, 800)
    canvas.SetLogx()
    canvas.SetLogy()
    h_xs = TH1F('xs', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    h_xs.GetYaxis().SetRangeUser(0.1, 100)
    h_xs.Draw()
    #h_xs_line = TH1F('xs_line', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    #print(mc.mass_xs_err[mass_g]['xs'] * 1e3)
    legend = TLegend(0.60, 0.75, 0.83, 0.90)
    for ii, upper_limit in enumerate(upper_limits):
        #upper_limit.RemovePoint(0)
        upper_limit.SetMarkerSize(0)
        upper_limit.SetFillStyle(3001)
        index = ii
        #if dM[ii] == 130:
        #    index = 1
        #elif dM[ii] == 80:
        #    index = 2
        #    continue
        #elif dM[ii] == 50:
        #    index = 3
        #elif dM[ii] == 30:
        #    index = 4
        #print(upper_limit)
        upper_limit.SetFillColor(BasicConfig.colors[index + 1])
        upper_limit.SetLineColor(BasicConfig.colors[index + 1])
        upper_limit.Draw('lp,same')
        #upper_limit.Draw('c,same')
        #if dM[ii] > 100:
        #    #legend.AddEntry(upper_limit, 'M_{#tilde{g}} = '+str(mass_g)+' GeV, #DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #    legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        legend.AddEntry(upper_limit, 'Mass G = ' + str(mass_g[ii]) + ' GeV',
                        'lf')
    utils.decorate_legend(legend)
    legend.Draw()
    AtlasStyle.ATLASLabel(0.19, 0.87, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, kBlack,
                      '#sqrt{s} = 13 TeV, #int L dt = 30 fb^{-1}', 0.035)
    #AtlasStyle.myText(0.20, 0.73, kBlack, 'Split-SUSY Model, M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.032)
    #AtlasStyle.myText(0.20, 0.67, kBlack, 'M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.035)
    #if dM == 'large' and tree.mGluino - tree.deltaM == 100:
    #    print('test')
    utils.save_as(
        canvas, BasicConfig.plotdir + 'xs_limit_large_dM_' + flavor_of_sample)
Пример #14
0
import BasicConfig
import utils

from datetime import date

if __name__ == '__main__':
    AtlasStyle.SetAtlasStyle()

    mass_list = range(600, 1801, 200)
    tfiles = [utils.open_tfile(BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_{:04d}_weight.root'.format(mass))
              for mass in mass_list]

    c = ROOT.TCanvas('c', 'c', 1000, 800)
    c.SetLogx()
    tf_out = ROOT.TFile(BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_weight.root', 'recreate')
    for ii, (tfile, mass) in enumerate(zip(tfiles, mass_list)):
        tfile.cd()
        c2 = ROOT.gROOT.FindObject('c2')
        hist = c2.GetPrimitive('ggSystem_SysUnc_ISR')
        hist.SetName('ggSystem_SysUnc_ISR_' + str(mass))
        utils.decorate_histogram(hist, BasicConfig.colors[ii])
        c.cd()
        if ii == 0:
            hist.Draw()
        else:
            hist.Draw('same')
        tf_out.cd()
        hist.Write()
    utils.save_as(c, BasicConfig.plotdir + 'SysUnc_ISR_weight' + str(date.today()))
Пример #15
0
def draw_cross_section_limit(tree, mass_g, flavor_of_sample='MET_TLJets'):
    AtlasStyle.SetAtlasStyle()
    entries = tree.GetEntries()
    current_delta_mass = 0
    upper_limits = []
    dM = []
    index = -1
    for entry in range(entries):
        tree.GetEntry(entry)
        if tree.mGluino == mass_g:
            if current_delta_mass != tree.deltaM:
                print('*** {0}, {1}'.format(tree.mGluino, tree.deltaM))
                upper_limits.append(TGraphErrors())
                dM.append(int(tree.deltaM))
                index += 1
                point = 0
            current_delta_mass = tree.deltaM
            #if current_delta_mass < 100:
            #    continue
            upper_limits[index].SetPoint(point, tree.ctau * 1e3, tree.xsUL)
            upper_limits[index].SetPointError(point, 0, tree.xsUL*tree.effRelStatErr+tree.xsUL*tree.effRelSystErr)
            point += 1
            print(tree.ctau, tree.xsUL)
    canvas = TCanvas('c', 'c', 1000, 800)
    canvas.SetLogx()
    canvas.SetLogy()
    #upper_limits[0].SetMinimum(0.8)
    #upper_limits[0].SetMinimum(0.05)
    #upper_limits[0].SetMaximum(30000)
    #upper_limits[0].GetXaxis().SetRangeUser(0.9, 310)
    #upper_limits[0].GetXaxis().SetTitle('c#tau [mm]')
    #upper_limits[0].GetYaxis().SetTitle('Cross Section [fb]')
    #upper_limits[0].Draw('A3')
    #if mass_g == 1400:
    #    upper_limits[1].RemovePoint(0)
    #upper_limits[0].RemovePoint(2)
    #upper_limits[1].RemovePoint(0)
    h_xs = TH1F('xs', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    h_xs_line = TH1F('xs_line', ';c#tau [mm]; Cross Section [fb]', 1000, 0.9, 310)
    print(mc.mass_xs_err[mass_g]['xs'] * 1e3)
    for bin in range(1, 1000+1):
        h_xs.SetBinContent(bin, mc.mass_xs_err[mass_g]['xs'] * 1e3)
        h_xs_line.SetBinContent(bin, mc.mass_xs_err[mass_g]['xs'] * 1e3)
        h_xs.SetBinError(bin, mc.mass_xs_err[mass_g]['xs'] * 1e3 * mc.mass_xs_err[mass_g]['xs_err'] * 0.01)
    h_xs.SetMarkerSize(0)
    h_xs.SetFillStyle(3001)
    h_xs.SetFillColor(kGray+2)
    #h_xs.SetMinimum(0.8)
    h_xs.SetMinimum(0.05)
    h_xs.SetMaximum(30000)
    #h_xs.Draw('same,e2')
    h_xs.Draw('e2')
    h_xs_line.SetLineColor(kGray+3)
    h_xs_line.SetLineStyle(2)
    h_xs_line.Draw('same')
    legend = TLegend(0.60, 0.75, 0.83, 0.90)
    for ii, upper_limit in enumerate(upper_limits):
        #upper_limit.RemovePoint(0)
        upper_limit.SetMarkerSize(0)
        upper_limit.SetFillStyle(3001)
        index = ii
        if dM[ii] == 130:
            index = 1
        elif dM[ii] == 80:
            index = 2
            continue
        elif dM[ii] == 50:
            index = 3
        elif dM[ii] == 30:
            index = 4
        upper_limit.SetFillColor(BasicConfig.colors[index+1])
        upper_limit.SetLineColor(BasicConfig.colors[index+1])
        upper_limit.Draw('3,same')
        #upper_limit.Draw('c,same')
        #if dM[ii] > 100:
        #    #legend.AddEntry(upper_limit, 'M_{#tilde{g}} = '+str(mass_g)+' GeV, #DeltaM = '+str(dM[ii])+' GeV', 'lf')
        #    legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
        legend.AddEntry(upper_limit, '#DeltaM = '+str(dM[ii])+' GeV', 'lf')
    utils.decorate_legend(legend)
    legend.Draw()
    AtlasStyle.ATLASLabel(0.19, 0.87, 'Work in Progress')
    AtlasStyle.myText(0.20, 0.79, kBlack, '#sqrt{s} = 13 TeV, #int L dt = 30 fb^{-1}', 0.035)
    AtlasStyle.myText(0.20, 0.73, kBlack, 'Split-SUSY Model, M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.032)
    #AtlasStyle.myText(0.20, 0.67, kBlack, 'M_{#tilde{g}} = '+str(mass_g)+' GeV', 0.035)
    utils.save_as(canvas, BasicConfig.plotdir + 'xs_limit_mGluino' + str(mass_g) + flavor_of_sample)
Пример #16
0
    def draw_mass_distributions_and_ratio(self, ntrk, region, h_data, h_model, h_coll):
    #def draw_mass_distributions_and_ratio(self, ntrk, region, h_data, h_model):
        canvas2 = ROOT.TCanvas('canvas2', 'canvas2', 1000, 750)
        # mass distributions
        pad1 = ROOT.TPad('pad1', 'pad1', 0, 0.35, 1, 1.0)
        pad2 = ROOT.TPad('pad2', 'pad2', 0, 0.05, 1, 0.35)
        self.prepare_pads(canvas2, pad1, pad2)

        pad1.cd()

        if self.rebin > 1:
            # h_nocross.Rebin(rebin)
            #h_nolarge[region].Rebin(self.rebin)
            #h_large[region].Rebin(self.rebin)
            #h_data[region].Rebin(self.rebin)
            #h_data_collimated[region].Rebin(self.rebin)
            h_model = utils.rebin(h_model, bins_array)
            h_data = utils.rebin(h_data, bins_array)
            h_coll = utils.rebin(h_coll, bins_array)
        self.configure_data_histogram(h_data)
        h_data.SetMaximum(h_data.GetMaximum() * 8)
        self.configure_model_histogram(h_model)
        for bin in range(h_data.GetNbinsX()):
            if h_data.GetBinContent(bin+1) == 0:
                h_data.SetBinError(bin+1, 1.)
        h_data.Draw('e')
        if self.show_collimated:
            self.configure_model_histogram(h_coll)
            h_coll.SetFillStyle(3013)
            h_coll.SetLineWidth(0)
            h_coll.SetFillColor(ROOT.kAzure)
            h_coll.Draw('same,hist')
        h_model.SetLineWidth(2)
        h_model.Draw('same,hist')
        h_data.Draw('same,e')
        # list_diff3[ipad-1].SetLineWidth(2)
        AtlasStyle.ATLASLabel(self.ax, self.ay, 'Work in Progress')
        AtlasStyle.myText(self.tx, self.ty, ROOT.kBlack, self.beam_condition, 0.038)
        leg = ROOT.TLegend(self.x_min, self.y_min, self.x_max, self.y_max)
        leg.AddEntry(h_data, str(ntrk) + '-trk vertices Region' + str(region), 'lep')
        leg.AddEntry(h_model, str(ntrk-1) + '-trk vert + 1 random track', 'f')
        utils.decorate_legend(leg)
        leg.Draw()

        line = ROOT.TLine(self.m_cut, h_data.GetMinimum(), self.m_cut, h_data.GetMaximum() * 0.1)
        utils.decorate_line(line, ROOT.kGray+1, 5)
        line.Draw()

        # Ratio plot
        pad2.cd()
        h_ratio = h_data.Clone(str(ntrk) + 'trk_ratio' + str(region))
        h_ratio.Sumw2()
        h_ratio.Divide(h_model)
        self.decorate_ratio_plot(h_ratio, 0.1, 1.9)
        h_ratio.Draw('e2p')
        line2 = ROOT.TLine(self.m_cut, h_ratio.GetMinimum(), self.m_cut, h_ratio.GetMaximum())
        utils.decorate_line(line2, ROOT.kGray+1, 5)
        line2.Draw()

        directory = BasicConfig.plotdir + 'bg_est/' + str(date.today())
        os.system('mkdir -p ' + directory)
        utils.save_as(canvas2, directory + '/dv_mass_fitter_' + str(ntrk) + 'Trk_Region' + str(region))
        canvas2.Close()
Пример #17
0
if __name__ == '__main__':
    AtlasStyle.SetAtlasStyle()

    mass_list = range(600, 1801, 200)
    tfiles = [
        utils.open_tfile(
            BasicConfig.workdir +
            'SysUnc_ISR/SysUnc_ISR_{:04d}_weight.root'.format(mass))
        for mass in mass_list
    ]

    c = ROOT.TCanvas('c', 'c', 1000, 800)
    c.SetLogx()
    tf_out = ROOT.TFile(
        BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_weight.root', 'recreate')
    for ii, (tfile, mass) in enumerate(zip(tfiles, mass_list)):
        tfile.cd()
        c2 = ROOT.gROOT.FindObject('c2')
        hist = c2.GetPrimitive('ggSystem_SysUnc_ISR')
        hist.SetName('ggSystem_SysUnc_ISR_' + str(mass))
        utils.decorate_histogram(hist, BasicConfig.colors[ii])
        c.cd()
        if ii == 0:
            hist.Draw()
        else:
            hist.Draw('same')
        tf_out.cd()
        hist.Write()
    utils.save_as(
        c, BasicConfig.plotdir + 'SysUnc_ISR_weight' + str(date.today()))
Пример #18
0
def main():
    pil_im = Image.open(PATH_TO_IMG).convert("L")
    save_as(pil_im, OUTPUT_IMG, "png")