From 381af8f2d1a7c58f5a784f5498b0ca79b23641cb Mon Sep 17 00:00:00 2001 From: Vanya Belyaev Date: Sat, 10 Aug 2024 14:37:49 +0200 Subject: [PATCH] ? --- ostap/fitting/dataset.py | 27 +++++++++++++++------ ostap/fitting/tests/test_fitting_dataset.py | 1 + 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ostap/fitting/dataset.py b/ostap/fitting/dataset.py index 96169fe5..433cfc6e 100644 --- a/ostap/fitting/dataset.py +++ b/ostap/fitting/dataset.py @@ -1677,34 +1677,47 @@ def _rds_makeWeighted_ ( dataset , >>> dataset = ... >>> wdata = dataset.makeWeighted ( 'S_sw' ) """ + + print ( 'MAKE EI"GHOTED/0' ) assert not dataset.isWeighted () , "Dataset '%s/%s' is already weighted!" % ( dataset.GetName () , dataset.GetTitle () ) + print ( 'MAKE EI"GHOTED/1' ) + assert isinstance ( weightvar , expression_types ) , \ "Invalid type of `weigthvar':%s" % type ( weightvar ) assert isinstance ( cuts , expression_types ) or not cuts , \ "Invalid type of `cuts':%s" % type ( cuts ) + print ( 'MAKE EI"GHOTED/2' ) + ## cuts = str ( cuts ).strip() weightvar = str ( weightvar ).strip() + print ( 'MAKE EI"GHOTED/3' ) + if not weightvar in dataset : ## is it a formula ? wname = wname or 'Weight' while wname in dataset : wname += 'W' dataset.addVar ( wname , weightwar ) weightvar = wname + + print ( 'MAKE EI"GHOTED/4' ) varset = dataset.get() ## make weighted dataset - return ROOT.RooDataSet ( dsID() , - dataset.GetTitle() , - dataset , - varset , - cuts , - weightvar ) - + result = ROOT.RooDataSet ( dsID() , + dataset.GetTitle() , + dataset , + varset , + cuts , + weightvar ) + + print ( 'MAKE EI"GHOTED/5' ) + return result + ROOT.RooDataSet.makeWeighted = _rds_makeWeighted_ # ============================================================================= diff --git a/ostap/fitting/tests/test_fitting_dataset.py b/ostap/fitting/tests/test_fitting_dataset.py index 09da76f7..d4e44374 100644 --- a/ostap/fitting/tests/test_fitting_dataset.py +++ b/ostap/fitting/tests/test_fitting_dataset.py @@ -59,6 +59,7 @@ # ============================================================================= +logger.info ( 'Print unweighted dataset:\n%s' % dataset .table ( prefix = '# ' ) ) weighted = dataset.makeWeighted ( 'Weight' ) """