Convert from TGraph to histogram

I have theory prediction with TGraph. And The data with TH1F … I want to convert from TGraph toTH1F ,then change bins ,and then divide the TH1F (data). How can I make this? I found the TGraph::GetHistogram methots, but I don’t get it … Could you help me for this?

Thanks…

Hi,

what you could do is to create a new “theory predicted” histogram and then divide. This histogram has a binning identical to the data one. The bin content is set via the TGraph::Eval method which takes care of the interpolation.

Danilo

Hi Danilo,

Thanks your answer. I create new histogram and this solve my problem. if you look very deep you can not see simple solutions Thanks…

Ayse,

[quote=“dpiparo”]Hi,

what you could do is to create a new “theory predicted” histogram and then divide. This histogram has a binning identical to the data one. The bin content is set via the TGraph::Eval method which takes care of the interpolation.

Danilo[/quote]