def ApplyTransferFactorModel(transferfactor, data_3b, data_4b, tag, category,
                             valflag, srflag):
    ############################################################################
    ##Let's slice data one more time to have the inputs for the bdt reweighting
    ############################################################################
    variables = ['HH_m']
    original, original_weights = data.preparedataforprediction(
        data_3b, transferfactor, variables)
    target, target_weights = data.preparedataforprediction(
        data_4b, 1, variables)
    ########################################
    ## Check the single bin, done just for the validation signal region as we are currently blinded
    ########################################
    data.getmodeltransferfactorweights(original, original_weights, target,
                                       target_weights, transferfactor, valflag,
                                       srflag)
    return original_weights
Beispiel #2
0
def CreatePredictionModel(reweightermodel, transferfactor, data_3b, category):
    ############################################################################
    ##Let's slice data one more time to have the inputs for the bdt reweighting#
    ############################################################################
    if category == 'GGF':
        variables = [
            'H1_pt', 'H2_pt', 'H1_eta', 'H2_eta', 'nJet', 'H1_bb_deltaR',
            'H2_bb_deltaR', 'H1_bb_deltaPhi', 'H2_bb_deltaPhi'
        ]
    elif category == 'VBF':
        variables = [
            'H1_pt', 'H2_pt', 'H1_eta', 'H2_eta', 'nJet', 'JJ_j1_qgl',
            'JJ_j2_qgl', 'JJ_m', 'j1j2_deltaEta'
        ]
    else:
        variables = ['H1_pt', 'H2_pt', 'H1_eta', 'H2_eta', 'nJet']
    original, original_weights = data.preparedataforprediction(
        data_3b, transferfactor, variables)
    ########################################3############
    ##Folding Gradient Boosted Reweighter (and DQM plots)
    #####################################################
    folding_weights = data.getmodelweights(original, original_weights,
                                           reweightermodel, transferfactor)
    return folding_weights
def ApplyReweightingModel(reweightermodel, transferfactor, data_3b, data_4b,
                          tag, bkgclassifierparams, category, valflag, srflag):
    ############################################################################
    ##Let's slice data one more time to have the inputs for the bdt reweighting
    ############################################################################
    if category == 'GGF' or category == 'GGF1' or category == 'GGF2':
        variables = [
            'H1_b1_ptRegressed', 'H1_b2_ptRegressed', 'H2_b1_ptRegressed',
            'H2_b2_ptRegressed', 'H1_m', 'H2_m', 'HH_m', 'H1_pt', 'H2_pt',
            'h1h2_deltaEta', 'H1_bb_deltaR', 'H2_bb_deltaR',
            'abs_costh_H1_ggfcm', 'HH_btag_b3_bres', 'abs_costh_H1_b1_h1cm',
            'sum_3b_bscore', 'sum_4b_pt', 'HH_pt'
        ]
    elif category == 'VBF' or category == 'VBF1' or category == 'VBF2':
        variables = [
            'H1_b1_ptRegressed', 'H1_b2_ptRegressed', 'H2_b1_ptRegressed',
            'H2_b2_ptRegressed', 'H1_m', 'H2_m', 'HH_m', 'H1_pt', 'H2_pt',
            'h1h2_deltaEta', 'h1h2_deltaPhi', 'JJ_m', 'j1j2_deltaEta',
            'GGFKiller'
        ]
    else:
        variables = ['HH_m']
    original, original_weights = data.preparedataforprediction(
        data_3b, transferfactor, variables)
    target, target_weights = data.preparedataforprediction(
        data_4b, 1, variables)

    ########################################3############
    ##Folding Gradient Boosted Reweighter (and DQM plots)
    #####################################################
    folding_weights = data.getmodelweights(original, original_weights, target,
                                           target_weights, reweightermodel,
                                           transferfactor, valflag, srflag)
    ########################################
    ## KS Test (as the developers of the method do), done just for the validation signal region as we are currently blinded
    ########################################
    #if valflag==True and srflag==True:
    ############################################################################
    ##Individual and global tests of the validation signal region
    ############################################################################
    #plotter.Draw1DHistosComparison(original, target, variables, original_weights,True,"%s_val%s_%ssr_originalprediction"%(tag,category,category) )
    #plotter.Draw1DHistosComparison(original, target, variables, folding_weights,True,"%s_val%s_%ssr_modelprediction"%(tag,category,category) )
    #ksresult_original = bdtreweighter.ks_test(original, target, variables, original_weights)
    #ksresult_model    = bdtreweighter.ks_test(original, target, variables, folding_weights)
    #bdtreweighter.ks_comparison(variables,ksresult_original,ksresult_model)
    #bdtreweighter.discrimination_test(original,target,original_weights,bkgclassifierparams,"%s_val%s_%ssr"%(tag,category,category),"originalprediction")
    #bdtreweighter.discrimination_test(original,target,folding_weights,bkgclassifierparams,"%s_val%s_%ssr"%(tag,category,category),"modelprediction")
    ############################################################################
    ##Let's slice data one more time to have the observables tested
    ############################################################################
    #if category == 'GGF1':
    #	observable = ['GGFMVA1']
    #	hfmt       = [50,0,1]
    #elif category == 'GGF2':
    #	observable = ['GGFMVA2']
    #	hfmt       = [50,0,1]
    #else:
    #	observable = ['HH_m']
    #	hfmt       = [80,200,1000]
    #ori_obs,ori_weights = data.preparedataforprediction(data_3b,transferfactor,observable)
    #tar_obs,tar_weights = data.preparedataforprediction(data_4b,1,observable)
    #plotter.Draw1DHisto(ori_obs, tar_obs, observable[0], folding_weights, hfmt, False,"%s_%s_model"%(tag,category) )
    #del ori_obs,tar_obs,ori_weights,tar_weights
    return folding_weights