Error calculation of 2D histogram

Hello Rooters,

I have two histograms called h_QSq_xBj and h_QSq_xBj_MC.
I applied Sumw2 option for these histograms.
Then I took the division of these two histograms
h_ratio= h_QSq_xBj_MC/h_QSq_xBj.

(not applied sumw2 option for this ratio histogram)

I need to copy the error of h_ratio histogram to a another histogram.
Could you please help me to draw it?
I have no idea how to calculate error of h_ratio and copy that errors to the another histogram.

{
//open 2D raw and simu histograms
    TFile *hFile=TFile::Open("xBQ2binning.root");
    TH2F *h_QSq_xBj;   //added Sumw2() option
    TH2F *h_QSq_xBj_MC; //added Sumw2() option
    TH2F *h_ratio;
    hFile->GetObject("h_QSq_xBj", h_QSq_xBj);
    hFile->GetObject("h_QSq_xBj_MC", h_QSq_xBj_MC);
    
    h_ratio = (TH2F*)h_QSq_xBj_MC->Clone();
    h_ratio->GetXaxis()->SetTitle(" ");
    h_ratio->GetYaxis()->SetTitle(" ");
    h_ratio->SetTitle("h_QSq_xBj_MC(raw)/h_QSq_xBj(simu)");
    h_ratio->Divide(h_QSq_xBj);


TCanvas* C_QSqxBj= new TCanvas();
    C_QSqxBj->Divide(3,1);
    C_QSqxBj->cd(1);
    h_QSq_xBj->Draw("colz");
    C_QSqxBj->cd(2);
    h_QSq_xBj_MC->Draw("colz");
    C_QSqxBj->cd(3);
    h_ratio->Draw("colz");




}

Thank You
Dil

I think @moneta can help

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

Thank You, Coyote.
This works.

Hello,
This is a different question, but related to the same code,
When I am doing histogram division what if I have empty bins?
Is there any convenient way to get rid of those bins or return it to zero?

h_ratio = (TH2F*)h_QSq_xBj_MC->Clone();
    h_ratio->GetXaxis()->SetTitle(" ");
    h_ratio->GetYaxis()->SetTitle(" ");
    h_ratio->SetTitle("h_QSq_xBj_MC(raw)/h_QSq_xBj(simu)");
    h_ratio->Divide(h_QSq_xBj);

Thank You
Dil

TH1::Divide automatically takes care of all cases.