def calculate_xsections(normalisation, category, channel):
    global variable, met_type, path_to_JSON
    # calculate the x-sections
    TTJet_xsection = calculate_xsection(normalisation['TTJet_measured'], luminosity, 0.15)  # L in pb1
    TTJet_xsection_unfolded = calculate_xsection(normalisation['TTJet_unfolded'], luminosity, 0.15)  # L in pb1
    MADGRAPH_xsection = calculate_xsection(normalisation['MADGRAPH'], luminosity, 0.15)  # L in pb1
    POWHEG_xsection = calculate_xsection(normalisation['POWHEG'], luminosity, 0.15)  # L in pb1
    MCATNLO_xsection = calculate_xsection(normalisation['MCATNLO'], luminosity, 0.15)  # L in pb1
    matchingdown_xsection = calculate_xsection(normalisation['matchingdown'], luminosity, 0.15)  # L in pb1
    matchingup_xsection = calculate_xsection(normalisation['matchingup'], luminosity, 0.15)  # L in pb1
    scaledown_xsection = calculate_xsection(normalisation['scaledown'], luminosity, 0.15)  # L in pb1
    scaleup_xsection = calculate_xsection(normalisation['scaleup'], luminosity, 0.15)  # L in pb1
    
    xsection_unfolded = {'TTJet_measured' : TTJet_xsection,
                         'TTJet_unfolded' : TTJet_xsection_unfolded,
                         'MADGRAPH': MADGRAPH_xsection,
                         'POWHEG': POWHEG_xsection,
                         'MCATNLO': MCATNLO_xsection,
                         #systematics
                         'matchingdown': matchingdown_xsection,
                         'matchingup': matchingup_xsection,
                         'scaledown': scaledown_xsection,
                         'scaleup': scaleup_xsection
                         }
    write_data_to_JSON(xsection_unfolded, path_to_JSON + '/' + variable + '/xsection_measurement_results' + '/kv' + str(unfoldCfg.SVD_k_value) + '/' + category + '/xsection_' + channel + '_' + met_type + '.txt')
Exemple #2
0
def calculate_xsections(normalisation, category, channel):
    global variable, met_type, path_to_JSON
    # calculate the x-sections
    TTJet_xsection = calculate_xsection(normalisation['TTJet_measured'],
                                        luminosity, 0.15)  # L in pb1
    TTJet_xsection_unfolded = calculate_xsection(
        normalisation['TTJet_unfolded'], luminosity, 0.15)  # L in pb1
    MADGRAPH_xsection = calculate_xsection(normalisation['MADGRAPH'],
                                           luminosity, 0.15)  # L in pb1
    POWHEG_xsection = calculate_xsection(normalisation['POWHEG'], luminosity,
                                         0.15)  # L in pb1
    MCATNLO_xsection = calculate_xsection(normalisation['MCATNLO'], luminosity,
                                          0.15)  # L in pb1
    matchingdown_xsection = calculate_xsection(normalisation['matchingdown'],
                                               luminosity, 0.15)  # L in pb1
    matchingup_xsection = calculate_xsection(normalisation['matchingup'],
                                             luminosity, 0.15)  # L in pb1
    scaledown_xsection = calculate_xsection(normalisation['scaledown'],
                                            luminosity, 0.15)  # L in pb1
    scaleup_xsection = calculate_xsection(normalisation['scaleup'], luminosity,
                                          0.15)  # L in pb1

    xsection_unfolded = {
        'TTJet_measured': TTJet_xsection,
        'TTJet_unfolded': TTJet_xsection_unfolded,
        'MADGRAPH': MADGRAPH_xsection,
        'POWHEG': POWHEG_xsection,
        'MCATNLO': MCATNLO_xsection,
        #systematics
        'matchingdown': matchingdown_xsection,
        'matchingup': matchingup_xsection,
        'scaledown': scaledown_xsection,
        'scaleup': scaleup_xsection
    }
    write_data_to_JSON(
        xsection_unfolded, path_to_JSON + '/' + variable +
        '/xsection_measurement_results' + '/kv' + str(unfoldCfg.SVD_k_value) +
        '/' + category + '/xsection_' + channel + '_' + met_type + '.txt')
