Plot different histograms from one root file in one graph

___Hi Everyone
I am aiming to plot different histograms in one graph from the same root file , I want to use macro file for that .
can anyone help me .
I have uploaded the root file
Thank YoDepth.root (1.9 MB) u
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Could you please help me to do that , because I am not familiar with macro file

Hi,

In order to read histograms from a ROOT file, you can have a look at this tutorial:

In particular, see the part where the histogram is read:

TH1F* h1f = 0;
file->GetObject("h1f",h1f);
if (!h1f){
   Error("fit1.C","Cannot find object h1f of type TH1F\n");
   return;
}

If you want to draw two histograms in the same canvas, you can have a look at:

https://root.cern/doc/master/cocoa_2grad2_8C.html

Notice the Draw("SAME") option when drawing the second histogram at the end of the tutorial.

Thank you very much @etejedor , I really appreciate your help.

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