Rescaling 2 datasets and plotOn its sum


I’m new in RooFit and still learning this package. However, there is a question that I cannot find an answer to.

I have 2 datasets - for signal and background, respectively.
I need to sum and normalize this data before fitting. By normalization, I mean multiplying the data by a factor. I have different factors for signal and background. As I understand it, this can be implemented using Rescale () in plotOn options. But if I sum the data, then I build one plot. Then I don’t know how to make different Rescale ().

The question is: is it possible to implement this somehow?

I used the “append” command to sum. By the way, I’m also not sure if this is the right solution, perhaps it needs to be done differently.

Part of the code for clarity:

// Define var
RooRealVar Branch("Branch","Branch", 104, 170);
// Open files
TFile *File_Sig = new TFile("File_Sig.root", "READ");
TTree *tree_Sig = (TTree *)File_Sig->Get("Tree"); // Sig
TFile *File_Bkg = new TFile("File_Bkg.root", "READ");
TTree *tree_Bkg = (TTree *)File_Bkg->Get("Tree"); // Bkg
// Datasets
RooDataSet Data_Sig("Data_Sig","Data_Sig",RooArgSet(Branch),Import(*tree_Sig)); // Sig
RooDataSet Data_Bkg("Data_Bkg","Data_Bkg",RooArgSet(Branch),Import(*tree_Bkg)); // Bkg
Data_Sig.append(Data_Bkg); // Sum
// Plot
RooPlot* Sig_Frame = Branch.frame(Title("Title"));
Data_Sig.plotOn(Sig_Frame, Binning(33), LineColor(kBlue), LineWidth(3), MarkerStyle(kFullDotLarge), Rescale(0.8)); //I need 2 different Rescale() for 2 datasets

Any help would be welcome!


Hello Evgeny,

what you need is probably a weight. You can assign different weights to signal and background, and then make one big dataset that has both event classes.

I showed how to do this in this post:

Dear StephanH

Yes, its work, thank you for your help!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.