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


Python RooRealVar.setBinning方法代码示例

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


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

示例1: assert

# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setBinning [as 别名]
## acceptance
spline_knots = [ 0.5, 1.0, 1.5, 2.0, 3.0, 12.0 ]
spline_coeffs = [ 5.03902e-01, 7.32741e-01, 9.98736e-01,
                  1.16514e+00, 1.25167e+00, 1.28624e+00 ]
assert(len(spline_knots) == len(spline_coeffs))

# knot binning
knotbinning = RooBinning(time.getMin(), time.getMax(),
                         '{}_knotbinning'.format(mode))
for v in spline_knots:
    knotbinning.addBoundary(v)
knotbinning.removeBoundary(time.getMin())
knotbinning.removeBoundary(time.getMax())
oldbinning, lo, hi = time.getBinning(), time.getMin(), time.getMax()
time.setBinning(knotbinning, '{}_knotbinning'.format(mode))
time.setBinning(oldbinning)
time.setRange(lo, hi)
del knotbinning, oldbinning, lo, hi

# knot coefficients
coefflist = RooArgList()
for i, v in enumerate(spline_coeffs):
    coefflist.add(const(v))
i = len(spline_coeffs)
coefflist.add(one)
spline_knots.append(time.getMax())
spline_knots.reverse()
fudge = (spline_knots[0] - spline_knots[1]) / (spline_knots[2] - spline_knots[1])
lastmycoeffs = RooArgList()
lastmycoeffs.add(const(1. - fudge))
开发者ID:suvayu,项目名称:B2DXFitters,代码行数:32,代码来源:plot-kfactor-MC.py

示例2: dict

# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setBinning [as 别名]
year_label.SetBorderSize(0)

fitOpts = dict(NumCPU = 8, Timer = 1, Save = True, Minimizer = 'Minuit2', Optimize = 1,
               Offset = True, Strategy = 1)

pos = args[0].find('MC')
from P2VV.Utilities.Resolution import plot_dir

if options.momentum_calib:
    from array import array
    tt_bins = array('d', [0.0, 0.09928, 0.2059, 0.3207, 0.447, 0.5844, 0.7365, 0.9077, 1.101, 1.325, 1.592, 1.916, 2.332, 2.916, 3.92, 14.0])

    from ROOT import RooBinning
    tt_binning = RooBinning(len(tt_bins) - 1, tt_bins)
    tt_binning.SetName('tt_binning')
    t_true.setBinning(tt_binning, 'tt_binning')

    from P2VV.RooFitWrappers import BinningCategory
    tt_cat = BinningCategory(t_true.GetName() + '_cat', Observable = t_true, Binning = tt_binning,
                             CatTypeName = 'tt_bin_', Data = sdata, Fundamental = True)

    split_pdf = w.factory('SIMCLONE::split_pdf(model,$SplitParam(sigma_sigma,truetime_cat),'
                          + '$SplitParam(av_sigma,truetime_cat),$SplitParam(mean,truetime_cat),'
                          + '$SplitParam(frac_gexps,truetime_cat))')

    fitOpts = dict(NumCPU = 4, Timer = 1, Save = True, Minimizer = 'Minuit2', Optimize = 1,
                   Offset = True, Strategy = 1)
    for i in range(3):
        result = split_pdf.fitTo(sdata, SumW2Error = False, **fitOpts)
        if result.status() == 0 and abs(result.minNll()) < 5e5:
            break
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:fit_tdiff_sigmat.py


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