How to convert TH2F to TGraph?

Hello there,

I need to convert 2D histogram to TGraph in order to fit TGraph then. A bit stuck with it.

That’s not direct as a 2D histogram has x,y and z values whereas a TGraph has only x and y. You need to get the data you need from the 2D histogram using the getters given in the reference guide (GetBinLowEdge, GetBinCenter, GetBinContain etc …) and then fill a TGraph with them via, for instance, SetPoint.

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