Hi,
I have performed fit using sPlot technique and calculated the sWeights for signal and background components. There is a straightforward way in which I can plot the variable with sWeight_signal (signal weight). But, I want to plot the variable which pass some signal weight selection criteria. Here is my sample script,
RooDataSet *data = new RooDataSet("data","data",RooArgSet(mbc,lid_l1));
for(int i=0;i<tree->GetEntries();i++){
tree->GetEntry(i);
mbc.setVal(s_mbc);
lid_l1.setVal(s_lid_l1);
data->add(RooArgSet(mbc,lid_l1));
}
//perform fit
RooFitResult * r = (RooFitResult*)model.fitTo(*data," ", RooFit::Save(),SumW2Error(kTRUE));
r->Print("v");
// Create the sPlot data from the fit to mass.
RooStats::SPlot* sDataX = new RooStats::SPlot("sData","An SPlot", *data, &model, RooArgList(nsig,nbkg));
cout << "Yield of signal is " << nsig.getVal() << " From sWeights it is " << sDataX->GetYieldFromSWeight("nsig") <<endl;
cout << "Yield of continuum is " << nbkg.getVal() << " From sWeights it is " << sDataX->GetYieldFromSWeight("nbkg") <<endl;
RooDataSet * dataw_sig = new RooDataSet(data->GetName(),data->GetTitle(),data,*data->get(),"nsig_sw") ;
RooPlot* frame_sig = lid_l1.frame(Bins(101)) ;
frame_sig->SetTitle("sPlot for signal");
dataw_sig->plotOn(frame_sig, RooFit::DataError(RooAbsData::SumW2) ) ;
Here, I have performed fit in “mbc” with nsig and nbkg as the number of signal and background events, and calculated the sWeight for signal. The sWeight_signal are projected in another variable “lid_l1”. But, I want to see lid_l1 distribution which have sWeight_signal greater than 0.5. Is there a way to do so?