本文整理汇总了Python中ROOT.RooArgSet.addClone方法的典型用法代码示例。如果您正苦于以下问题:Python RooArgSet.addClone方法的具体用法?Python RooArgSet.addClone怎么用?Python RooArgSet.addClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooArgSet
的用法示例。
在下文中一共展示了RooArgSet.addClone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readDataSet
# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import addClone [as 别名]
#.........这里部分代码省略.........
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'):
if 1 == len(vnames):
# simple case, just add variable
var = WS(fws, RooRealVar(name, name, -sys.float_info.max,
sys.float_info.max))
iset.addClone(var)
else:
# complicated case - add a bunch of observables, and
# compute something in a RooFormulaVar
from ROOT import RooFormulaVar
args = RooArgList()
for n in vnames:
try:
# skip simple numerical factors
float(n)
except:
var = iset.find(n)
if None == var:
var = WS(fws, RooRealVar(n, n, -sys.float_info.max,
sys.float_info.max))
iset.addClone(var)
args.add(iset.find(n))
var = WS(fws, RooFormulaVar(name, name, name, args))
addiset.addClone(var)
else:
for dsname in ((config['DataSetNames'], )
if type(config['DataSetNames']) == str else
config['DataSetNames']):
break
leaf = f.Get(dsname).GetLeaf(name)
if None == leaf:
leaf = f.Get(dsname).GetLeaf(name + '_idx')
if leaf.GetTypeName() in (
'char', 'unsigned char', 'Char_t', 'UChar_t',
'short', 'unsigned short', 'Short_t', 'UShort_t',
'int', 'unsigned', 'unsigned int', 'Int_t', 'UInt_t',
'long', 'unsigned long', 'Long_t', 'ULong_t',
'Long64_t', 'ULong64_t', 'long long',