How to force TRatioPlot to keep the same label

Dear experts,
I made a ratio plot with TRatioPlot but it does not keep the same label as you can see here (*). Do you know how I can ask it to keep the same label? The code is here (**).
Regards

(*)
before ratio:

after ratio:

(**)
complete code here:
http://calpas.web.cern.ch/calpas/comp.cc

I cannot run your macro because the root is missing. Could you provide a small example reproducing the problem. It seems the ratio part of the plot ignores te fact the initial histogram had alphanumeric labels.

Dear Couet,
you can run it now. Please let me know if you need something else.
Regards

Indeed you removed the path of the root files. but still I do not have the files and therefore I get the same kind of error.

The root files are here:
http://calpas.web.cern.ch/calpas/r1.root
http://calpas.web.cern.ch/calpas/r2.root

can’t you see them?

Regards

Yes I see them. I will check.

I see that the ratio part of the plot ignores te fact the initial histogram had alphanumeric labels. It is not implemented.

Ok, thank you. So how can I do it?

Regards

I see you are drawing the ratio plots in a loop with option hist same…
I think that will mess up the plots. Can you try to do only one ratio plot ?
Not in a loop …

I made an array of ratio hitograms, then I loop

over this array to plot separately each ratio hist in a

canvas. I removed the “same” option, but I still do

not have the right label.

Regards

I would like to access the histogram of the ratio hist (not the graph), is it possible? If yes would CalculationMode(kDivideHist) allow me to do that? If yes how/where can I use it? Indeed, once I’ve access the histogram, I can set the x label myself with SetLabelSize.
Regards

I am afraid that the alphanumeric labels histogram do not work with the current implementation of TRatioPlot.

{
   TFile *f = new TFile("r1.root");
   f->cd("ee");
   TH1D *h1 = (TH1D*) f->Get("ee/cutflow");
   TH1D *h2 = (TH1D*) f->Get("ee/cutflow_Loose");

   TCanvas *c = new TCanvas();
   TRatioPlot *rp = new TRatioPlot(h1, h2);
   rp->Draw();
}

I guess you should go back to the old way
https://root.cern/doc/master/ratioplotOld_8C.html

It is not possible to access the histogram?

Regards

All the getters for TRatioPlot are listed here:
https://root.cern/doc/master/classTRatioPlot.html

Dear Couet,

ok, thank you for your help.

Regards

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