当前位置: 首页>>代码示例>>Python>>正文


Python RooDataSet.weight方法代码示例

本文整理汇总了Python中ROOT.RooDataSet.weight方法的典型用法代码示例。如果您正苦于以下问题:Python RooDataSet.weight方法的具体用法?Python RooDataSet.weight怎么用?Python RooDataSet.weight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ROOT.RooDataSet的用法示例。


在下文中一共展示了RooDataSet.weight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: float

# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import weight [as 别名]
        for name2 in funcNames :
            covs[name1][name2]  += ( momCoefs[name1][0]  - funcMeans[name1] ) * ( momCoefs[name2][0]  - funcMeans[name2] )
            covsW[name1][name2] += ( momCoefsW[name1][0] - funcMeans[name1] ) * ( momCoefsW[name2][0] - funcMeans[name2] )

# divide covariance sums by number of entries to get covariances
for name1 in funcNames :
    for name2 in funcNames :
        covs[name1][name2]  /= float(nIters)
        covsW[name1][name2] /= float(nIters)

# print data sets from last iteration
noWeightData.Print()
weightData.Print()
for evIt in range(10) :
    print 'not weighted: %+.2f (%.2f)   weighted: %+.2f (%.2f)'\
         % ( noWeightData.get(evIt).getRealValue('x'), noWeightData.weight(), weightData.get(evIt).getRealValue('x'), weightData.weight() )
print

# print moments from last iteration and computed covariances
maxLenName = max( [ len(name) for name in funcNames ] )
from math import sqrt
def printCovs(covMat) :
    print '  errors:'
    for name in funcNames :
        print ( '  {0:>%ds}:  {1:>7.5f}' % maxLenName ).format( name, sqrt( covMat[name][name] ) )
    print

    print '  correlations:'
    print ' ' * ( maxLenName + 5 ) + '   '.join( '{0:>6s}'.format(name) for name in funcNames )
    for name1 in funcNames :
        corrs = [ ( covMat[name1][name2] / sqrt( covMat[name1][name1] * covMat[name2][name2] ) )\
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:testMoments.py

示例2: RooDataSet

# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import weight [as 别名]
weightVar = dataSetAsym.addColumn(weightVar)
obsSet.add(weightVar)

dataSetAsymW = RooDataSet( 'asymDataW', 'asymDataW', obsSet, Import = dataSetAsym, WeightVar = ( 'weightVar', True ) )
del dataSetAsym
ws.put(dataSetAsymW)
del dataSetAsymW
dataSetAsymW = ws['asymDataW']
obsSet = RooArgSet( dataSetAsymW.get() )
dataSetAsymW.Print()

# get sums of weights
sumW = dict( plus = 0., minus = 0. )
for evSet in dataSetAsymW :
    if evSet.getCatIndex('asymCat') == 1 :
        sumW['plus'] += dataSetAsymW.weight()
    else :
        sumW['minus'] += dataSetAsymW.weight()
assert abs( dataSetAsymW.sumEntries() - sumW['plus'] - sumW['minus'] ) < 1.e-5
if applyAngWeights :
    ASumW = 2. * sumW['plus'] - ( sumW['plus'] + sumW['minus'] )
else :
    ASumW = 2. * sumW['plus'] / ( sumW['plus'] + sumW['minus'] ) - 1.

# create arrays of time bins
from array import array
timeArr = array( 'd', [ ( periodShift + ( float(it) + binOffset + 0.5 ) / float(numTimeBins) ) * oscPeriod\
                       for it in range( numTimeBins + 1 ) ] )
timeErrArr = array( 'd', [ 0.5 / float(numTimeBins) * oscPeriod ] * ( numTimeBins + 1 ) )
timeArrPdf = array( 'd', [ ( periodShift + ( float(it) + binOffset + float(frac) ) / float(numTimeBins) ) * oscPeriod\
                           for it in range( numTimeBins + 1 ) for frac in timeFracs ]\
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:plotAsymmetry.py


注:本文中的ROOT.RooDataSet.weight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。