-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Low
-
Resolution: Fixed
-
Affects Version/s: 6.18/04
-
Component/s: RooFit/RooStats
-
Labels:None
-
Environment:
All
import ROOT |
|
ws = ROOT.RooWorkspace('ws') # workspace to store fit results, etc. |
|
x = ROOT.RooRealVar('x', 'x', 0) # generate some data in this dimension later |
|
fs = ROOT.TFile('store.root', 'RECREATE') |
ROOT.RooAbsData.setDefaultStorageType(ROOT.RooAbsData.Tree) # use Tree-backed data store |
|
data = ROOT.RooDataSet('data', 'data', ROOT.RooArgSet(x)) |
for v in range(1000): # fill dataset with very meaningful data |
x.setVal(v)
|
data.add(ROOT.RooArgSet(x))
|
|
getattr(ws, 'import')(data) # add dataset to workspace |
# `import` is a python keyword, need to use `getattr` |
|
ws.Print('v') # check that everything looks as expected |
|
wf = ROOT.TFile('ws.root', 'RECREATE') # save workspace to this file |
ws.Write()
|
wf.Close() # this seems to be part of the problem |
|
# when leaving wf opened and deleting `ws` and `data`, there is no segfault
|
# del ws, data
|
|
print('Done!') # the segfault appears after this line |