From 3f72533298984b15aff6f2cfc52bc5392964f33e Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Mon, 17 Nov 2025 23:23:45 +0100 Subject: [PATCH] [RF] Fix the example in the RooAbsDataHelper documentation Fix the example to correctly construct a weighted RooDataSet. Thanks to the following forum post for spotting this: https://root-forum.cern.ch/t/pythonization-of-roodatasethelper-with-weights-not-working/ --- roofit/roofitcore/inc/RooAbsDataHelper.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/roofit/roofitcore/inc/RooAbsDataHelper.h b/roofit/roofitcore/inc/RooAbsDataHelper.h index bd2b557a05160..5347b3b862fb0 100644 --- a/roofit/roofitcore/inc/RooAbsDataHelper.h +++ b/roofit/roofitcore/inc/RooAbsDataHelper.h @@ -99,14 +99,17 @@ class RActionImpl; /// /// All arguments passed to are forwarded to RooDataSet::RooDataSet() / RooDataHist::RooDataHist(). /// -/// #### Usage example: +/// #### Usage example for a weighted RooDataSet: /// ``` /// RooRealVar x("x", "x", -5., 5.); /// RooRealVar y("y", "y", -50., 50.); -/// auto myDataSet = rdataframe.Book( -/// RooDataSetHelper{"dataset", // Name (directly forwarded to RooDataSet::RooDataSet()) -/// "Title of dataset", // Title ( ~ " ~ ) -/// RooArgSet(x, y) }, // Variables to create in dataset +/// auto myDataSet = rdataframe.Book( // three template arguments for "x", "y", and "weight" +/// RooDataSetHelper{ +/// "dataset", // Name (directly forwarded to RooDataSet::RooDataSet()) +/// "Title of dataset", // Title ( ~ " ~ ) +/// RooArgSet(x, y), // Variables to create in dataset +/// RooFit::WeightVar("weight") // skip in case of RooDataHist or unweighted dataset +/// }, /// {"x", "y", "weight"} // Column names from RDataFrame /// // (this example uses an additional column for the weight) /// );