Rescaling plots from RooDataSets

Dear experts - I have a quick (and hopefully very simple question) :smiley:

I have 3 RooDatasets which contain the same variables, but different numbers of entries. I wish to see if the dataset distributions (for a given variable) are ~the same and hence I want to scale the plots of the more sparse datasets to have the same number of entries/area as the most populated data set. I tried to use the code below and the plotOn(Rescale(scale)) optionā€¦but running the code with and without the Rescale option I get the same result - could anyone explain this given the relevant (havenā€™t put in all the gory codingā€¦) code lines below? Any help is very much appreciated :slight_smile: Thanks and merry Xmas :slight_smile: Sam

// Create some RooDataSets from the old ones.... 
RooDataSet * Data_new = new RooDataSet("Data_new","Data_new", (observables,*Mother_mass_var)); Data_new = (RooDataSet*)Data.reduce("sqrt(Mother_mass_squared)>1700"); 

RooDataSet * Data_new2 = new RooDataSet("Data_new2","Data_new2", (observables,*Mother_mass_var)); 
Data_new2 = (RooDataSet*)Data2.reduce("sqrt(Mother_mass_squared)>1700"); 

RooDataSet * Data_new3 = new RooDataSet("Data_new3","Data_new3", (observables,*Mother_mass_var)); Data_new3 = (RooDataSet*)Data3.reduce("sqrt(Mother_mass_squared)>1700"); 

// Get the number of entries in the RooDataSets 
Int_t num_entries_new = Data_new->numEntries(); 
Int_t num_entries_new2 = Data_new2->numEntries(); 
Int_t num_entries_new3 = Data_new3->numEntries(); 

// Calculate the scale factors for the RooDataSets 
Double_t ScaleFactor = num_entries_new/num_entries_new2; 
Double_t ScaleFactor2 = num_entries_new/num_entries_new3; 

// Set up canvas TCanvas* c = new TCanvas("PIDK change","PID change",800,400) ; 

// Draw the frames 
RooPlot* xframe = Mother_mass_var->frame(Bins(100)); 
Data_new->plotOn(xframe,MarkerColor(kBlue)); 
Data_new->statOn(xframe); 

RooPlot* yframe = Mother_mass_var2->frame(Bins(100)); Data_new2->plotOn(yframe,MarkerColor(kRed),Rescale(ScaleFactor)); 
Data_new2->statOn(yframe); 

RooPlot* zframe = Mother_mass_var3->frame(Bins(100)); 
Data_new3->plotOn(zframe,MarkerColor(kOrange),Rescale(Scale_factor2)); 
Data_new3->statOn(zframe); 

// Drawing setup 
xframe->Draw(); 
yframe->Draw("SAME"); 
zframe->Draw("SAME") ; 
c->Draw(); 

Fixed! :slight_smile: