Multiple histograms in one single plot from different root files

hello to all. in new at ROOT and try to learn and practice some basics. i have 3 root files. each has a single tree and multiple branches. i plot histograms from individual file. Now i want to plot some objects from each file in one frame. please i need help in this regard.
thanks in advance.

Hi,
welcome to the ROOT forum!
Can you share the code you have so far?

In principle, you can create a TCanvas and then specify option “SAME” to the Draw method to draw multiple things on the same canvas.

Cheers,
Enrico

thanx for ur response. for the individual file i use the following code

TFile *file1 = TFile::Open(“filename.root”)
TTree *tr1 = (TTree *) file1->Get(“T”), ##where T is the tree
tr1->Draw(“Jet.PT”)

this plot Jet.PT from this input file.

now how can i plot same Jet.PT from other file in this single plot?

Once you have done the first plot using the code you posted you can do something similar with te new file the only difference will be that the “Draw” should be done with option “SAME”

tr2->Draw(“Jet.PT”, "","SAME");

If you need that ROOT computes the global range containing all the plots you will need to use a THStack. But first try using option “SAME”. It is simpler.

thanks dear. it works

Hi,
I wanna draw 2 histogram in same canvas but when i typed the SAME command at the end following error occurred.
root [5] myc1=new TCanvas(“myc1”,“My canvas”);
root [6] myc1->Divide(2,2);
root [7] myc1_1->cd();
root [8] h10->Draw(“h10”);
root [10] myc1_2->cd();
root [11] h40_>Draw(“h40”, “SAME”);
IncrementalExecutor::executeFunction: symbol ‘_ZN5cling7runtime8internal9EvaluateTIvEET_PNS1_15DynamicExprInfoEPN5clang11DeclContextE’ unresolved while linking [cling interface function]!
You are probably missing the definition of void cling::runtime::internal::EvaluateT(cling::runtime::internal::DynamicExprInfo*, clang::DeclContext*)
Maybe you need to load the corresponding shared library?