How to plot single graph by reading two root file

I have two .root file containing histograms . how can i combine particular histogram from these two root file. For reference i attached my code
compareplot.C (502 Bytes)

I guess we need these two ROOT files, too.

@Wile_E_Coyote is there anything wrong with the code?

At first sight, it looks o.k.

@Wile_E_Coyote please check the attachment of what am i getting on running it

Looks like the second histogram does not exist. That’s why I asked you to provide both ROOT files for inspection.

Always use tree->GetObject instead of tree->Get. And always check the result. Your second histogram is named Graph, so I suspect it is a TGraph instead of a TH1F.

Thank you for the replay,problem is solved. first one is from TH1F and second one is simple graph. so first, i read particular histogram from root file then TGraph form .dat file and finally Draw(“same”).

Thank all for productive and quick response