Convert canvas into histogram in root

There is no method which transforms a “TGraphAsymmErrors” into a “TH1”.