hep icon indicating copy to clipboard operation
hep copied to clipboard

rootio: add read support for RooWorkspace

Open sbinet opened this issue 8 years ago • 1 comments

this would be interesting for Recast. wouldn't it, @lukasheinrich ?

sbinet avatar Aug 24 '17 18:08 sbinet

yes, if we could read workspaces and run fits, that would be quite helpful. To give you a feel, this is a not-so-minimal example of running it via PyROOT

https://gist.github.com/lukasheinrich/4afa0159fd3f3f51620b12e66abbdf08

but even something simpler that is more like the below would be a great start

f = ROOT.TFile.Open('file.root')
workspace = f.Get('myworkspace')
result = workspace.pdf('pdfname').fitTo(workspace.data('dataname'),
        ROOT.RooFit.Extended(True),
        ROOT.RooFit.Save(True),
        ROOT.RooFit.Minimizer("Minuit","Migrad"),
        ROOT.RooFit.Offset(True)
    )

lukasheinrich avatar Aug 24 '17 18:08 lukasheinrich