def get_electron_normalisation(met_bin, b_tag):
    global electron_data_file
    input_file = File(electron_data_file)
    histogram_for_estimation = 'TTbarPlusMetAnalysis/EPlusJets/QCD e+jets PFRelIso/BinnedMETAnalysis/Electron_patType1CorrectedPFMet_bin_%s/electron_pfIsolation_03_%s' % (met_bin, b_tag)
    input_histogram = input_file.Get(histogram_for_estimation)
    result = estimate_with_fit_to_relative_isolation(input_histogram)
    value, error = result['value'], result['error']
    return value, error
def get_electron_normalisation(met_bin, b_tag):
    global electron_data_file
    input_file = File(electron_data_file)
    histogram_for_estimation = 'TTbarPlusMetAnalysis/EPlusJets/QCD e+jets PFRelIso/BinnedMETAnalysis/Electron_patType1CorrectedPFMet_bin_%s/electron_pfIsolation_03_%s' % (
        met_bin, b_tag)
    input_histogram = input_file.Get(histogram_for_estimation)
    result = estimate_with_fit_to_relative_isolation(input_histogram)
    value, error = result['value'], result['error']
    return value, error
Ejemplo n.º 3
0
        1528. / 0.48,
        'QCDStudy/PFIsolation_3jets_WithMETCutAndAsymJetCuts_1orMoreBtag':
        491. / 0.67,
        'QCDStudy/PFIsolation_WithMETCutAndAsymJetCuts_DR03_0btag':
        1398. / 0.61,
        'QCDStudy/PFIsolation_WithMETCutAndAsymJetCuts_DR03_1btag':
        504. / 0.79,
        'QCDStudy/PFIsolation_WithMETCutAndAsymJetCuts_DR03_2orMoreBtags':
        210 / 0.73
    }

    QCD_rate_estimation.relative_isolation_bias = 0.0
    results = {}
    for histogram_for_estimation in histograms_for_estimation:
        input_histogram = input_file.Get(histogram_for_estimation)
        result = estimate_with_fit_to_relative_isolation(input_histogram)
        results[histogram_for_estimation] = result
        #QCD normalised to lumi
        input_histogram_qcd = File(histogram_files['QCD']).Get(
            histogram_for_estimation.replace('_DR03_', '_'))
        input_histogram_qcd.Scale((1.0 * lumi) / 1959.75)
        input_histogram_qcd.Rebin(10)
        nQCD = input_histogram_qcd.GetBinContent(1)
        #        print nQCD
        #        nQCD = qcd_expected[histogram_for_estimation]
        fQCD = '---'
        if not nQCD == 0:
            fQCD = (result['value']) / nQCD
        print histogram_for_estimation, ':', result['value'], '+-', result[
            'error'], 'QCD: ', nQCD, ',f_QCD:', fQCD
'''
Created on 15 Jan 2013

@author: kreczko
This module will provide estimates for the number of QCD events after event selection.
It will be able to do the closure test (option --do-closure-test) 
as well get the calibration curve for the estimates (option --make-calibration-curves).
In addition to above it should provide an easy way to present the binned estimates (MET, b-tag, other bins)

'''
from tools.QCD_rate_estimation import estimate_with_fit_to_relative_isolation
from rootpy.io import File

path_to_files = '/storage/TopQuarkGroup/results/histogramfiles/AN-12-241_V4/'
electron_data_file = path_to_files + 'central/ElectronHad_5050pb_PFElectron_PFMuon_PF2PATJets_PFMET.root'

input_file = File(electron_data_file)
histogram_for_estimation = 'TTbarPlusMetAnalysis/EPlusJets/QCD e+jets PFRelIso/BinnedMETAnalysis/Electron_patType1CorrectedPFMet_bin_0-25/electron_pfIsolation_03_0btag'

input_histogram = input_file.Get(histogram_for_estimation)

result = estimate_with_fit_to_relative_isolation(input_histogram)
print result