def main():
    parser = OptionParser(__doc__)
    parser.add_option("-c", "--centre-of-mass-energy", dest="CoM", default=13, type=int,
                      help="set the centre of mass energy for analysis. Default = 13 [TeV]")
    parser.add_option('-d', '--debug', dest="debug", action="store_true",
                      help="Print the debug information")
    (options, _) = parser.parse_args()
    centre_of_mass_energy = options.CoM
    # set global variables
    debug = options.debug
    if debug:
        log.setLevel(log.DEBUG)

    measurement_config = XSectionConfig(centre_of_mass_energy)
    categories = ['QCD_shape']
    categories.extend(measurement_config.categories_and_prefixes.keys())
    categories.extend(measurement_config.rate_changing_systematics_names)
    categories.extend([measurement_config.vjets_theory_systematic_prefix + scale for scale in ['scaleup', 'scaledown']])

    for variable in measurement_config.variables:
        for category in categories:
            for channel in ['electron', 'muon']:
                if channel == 'electron' and (category == 'Muon_down' or category == 'Muon_up'):
                    continue
                elif channel == 'muon' and (category == 'Electron_down' or category == 'Electron_up'):
                    continue
                # create_measurement(
                #     centre_of_mass_energy, category, variable, channel,
                #     phase_space='FullPS', norm_method='background_subtraction')
                # and the visible phase space
                create_measurement(
                    centre_of_mass_energy, category, variable, channel,
                    phase_space='VisiblePS', norm_method='background_subtraction')
Ejemplo n.º 2
0
def main():
    parser = OptionParser(__doc__)
    parser.add_option(
        "-c",
        "--centre-of-mass-energy",
        dest="CoM",
        default=13,
        type=int,
        help="set the centre of mass energy for analysis. Default = 13 [TeV]")
    parser.add_option('-d',
                      '--debug',
                      dest="debug",
                      action="store_true",
                      help="Print the debug information")
    (options, _) = parser.parse_args()
    centre_of_mass_energy = options.CoM
    # set global variables
    debug = options.debug
    if debug:
        log.setLevel(log.DEBUG)

    measurement_config = XSectionConfig(centre_of_mass_energy)
    categories = ['QCD_shape']
    categories.extend(measurement_config.categories_and_prefixes.keys())
    categories.extend(measurement_config.rate_changing_systematics_names)
    categories.extend([
        measurement_config.vjets_theory_systematic_prefix + scale
        for scale in ['scaleup', 'scaledown']
    ])

    for variable in measurement_config.variables:
        for category in categories:
            for channel in ['electron', 'muon']:
                if channel == 'electron' and (category == 'Muon_down'
                                              or category == 'Muon_up'):
                    continue
                elif channel == 'muon' and (category == 'Electron_down'
                                            or category == 'Electron_up'):
                    continue
                # create_measurement(
                #     centre_of_mass_energy, category, variable, channel,
                #     phase_space='FullPS', norm_method='background_subtraction')
                # and the visible phase space
                create_measurement(centre_of_mass_energy,
                                   category,
                                   variable,
                                   channel,
                                   phase_space='VisiblePS',
                                   norm_method='background_subtraction')
        properties.y_axis_title = r'$\frac{1}{\sigma}  \frac{d\sigma}{d' + \
            variables_latex[variable] + '}$'
        properties.legend_location = (0.95, 0.40)
        if variable == 'NJets':
            properties.legend_location = (0.97, 0.80)
        properties.formats = ['png']

        compare_measurements(models=models, measurements=measurements, show_measurement_errors=True,
                             histogram_properties=properties, save_folder='plots/', save_as=properties.formats)