def calculate_xsections( normalisation, category, channel ):
    '''
    Calculate the xsection
    '''
    global variable, path_to_DF
    # calculate the x-sections
    branching_ratio = 0.15
    if 'combined' in channel:
        branching_ratio = branching_ratio * 2

    xsection_unfolded = {}
    xsection_unfolded['TTJet_measured'] = calculate_xsection( 
        normalisation['TTJet_measured'], 
        luminosity,  # L in pb1
        branching_ratio 
    )  
    xsection_unfolded['TTJet_measured_withoutFakes'] = calculate_xsection( 
        normalisation['TTJet_measured_withoutFakes'], 
        luminosity, 
        branching_ratio 
    ) 
    xsection_unfolded['TTJet_unfolded'] = calculate_xsection( 
        normalisation['TTJet_unfolded'], 
        luminosity, 
        branching_ratio
    )

    if category == 'central':
        xsection_unfolded['powhegPythia8'] = calculate_xsection( 
            normalisation['powhegPythia8'], 
            luminosity, 
            branching_ratio 
        )
        # xsection_unfolded['amcatnlo'] = calculate_xsection( 
        #     normalisation['amcatnlo'], 
        #     luminosity, 
        #     branching_ratio 
        # )
        xsection_unfolded['powhegHerwig'] = calculate_xsection( 
            normalisation['powhegHerwig'], 
            luminosity, 
            branching_ratio 
        )
        # xsection_unfolded['madgraphMLM'] = calculate_xsection( 
        #     normalisation['madgraphMLM'], 
        #     luminosity, 
        #     branching_ratio 
        # )

        xsection_unfolded['massdown'] = calculate_xsection( 
            normalisation['massdown'], 
            luminosity, 
            branching_ratio 
        )
        xsection_unfolded['massup'] = calculate_xsection( 
            normalisation['massup'], 
            luminosity, 
            branching_ratio 
        )
        xsection_unfolded['isrdown'] = calculate_xsection( 
            normalisation['isrdown'], 
            luminosity, 
            branching_ratio 
        )
        xsection_unfolded['isrup'] = calculate_xsection( 
            normalisation['isrup'], 
            luminosity, 
            branching_ratio 
        )
        # xsection_unfolded['fsrdown'] = calculate_xsection( 
            # normalisation['fsrdown'], 
        #     luminosity, 
        #     branching_ratio 
        # )
        xsection_unfolded['fsrup'] = calculate_xsection( 
            normalisation['fsrup'], 
            luminosity, 
            branching_ratio 
        )
        xsection_unfolded['uedown'] = calculate_xsection( 
            normalisation['uedown'], 
            luminosity, 
            branching_ratio 
        )
        xsection_unfolded['ueup'] = calculate_xsection( 
            normalisation['ueup'], 
            luminosity, 
            branching_ratio 
        )


    file_template = '{path_to_DF}/{category}/xsection_{channel}_{method}.txt'
    write_02(xsection_unfolded, file_template, path_to_DF, category, channel, method)
    return
def calculate_xsections( normalisation, category, channel ):
    global variable, met_type, path_to_JSON
    # calculate the x-sections
    branching_ratio = 0.15
    if channel == 'combined':
        branching_ratio = branching_ratio * 2
    TTJet_xsection = calculate_xsection( normalisation['TTJet_measured'], luminosity, branching_ratio )  # L in pb1
    TTJet_withoutFakes_xsection = calculate_xsection( normalisation['TTJet_measured_withoutFakes'], luminosity, branching_ratio )  # L in pb1
    TTJet_xsection_unfolded = calculate_xsection( normalisation['TTJet_unfolded'], luminosity, branching_ratio )  # L in pb1

    xsection_unfolded = {'TTJet_measured' : TTJet_xsection,
                         'TTJet_measured_withoutFakes' : TTJet_withoutFakes_xsection,
                         'TTJet_unfolded' : TTJet_xsection_unfolded,
                         }

    if category == 'central':
        powhegPythia8_xsection = calculate_xsection( normalisation['powhegPythia8'], luminosity, branching_ratio )  # L in pb1
        amcatnlo_xsection = calculate_xsection( normalisation['amcatnlo'], luminosity, branching_ratio )  # L in pb1
        powhegHerwig_xsection = calculate_xsection( normalisation['powhegHerwig'], luminosity, branching_ratio )  # L in pb1
        # amcatnloHerwig_xsection = calculate_xsection( normalisation['amcatnloHerwig'], luminosity, branching_ratio )  # L in pb1
        madgraphMLM_xsection = calculate_xsection( normalisation['madgraphMLM'], luminosity, branching_ratio )

        scaledown_xsection = calculate_xsection( normalisation['scaledown'], luminosity, branching_ratio )  # L in pb1
        scaleup_xsection = calculate_xsection( normalisation['scaleup'], luminosity, branching_ratio )  # L in pb1
        massdown_xsection = calculate_xsection( normalisation['massdown'], luminosity, branching_ratio )  # L in pb1
        massup_xsection = calculate_xsection( normalisation['massup'], luminosity, branching_ratio )  # L in pb1

        xsection_unfolded['powhegPythia8'] =  powhegPythia8_xsection
        xsection_unfolded['amcatnlo'] =  amcatnlo_xsection
        xsection_unfolded['madgraphMLM'] =  madgraphMLM_xsection
        xsection_unfolded['powhegHerwig'] =  powhegHerwig_xsection
        # xsection_unfolded['amcatnloHerwig'] =  amcatnloHerwig_xsection

        xsection_unfolded['scaledown'] =  scaledown_xsection
        xsection_unfolded['scaleup'] =  scaleup_xsection
        xsection_unfolded['massdown'] =  massdown_xsection
        xsection_unfolded['massup'] =  massup_xsection
    file_template = '{path_to_JSON}/{category}/xsection_{channel}_{method}.txt'
    filename = file_template.format(
                path_to_JSON = path_to_JSON,
                category = category,
                channel = channel,
                method = method,
                )

    write_data_to_JSON( xsection_unfolded, filename )