示例#1
0
        if args.masses is not None and chain.HNLmass not in args.masses: continue

        #
        # Create cutter to provide cut flow
        #
        cutter = Cutter(chain = chain)

        #
        # Loop over all events
        #
        ec = EventCategory(chain)
        es = EventSelector(args.region, args.selection, object_selection_param, not args.genLevel, ec)
        for entry in event_range:
            
            chain.GetEntry(entry)
            progress(entry - event_range[0], len(event_range))
 
            cutter.cut(True, 'Total')

            #
            #Triggers
            #
            if args.selection == 'AN2017014':
                if not cutter.cut(applyCustomTriggers(listOfTriggersAN2017014(chain)), 'pass_triggers'): continue
           
            #
            # Event selection
            #
            if not es.passedFilter(chain, chain, cutter): continue
            nprompt = 0
            if sample.name != 'Data':
示例#2
0
    for s in subdir:
        mname = s.rsplit('/', 1)[-1]
        mnames.append(mname)

    mva_output = {mname: ROOT.vector('float')() for mname in mnames}
    class_id = ROOT.vector('bool')()
    weight = ROOT.vector('float')()
    for i in xrange(len(test_tree['classID'])):
        class_id.push_back(not test_tree['classID'][i])
        weight.push_back(test_tree['weight'][i])
        for mname in mnames:
            mva_output[mname].push_back(test_tree[mname][i])

    ROC_integrals = []
    for iname, mname in enumerate(mnames):
        progress(iname, len(mnames))
        ROCs[mname] = ROOT.TMVA.ROCCurve(mva_output[mname], class_id, weight)
        ROC_integrals.append(ROCs[mname].GetROCIntegral())
        ROC_curve = ROCs[mname].GetROCCurve()
        ROC_curve = fillRandGraph(ROC_curve, 10)
        extra_text = [
            extraTextFormat("AUC: " + str(ROCs[mname].GetROCIntegral()))
        ]
        p = Plot(signal_hist=[ROC_curve],
                 tex_names=[mname],
                 name='roc_' + mname,
                 extra_text=extra_text)
        p.drawGraph(output_dir=out_file_name.rsplit('/', 1)[0] + '/kBDT/plots',
                    draw_style="AP")

    print 'Making pdf'