From ea85f97596bc323ebc2b4be5e22803cc6f382d9b Mon Sep 17 00:00:00 2001 From: Silia Taider Date: Fri, 31 Oct 2025 15:33:21 +0100 Subject: [PATCH] [skip-ci][tutorials] refactor roofit tutorial --- .../roofit/roofit/rf615_simulation_based_inference.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tutorials/roofit/roofit/rf615_simulation_based_inference.py b/tutorials/roofit/roofit/rf615_simulation_based_inference.py index 55cbdd589b9b2..3eaf02cdfce92 100644 --- a/tutorials/roofit/roofit/rf615_simulation_based_inference.py +++ b/tutorials/roofit/roofit/rf615_simulation_based_inference.py @@ -33,8 +33,8 @@ ## \date July 2024 ## \author Robin Syring -import ROOT import numpy as np +import ROOT from sklearn.neural_network import MLPClassifier # The samples used for training the classifier in this tutorial / rescale for more accuracy @@ -45,8 +45,7 @@ # Morphing as a baseline -def morphing(setting): - +def morphing(setting, workspace): # Define binning for morphing grid = ROOT.RooMomentMorphFuncND.Grid(ROOT.RooBinning(4, 0.0, 4.0)) x_var.setBins(50) @@ -199,7 +198,7 @@ def learned_likelihood_ratio(x, mu): ROOT.SetOwnership(nllr_learned, True) # Compute the morphed nll -morphing(ROOT.RooMomentMorphFuncND.Linear) +morphing(ROOT.RooMomentMorphFuncND.Linear, workspace) nll_morph = workspace["morph"].createNLL(obs_data) ROOT.SetOwnership(nll_morph, True)