How to plot the projection of 2D fit in the binning of other variable

Dear Expert,

I was trying to do a 2D fit (of “m” and “errm”) but this is not coming out correctly.
To find out the reason behind this I want to plot the projection of “m” fit in the different binning of “errm”. so I am trying to do with following changes:
dataxy->plotOn(xframe, CutRange(“SB2”));
const double nData = dataxy->sumEntries(" ", “SB2”);
pdf.plotOn(xframe,Components(gauss),LineStyle(kDashed),LineColor(kRed), ProjWData(*dataxy), Normalization(nData, RooAbsReal::NumEvent), ProjectionRange(“SB2”));

if case you refer, Here is the folder that I am using: (646.5 KB)

I am not sure this is giving me the right result.
Please help me to sort it out.

Thanks in advance.


Your macro gives me the following plot. Is it what you get also ? I guess @moneta can help.

Hi @couet ,

yes, Here I have tried to get the projection of “m” in the bin 0 to 0.0031 of “errm”.
but I think this is giving me total fit (blue) also and I am getting pull distribution for only a part of the range (left side and right side).

I think somewhere, I am doing some mistake.


Hii @couet and @moneta,

I am able to improve the pull distribution but still total fit (blue) is there.

Can you please help me to fix this?

Now updated code is here: (647.5 KB)


Do you need this ?

If yes, simply remove the line:

pdf.plotOn(xframe, ProjWData(*dataxy), CutRange("SB2"));

CutRange is not a valid option for plotting RooAbsPdf. You should use ProjectionRange
You might also need to provide the correct normalisation as written in ROOT: RooAbsData Class Reference in case you get wrong normalisation




Yes, I need this. thanks.


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