示例#1
0
def printEventCountOneChannels(nums, label_nums, label_translate, k, chan,
                               fLatex):
    #print nums
    fLatex.write('\n')
    fLatex.write('\\begin{table}[h]\n')
    fLatex.write('  \\caption{' + k.replace('_', '\_') + '}\n')
    fLatex.write('  \\label{tab:}\n')
    fLatex.write('  \\centering\n')
    fLatex.write('  \\begin{tabular}{lc}\n')
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    l = ['', 'Number of events']
    st = utl_func.makeLatexLine(l)
    fLatex.write(st)
    fLatex.write('  \\hline\n')
    for label in label_nums:
        if 'MC' == label:
            fLatex.write('\\hline\n')
        l = [
            label_translate[label],
            str(nums[chan][label][0]) + ' $\pm$ ' + str(nums[chan][label][1])
        ]
        fLatex.write(utl_func.makeLatexLine(l))
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    fLatex.write('\\end{tabular}\n')
    fLatex.write('\\end{table}\n')
示例#2
0
def printEventCountTwoChannels(nums,
                               label_nums,
                               label_translate,
                               k,
                               fLatex,
                               withErr=False):
    #print nums
    fLatex.write('\n')
    fLatex.write('\\begin{table}[h]\n')
    fLatex.write('  \\caption{' + k.replace('_', '\_') + '}\n')
    fLatex.write('  \\label{tab:}\n')
    fLatex.write('  \\centering\n')
    fLatex.write('  \\begin{tabular}{lcc}\n')
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    l = ['', 'Electron', 'Muon']
    st = utl_func.makeLatexLine(l)
    fLatex.write(st)
    fLatex.write('  \\hline\n')
    for label in label_nums:
        if 'MC' == label:
            fLatex.write('\\hline\n')
        #l = [label_translate[label], str(nums['Ele'][label][0]) + ' $\pm$ ' + str(nums['Ele'][label][1]), str(nums['Muon'][label][0]) + ' $\pm$ ' + str(nums['Muon'][label][1])]
        #l = [label_translate[label], str(nums['Ele'][label][0]) + ' $\pm$ ' + str(nums['Ele'][label][1]), str(nums['Muon'][label][0]) + ' $\pm$ ' + str(nums['Muon'][label][1])]
        if label != 'DMCratio':
            if withErr:
                l = [
                    label_translate[label],
                    "{0:.0f} $\pm$ {1:.0f}".format(nums['Ele'][label][0],
                                                   nums['Ele'][label][1]),
                    "{0:.0f} $\pm$ {1:.0f}".format(nums['Muon'][label][0],
                                                   nums['Muon'][label][1])
                ]
            else:
                l = [
                    label_translate[label],
                    "{0:.0f}".format(nums['Ele'][label][0]),
                    "{0:.0f}".format(nums['Muon'][label][0])
                ]
        else:
            if withErr:
                l = [
                    label_translate[label],
                    "{0:.3f} $\pm$ {1:.3f}".format(nums['Ele'][label][0],
                                                   nums['Ele'][label][1]),
                    "{0:.3f} $\pm$ {1:.3f}".format(nums['Muon'][label][0],
                                                   nums['Muon'][label][1])
                ]
            else:
                l = [
                    label_translate[label],
                    "{0:.2f}".format(nums['Ele'][label][0]),
                    "{0:.2f}".format(nums['Muon'][label][0])
                ]

        fLatex.write(utl_func.makeLatexLine(l))
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    fLatex.write('\\end{tabular}\n')
    fLatex.write('\\end{table}\n')
示例#3
0
def printEventCountTwoChannelsAll(nums,
                                  label_nums,
                                  label_translate,
                                  k,
                                  fLatex,
                                  withErr=False):
    #print nums
    fLatex.write('\n')
    fLatex.write('\\begin{table}[h]\n')
    fLatex.write('  \\caption{' + k.replace('_', '\_') + '}\n')
    fLatex.write('  \\label{tab:}\n')
    fLatex.write('  \\centering\n')
    fLatex.write('  \\begin{tabular}{lcccccc}\n')
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    fLatex.write(
        '&\multicolumn{2}{c}{2016} & \multicolumn{2}{c}{2017} & \multicolumn{2}{c}{2018}\\\\\n'
    )
    l = ['', 'Electron', 'Muon', 'Electron', 'Muon', 'Electron', 'Muon']
    st = utl_func.makeLatexLine(l)
    fLatex.write(st)
    fLatex.write('  \\hline\n')

    for label in label_nums:

        if 'MC' == label:
            fLatex.write('\\hline\n')

        if label != 'DMCratio':
            if withErr:
                l = [label_translate[label],\
                    "{0:.0f} $\pm$ {1:.0f}".format(nums['Zee']['16'][label][0],nums['Zee']['16'][label][1]), "{0:.0f} $\pm$ {1:.0f}".format(nums['Zmm']['16'][label][0],nums['Zmm']['16'][label][1]),\
                    "{0:.0f} $\pm$ {1:.0f}".format(nums['Zee']['17'][label][0],nums['Zee']['17'][label][1]), "{0:.0f} $\pm$ {1:.0f}".format(nums['Zmm']['17'][label][0],nums['Zmm']['17'][label][1]),\
                    "{0:.0f} $\pm$ {1:.0f}".format(nums['Zee']['18'][label][0],nums['Zee']['18'][label][1]), "{0:.0f} $\pm$ {1:.0f}".format(nums['Zmm']['18'][label][0],nums['Zmm']['18'][label][1])]
            else:
                l = [label_translate[label],\
                    "{0:.0f}".format(nums['Zee']['16'][label][0]), "{0:.0f}".format(nums['Zmm']['16'][label][0]),\
                    "{0:.0f}".format(nums['Zee']['17'][label][0]), "{0:.0f}".format(nums['Zmm']['17'][label][0]),\
                    "{0:.0f}".format(nums['Zee']['18'][label][0]), "{0:.0f}".format(nums['Zmm']['18'][label][0])]
        else:
            if withErr:
                l = [label_translate[label],\
                    "{0:.3f} $\pm$ {1:.3f}".format(nums['Zee']['16'][label][0],nums['Zee']['16'][label][1]), "{0:.3f} $\pm$ {1:.3f}".format(nums['Zmm']['16'][label][0],nums['Zmm']['16'][label][1]),\
                    "{0:.3f} $\pm$ {1:.3f}".format(nums['Zee']['17'][label][0],nums['Zee']['17'][label][1]), "{0:.3f} $\pm$ {1:.3f}".format(nums['Zmm']['17'][label][0],nums['Zmm']['17'][label][1]),\
                    "{0:.3f} $\pm$ {1:.3f}".format(nums['Zee']['18'][label][0],nums['Zee']['18'][label][1]), "{0:.3f} $\pm$ {1:.3f}".format(nums['Zmm']['18'][label][0],nums['Zmm']['18'][label][1])]
            else:
                l = [label_translate[label],\
                    "{0:.2f}".format(nums['Zee']['16'][label][0]), "{0:.2f}".format(nums['Zmm']['16'][label][0]),\
                    "{0:.2f}".format(nums['Zee']['17'][label][0]), "{0:.2f}".format(nums['Zmm']['17'][label][0]),\
                    "{0:.2f}".format(nums['Zee']['18'][label][0]), "{0:.2f}".format(nums['Zmm']['18'][label][0])]

        fLatex.write(utl_func.makeLatexLine(l))
    fLatex.write('  \\hline\n')
    fLatex.write('  \\hline\n')
    fLatex.write('\\end{tabular}\n')
    fLatex.write('\\end{table}\n')