示例#1
0
文件: histo.py 项目: HEP-KBFI/stpol
    )

    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)
示例#2
0
文件: flat.py 项目: HEP-KBFI/stpol
        
        #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()
示例#3
0
文件: met_phi.py 项目: HEP-KBFI/stpol
        "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)
示例#4
0
文件: tree.py 项目: HEP-KBFI/stpol
    #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']])