SPlot with weighted events?

Dear RooStats experts,

I have started using the SPlot tool to make plots of control variables in my analysis.

I build a model PDF out of 3 components (1 signal + 2 backgrounds), which I build as RooAddPdf, containing 3 RooHistPdf objects for the 3 components.

The signal and background processes have very different cross-sections, so I want to use event weights.

I build a RooDataSet from a TTree, specifying a weight variable in the constructor
RooDataSet(const char* name, const char* title, TTree* ntuple, const RooArgSet& vars, 0, const char* wgtVarName)
I have verified that RooDataSet::isWeighted() returns true.

I then build an instance of the RooStats::SPlot object via
SPlot(const char* name, const char* title, RooDataSet& data, RooAbsPdf* pdf, const RooArgList& yieldsList)

The SPlot class does not seem to take the event weights into account though: in the stdout, I see messages
[#1] INFO:InputArguments – yield in pdf: QCD_norm 1031.7
[#1] INFO:InputArguments – yield in pdf: WplusJets_norm 2517.02
[#1] INFO:InputArguments – yield in pdf: Ztautau_norm 10039.3
[#1] INFO:Eval – Checking Likelihood normalization:
[#1] INFO:Eval – Yield of specie Sum of Row in Matrix Norm
[#1] INFO:Eval – 1031.7 1031.6 1.00001
[#1] INFO:Eval – 2517.02 2517 1
[#1] INFO:Eval – 10039.3 10039.4 0.999998
[#1] INFO:Eval – Calculating sWeight
which correspond to the number of entries in the TTrees (no event weights applied) and the method SPlot::GetYieldFromSWeight(yieldVarName) returns numbers as well which do not seem to take the event weights into account.

Is there a “trick” which I am missing in order to tell the SPlot algorithm to take event weights into account ?

Thank you very much for your help,


Hi Christian,

Did you ever work out how to ensure sPlot takes into account event weights? Running into the same issue at the moment myself!



Hi Ifan,

I am trying to use splot technique in my analysis. Are You working in root or roofit? If you are working in roofit, I may have some idea about splot.

The general idea is that , We want to separate signal from background. For this We need two variables. One is a well known variable called as discriminating variable(Let mass of a candidate,Here we know what is the signal and background contributions). From discriminating variable, We will be able to find out the contribution of signal and background to control variable(unknown).

So the steps are
(1) Fit the discriminating variable.
(2) Calculate the weights.(signal weight + background weight = 1)
(3) From the weighted data sets, plot the control variable(Two separate plots one is for signal contribution and another is for background).