How to subtract two histogram?

Dear Rooters,
I want to plot residuals(data - MC). I draw data in hist2 and mc in hist1.
After that, I did something like following.

auto rp = new TRatioPlot(hist1, hist2);
rp->Draw();

which gives me the ratio but I want basically data-mc kind of thing which will be zero for good data-mc agreement.

Could you please suggest me which function I should use ?

Thanks and Regards


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Check out the 3 Add functions for histograms.

TRatioPlot *rp = new TRatioPlot(hist1, hist2, "diff"); // "diff" or "diffsig"

Thanks.
How can I draw different draw option for residual distribution ?

After adding these TRatioPlot class, TLegend is not working ?

How to resolve that ?

Thanks.

How Can I draw this residual in a different canvas ?

Difficult to answer without an example showing the “problem”.

TRatioPLot is in one single canvas. If you need two canvases do not use it. Make the difference yourself using Add and draw it in a separated canvas.

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