Relative error of the ratio

TH2F *h_ratio_error = (TH2F*)h_ratio->Clone("h_ratio_error");
for (int i = 0; i < h_ratio_error->GetSize(); i++)
  h_ratio_error->GetArray()[i] = (h_ratio_error->GetBinContent(i) ? h_ratio_error->GetBinError(i) / h_ratio_error->GetBinContent(i) : 0.);
h_ratio_error->Sumw2(kFALSE);
// h_ratio_error->ResetStats();

BTW. See also the older thread: “Error calculation of 2D histogram