if __name__ == '__main__':
    import sys
    if '-d' in sys.argv:
        from dps.utils.logger import log
        log.setLevel(log.DEBUG)

    compare_combine_before_after_unfolding(measurement='unfolded_normalisation')
    compare_combine_before_after_unfolding(measurement='normalised_xsection')
    compare_combine_before_after_unfolding_uncertainties()
    compare_unfolding_methods('normalised_xsection')
    compare_unfolding_methods('normalised_xsection', add_before_unfolding=True)
    compare_unfolding_methods(
        'normalised_xsection', add_before_unfolding=True, channel='electron')
    compare_unfolding_methods(
        'normalised_xsection', add_before_unfolding=True, channel='muon')
    compare_unfolding_methods('unfolded_normalisation')
    compare_unfolding_methods(
        'unfolded_normalisation', add_before_unfolding=True)
    compare_unfolding_methods(
        'unfolded_normalisation', add_before_unfolding=True, channel='electron')
def main():
    parser = ArgumentParser(__doc__)
    parser.add_argument(
        "-c",
        "--centre-of-mass-energy",
        dest="CoM",
        default=13,
        type=int,
        help="set the centre of mass energy for analysis. Default = 13 [TeV]")
    parser.add_argument('-d',
                        '--debug',
                        dest="debug",
                        action="store_true",
                        help="Print the debug information")
    parser.add_argument('-q',
                        '--qcd_from_data',
                        dest="data_driven_qcd",
                        default=True,
                        help="Print the debug information")
    parser.add_argument('--control_plot_binning',
                        dest="control_plot_binning",
                        action="store_true",
                        help="Use the binning for the control plots")
    args = parser.parse_args()

    options = {}
    options['com'] = args.CoM
    options['data_driven_qcd'] = args.data_driven_qcd
    options['control_plot_binning'] = args.control_plot_binning
    if args.debug: log.setLevel(log.DEBUG)

    xsec_config = XSectionConfig(options['com'])
    categories = xsec_config.normalisation_systematics
    print categories

    # Create specific configs required
    for ps in ['VisiblePS', 'FullPS']:
        options['ps'] = ps
        for channel in ['electron', 'muon']:
            options['channel'] = channel
            for variable in xsec_config.variables:
                options['variable'] = variable
                for category in categories:
                    if channel == 'electron' and (category == 'Muon_down'
                                                  or category == 'Muon_up'):
                        continue
                    elif channel == 'muon' and (category == 'Electron_down'
                                                or category == 'Electron_up'):
                        continue
                    elif variable in xsec_config.variables_no_met and category in xsec_config.met_specific_systematics:
                        continue
                    options['category'] = category

                    m = create_measurement(
                        options,
                        norm_method='background_subtraction',
                    )

                    write_measurement(
                        options,
                        m,
                        norm_method='background_subtraction',
                    )
def main():
    parser = ArgumentParser(__doc__)
    parser.add_argument(
    	"-c", 
    	"--centre-of-mass-energy", 
    	dest="CoM", 
    	default=13, 
    	type=int,
        help="set the centre of mass energy for analysis. Default = 13 [TeV]"
    )
    parser.add_argument(
    	'-d', 
    	'--debug', 
    	dest="debug", 
    	action="store_true",
        help="Print the debug information"
    )
    parser.add_argument(
        '-q', 
        '--qcd_from_data', 
        dest="data_driven_qcd", 
        default=True, 
        help="Print the debug information"
    )
    args = parser.parse_args()

    options = {}
    options['com'] = args.CoM
    options['data_driven_qcd'] = args.data_driven_qcd
    if args.debug: log.setLevel(log.DEBUG)


    xsec_config = XSectionConfig(options['com'])
    categories = xsec_config.normalisation_systematics
    print categories

    # Create specific configs required
    for ps in ['VisiblePS', 'FullPS']:
        options['ps']=ps
        for channel in ['electron', 'muon']:
            options['channel']=channel
            for variable in xsec_config.variables:
                options['variable']=variable
                for category in categories:
                    if channel == 'electron' and (category == 'Muon_down' or category == 'Muon_up'):
                        continue
                    elif channel == 'muon' and (category == 'Electron_down' or category == 'Electron_up'):
                        continue
                    elif variable in xsec_config.variables_no_met and category in xsec_config.met_specific_systematics: 
                        continue
                    options['category']=category

                    m = create_measurement(
                        options,
                        norm_method='background_subtraction',
                    )

                    write_measurement(
                        options,
                        m,
                        norm_method='background_subtraction',
                    )