當前位置: 首頁>>代碼示例>>Python>>正文


Python Plotter.getNumEntries方法代碼示例

本文整理匯總了Python中Plotter.Plotter.getNumEntries方法的典型用法代碼示例。如果您正苦於以下問題:Python Plotter.getNumEntries方法的具體用法?Python Plotter.getNumEntries怎麽用?Python Plotter.getNumEntries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Plotter.Plotter的用法示例。


在下文中一共展示了Plotter.getNumEntries方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getSignalOverBackground

# 需要導入模塊: from Plotter import Plotter [as 別名]
# 或者: from Plotter.Plotter import getNumEntries [as 別名]
def getSignalOverBackground(analysis,region,period,cut,**kwargs):
    doDataDriven = kwargs.pop('doDataDriven',True)
    scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')

    nl = 3
    sigMap = getSigMap(nl)
    intLumiMap = getIntLumiMap()
    mergeDict = getMergeDict(period)
    channelBackground = getChannelBackgrounds(period)
    channels, leptons = getChannels(nl)
    saves = '%s_%s_%iTeV' % (analysis,region,period)
    ntuples = getNtupleDirectory(analysis,region,period)

    plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_sOverB',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
    plotter.initializeBackgroundSamples([sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]])
    plotter.initializeDataSamples([sigMap[period]['data']])
    plotter.setIntLumi(intLumiMap[period])

    sig = 0.
    sigErr2 = 0.
    bg = 0.
    bgErr2 = 0.
    for b in plotter.backgrounds:
        val, err = plotter.getNumEntries(cut,b,doError=True)
        if b=='WZJets':
            sig += val
            sigErr2 += err**2
        else:
            bg += val
            bgErr2 += err**2
    sigErr = sigErr2**0.5
    bgErr = bgErr2**0.5

    return sig/bg if bg else -1.
開發者ID:senka,項目名稱:InitialStateAnalysis,代碼行數:36,代碼來源:plotterFunctions.py

示例2: getYieldsErrors

# 需要導入模塊: from Plotter import Plotter [as 別名]
# 或者: from Plotter.Plotter import getNumEntries [as 別名]
def getYieldsErrors(analysis,region,period,cut,**kwargs):
    doDataDriven = kwargs.pop('doDataDriven',True)
    scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')

    nl = 3
    sigMap = getSigMap(nl)
    intLumiMap = getIntLumiMap()
    mergeDict = getMergeDict(period)
    channelBackground = getChannelBackgrounds(period)
    channels, leptons = getChannels(nl)
    saves = '%s_%s_%iTeV' % (analysis,region,period)
    ntuples = getNtupleDirectory(analysis,region,period)

    plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_statUnc',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
    plotter.initializeBackgroundSamples([sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]])
    plotter.initializeDataSamples([sigMap[period]['data']])
    plotter.setIntLumi(intLumiMap[period])

    yields = {}
    for chan in ['eee','eem','mme','mmm']:
        yields[chan] = {}
        chanCut = '{0} && channel=="{1}"'.format(cut,chan)
        sig = 0.
        sigErr2 = 0.
        bg = 0.
        bgErr2 = 0.
        for b in plotter.backgrounds:
            val, err = plotter.getNumEntries(chanCut,b,doError=True)
            if b=='WZJets':
                sig += val
                sigErr2 += err**2
            else:
                bg += val
                bgErr2 += err**2
        sigErr = sigErr2**0.5
        bgErr = bgErr2**0.5

        data, dataErr = plotter.getDataEntries(chanCut,doError=True)
        dataErr2 = dataErr**2

        yields[chan]['sig'] = [sig, sigErr]
        yields[chan]['bg'] = [bg, bgErr]
        yields[chan]['data'] = [data, dataErr]

    yields['wz'] = {}
    for i in ['sig','bg','data']:
        tot = sum([yields[chan][i][0] for chan in ['eee','eem','mme','mmm']])
        totErr = sum([yields[chan][i][1]**2 for chan in ['eee','eem','mme','mmm']])**0.5
        yields['wz'][i] = [tot, totErr]

    return yields
開發者ID:senka,項目名稱:InitialStateAnalysis,代碼行數:53,代碼來源:plotterFunctions.py

示例3: getBackgroundEstimation

# 需要導入模塊: from Plotter import Plotter [as 別名]
# 或者: from Plotter.Plotter import getNumEntries [as 別名]
def getBackgroundEstimation(analysis,region,period,cut,**kwargs):
    doDataDriven = kwargs.pop('doDataDriven',True)
    scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')

    nl = 3
    sigMap = getSigMap(nl)
    intLumiMap = getIntLumiMap()
    mergeDict = getMergeDict(period)
    channelBackground = getChannelBackgrounds(period)
    channels, leptons = getChannels(nl)
    saves = '%s_%s_%iTeV' % (analysis,region,period)
    ntuples = getNtupleDirectory(analysis,region,period)

    bgChannels = [sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]]

    plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_bgEstimation',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
    plotter.initializeBackgroundSamples(bgChannels)
    plotter.initializeDataSamples([sigMap[period]['data']])
    plotter.setIntLumi(intLumiMap[period])

    estimates = {}
    for chan in channels:
        thisCut = '{0} && channel=="{1}"'.format(cut,chan)
        estimates[chan] = {}
        obs, obsErr = plotter.getDataEntries(thisCut,doError=True)
        obsErr2 = obsErr**2
        dd = 0.
        ddErr2 = 0.
        mc = 0.
        mcErr2 = 0.
        for bg in bgChannels + ['datadriven']:
            val, err = plotter.getNumEntries(thisCut,bg,doError=True)
            if bg in ['datadriven']:
                dd += val
                ddErr2 += err**2
            else:
                mc += val
                mcErr2 += err**2
        fromMC = [obs - mc, (obsErr2 + mcErr2)**0.5]
        fromDD = [dd, ddErr2**0.5]
        estimates[chan]['mc'] = fromMC
        estimates[chan]['datadriven'] = fromDD

    estimates['total'] = {}
    estimates['total']['mc'] = [sum([estimates[x]['mc'][0] for x in channels]), sum([estimates[x]['mc'][1]**2 for x in channels])**0.5]
    estimates['total']['datadriven'] = [sum([estimates[x]['datadriven'][0] for x in channels]), sum([estimates[x]['datadriven'][1]**2 for x in channels])**0.5]

    return estimates
開發者ID:senka,項目名稱:InitialStateAnalysis,代碼行數:50,代碼來源:plotterFunctions.py


注:本文中的Plotter.Plotter.getNumEntries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。