Skip to content

Commit 264da1e

Browse files
committed
[skip-ci][tutorials] refactor roofit tutorial
1 parent 42f3188 commit 264da1e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tutorials/roofit/roofit/rf615_simulation_based_inference.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
## \date July 2024
3434
## \author Robin Syring
3535

36-
import ROOT
3736
import numpy as np
37+
import ROOT
3838
from sklearn.neural_network import MLPClassifier
3939

4040
# The samples used for training the classifier in this tutorial / rescale for more accuracy
@@ -45,8 +45,7 @@
4545

4646

4747
# Morphing as a baseline
48-
def morphing(setting):
49-
48+
def morphing(setting, workspace):
5049
# Define binning for morphing
5150
grid = ROOT.RooMomentMorphFuncND.Grid(ROOT.RooBinning(4, 0.0, 4.0))
5251
x_var.setBins(50)
@@ -199,7 +198,7 @@ def learned_likelihood_ratio(x, mu):
199198
ROOT.SetOwnership(nllr_learned, True)
200199

201200
# Compute the morphed nll
202-
morphing(ROOT.RooMomentMorphFuncND.Linear)
201+
morphing(ROOT.RooMomentMorphFuncND.Linear, workspace)
203202
nll_morph = workspace["morph"].createNLL(obs_data)
204203
ROOT.SetOwnership(nll_morph, True)
205204

0 commit comments

Comments
 (0)