本文整理汇总了Python中ROOT.RooArgSet.createIterator方法的典型用法代码示例。如果您正苦于以下问题:Python RooArgSet.createIterator方法的具体用法?Python RooArgSet.createIterator怎么用?Python RooArgSet.createIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooArgSet
的用法示例。
在下文中一共展示了RooArgSet.createIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plcLimit
# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import createIterator [as 别名]
def plcLimit(obs_, poi_, model, ws, data, CL = 0.95, verbose = False):
# obs : observable variable or RooArgSet of observables
# poi : parameter of interest or RooArgSet of parameters
# model : RooAbsPdf of model to consider including any constraints
# data : RooAbsData of the data
# CL : confidence level for interval
# returns a dictionary with the upper and lower limits for the first/only
# parameter in poi_ as well as the interval object and status flag
obs = RooArgSet(obs_)
obs.setName('observables')
poi = RooArgSet(poi_)
poi.setName('poi')
poi.setAttribAll('Constant', False)
nuis = model.getParameters(obs)
nuis.remove(poi)
nuis.remove(nuis.selectByAttrib('Constant', True))
nuis.setName('nuisance')
if verbose:
print 'observables'
obs.Print('v')
print 'parameters of interest'
poi.Print('v')
print 'nuisance parameters'
nuis.Print('v')
mc = RooStats.ModelConfig('mc')
mc.SetWorkspace(ws)
mc.SetPdf(model)
mc.SetObservables(obs)
mc.SetParametersOfInterest(poi)
mc.SetNuisanceParameters(nuis)
plc = RooStats.ProfileLikelihoodCalculator(data, mc)
plc.SetConfidenceLevel(CL)
interval = plc.GetInterval()
upperLimit = Double(999.)
lowerLimit = Double(0.)
Limits = {}
paramIter = poi.createIterator()
param = paramIter.Next()
while param:
ok = interval.FindLimits(param, lowerLimit, upperLimit)
Limits[param.GetName()] = {'ok' : ok, 'upper' : float(upperLimit),
'lower' : float(lowerLimit)}
param = paramIter.Next()
if verbose:
print '%.0f%% CL limits' % (interval.ConfidenceLevel() * 100)
print Limits
Limits['interval'] = interval
return Limits