本文整理汇总了Python中ROOT.RooArgSet.fwdIterator方法的典型用法代码示例。如果您正苦于以下问题:Python RooArgSet.fwdIterator方法的具体用法?Python RooArgSet.fwdIterator怎么用?Python RooArgSet.fwdIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooArgSet
的用法示例。
在下文中一共展示了RooArgSet.fwdIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readDataSet
# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import fwdIterator [as 别名]
#.........这里部分代码省略.........
elif rem > 0.5: return xfl + 1
else:
if xfl % 2: return xfl + 1
else: return xfl
# another small helper routine
def tokenize(s, delims = '+-*/()?:'):
# FIXME: this goes wrong for numerical constants like 1.4e-3
# proposed solution: regexp for general floating point constants,
# replace occurences of matches with empty string
delims = [ c for c in delims ]
delims.insert(0, None)
for delim in delims:
tmp = s.split(delim)
tmp = list(set(( s + ' ' for s in tmp)))
s = ''.join(tmp)
tmp = list(set(s.split(None)))
return tmp
# figure out which names from the mapping we need - look at the observables
names = ()
for n in config['DataSetVarNameMapping'].keys():
if None != observables.find(n):
names += (n,)
# build RooArgSets and maps with source and destination variables
dmap = { }
for k in names: dmap[k] = observables.find(k)
if None in dmap.values():
raise NameError('Some variables not found in destination: %s' % str(dmap))
dset = RooArgSet()
for v in dmap.values(): dset.add(v)
if None != dset.find('weight'):
# RooFit insists on weight variable being first in set
tmpset = RooArgSet()
tmpset.add(dset.find('weight'))
it = dset.fwdIterator()
while True:
obj = it.next()
if None == obj: break
if 'weight' == obj.GetName(): continue
tmpset.add(obj)
dset = tmpset
del tmpset
ddata = RooDataSet('agglomeration', 'of positronic circuits', dset, 'weight')
else:
ddata = RooDataSet('agglomeration', 'of positronic circuits', dset)
# open file with data sets
f = TFile(config['DataFileName'], 'READ')
# get workspace
fws = f.Get(config['DataWorkSpaceName'])
ROOT.SetOwnership(fws, True)
if None == fws or not fws.InheritsFrom('RooWorkspace'):
# ok, no workspace, so try to read a tree of the same name and
# synthesize a workspace
from ROOT import RooWorkspace, RooDataSet, RooArgList
fws = RooWorkspace(config['DataWorkSpaceName'])
iset = RooArgSet()
addiset = RooArgList()
it = observables.fwdIterator()
while True:
obj = it.next()
if None == obj: break
name = config['DataSetVarNameMapping'][obj.GetName()]
vnames = tokenize(name)
if len(vnames) > 1 and not obj.InheritsFrom('RooAbsReal'):
print 'Error: Formulae not supported for categories'
return None
if obj.InheritsFrom('RooAbsReal'):