Exemple #1
0
    )

    args = parser.parse_args()

    cuts_jet_tag = [
        ("%dj%dt"%(n,m), Cuts.n_jets(n)*Cuts.n_tags(m)) for n in [2,3] for m in [0,1,2]
    ]
    # cuts_jet_tag = [
    #     ("2j1t", Cuts.n_jets(2)*Cuts.n_tags(1))
    # ]

    cuts = []
    for cutname, cbline in cuts_jet_tag:
        for lep in ["mu", "ele"]:
            cn = "%s_%s" % (lep, cutname)
            baseline = Cuts.lepton(lep) * Cuts.hlt(lep) * Cuts.metmt(lep) * Cuts.rms_lj
            cuts += [
                #Without the MET cut
                ("%s_nomet" % cn, Cuts.lepton(lep) * Cuts.hlt(lep) * Cuts.rms_lj * cbline),

                #Baseline for fit
                ("%s_baseline" % cn, baseline * cbline),

                #Cut-based check
                ("%s_cutbased_final" % cn,
                    baseline * cbline * Cuts.top_mass_sig * Cuts.eta_lj
                ),

                #MVA-based selection
                ("%s_mva_loose" % cn,
                    baseline * cbline * Cuts.mva_wp(lep)
Exemple #2
0
        "binning": [20, -1, 1]
    }
    variables["bdt"] = {
        "name": "bdt",
        "var": Cuts.mva_vars['mu'],
        "binning": [60, -1, 1]
    }

    weights = [
        ("weight__nominal", Weights.total_weight("mu")),
    ]


    c1 = (
        "2j0t",
        Cuts.mt_mu()*Cuts.n_jets(2)*Cuts.n_tags(0)*Cuts.lepton("mu")*Cuts.hlt("mu"),
    )
    c2 = (
        "2j1t",
        Cuts.mt_mu()*Cuts.n_jets(2)*Cuts.n_tags(1)*Cuts.lepton("mu")*Cuts.hlt("mu"),
    )
    c3 = (
        "final_cb_2j1t",
        Cuts.final(2,1),
    )
    cuts = [c1, c2, c3]

    varnodes = {}
    for k, v in variables.items():
        for c in cuts:
            vn = tree.hist_node(graph, v, c, weights)
Exemple #3
0
        
        #ROOT functions can be used
        ("abs_eta_lj", "abs(eta_lj)", [20, 0, 5]),

        ("bdt", Cuts.mva_vars['mu'], [60, -1, 1]),
    ]

    #Define all the weight strategies that we want to apply
    weights = [
        ("weight__nominal", Weights.total_weight("mu")),

        #Demonstrate reweighting
        ("weight__puw", Weights.pu("nominal")),
        ("weight__puw_up", Weights.pu("up")),
    ]

    #All the cut regions that we are interested in
    cuts = [
        ("2j0t", Cuts.mt_mu()*Cuts.n_jets(2)*Cuts.n_tags(0)*Cuts.lepton("mu")*Cuts.hlt("mu")),
        ("2j1t", Cuts.mt_mu()*Cuts.n_jets(2)*Cuts.n_tags(1)*Cuts.lepton("mu")*Cuts.hlt("mu")),
        ("final_cb_2j1t", Cuts.final(2,1))
    ]

    #Construct the analysis chain
    snodes, out = analysis_tree(cuts, weights, variables, args.infiles, args.outfile)

    print "Recursing down"
    for sn in snodes:
        sn.recurseDown()

    out.close()
Exemple #4
0
from plots.common.cuts import Cuts
import sys

if __name__=="__main__":

    for fi in sys.argv[1:]:
        print fi
        samp = Sample.fromFile(fi)
        print "Lumi scale factor: ", samp.lumiScaleFactor(20000)
        for lep in ["mu", "ele"]:
            if "/%s/"%lep not in fi:
                continue
            print lep
            cut = None
            for cutname, _cut in [
                ("hlt", Cuts.hlt(lep)),
                ("lep", Cuts.single_lepton(lep)),
                ("2J", Cuts.n_jets(2)),
                ("1T", Cuts.n_tags(1)),
                ("MET/MtW", Cuts.metmt(lep)),
                ("rms", Cuts.rms_lj),
                ("Mtop", Cuts.top_mass_sig),
                ("etalj", Cuts.eta_lj)
                ]:
                if not cut:
                    cut = _cut
                else:
                    cut *= _cut
                try:
                    hi = samp.drawHistogram("eta_lj", str(cut), binning=[50, -5, 5])
                    hi.Scale(samp.lumiScaleFactor(20000))
Exemple #5
0
    #Create the sink to a file
    hsaver = ObjectSaver(args.outfile)

    #Load the samples
    sample_nodes = [
        SampleNode(hsaver, graph, inf, [], []) for inf in args.infiles
    ]

    #Different lepton channels
    channel = Node(graph, "channel", sample_nodes, [])
    channels = dict()

    # sample --> channels['mu'], channels['ele']
    channels['mu'] = CutNode(
        Cuts.hlt("mu")*Cuts.lepton("mu"),
        graph, "mu", [channel], [], filter_funcs=[lambda x: is_samp(x, 'mu')]
    )
    channels['ele'] = CutNode(
        Cuts.hlt("ele")*Cuts.lepton("ele"),
        graph,
        "ele", [channel], [], filter_funcs=[lambda x: is_samp(x, 'ele')]
    )

    # muons: channels['mu'] --> [iso, antiiso]
    # electrons: channels['ele'] --> [iso, antiiso]
    isos = dict()
    isol = []
    for lep, par in [
        ('mu', [channels['mu']]),
        ('ele', [channels['ele']])