A Simple Question on histogram errors

Hello, rooters!
I am fairly new and I have a simple question about filling histograms.

I do this:

h1->Sumw2();
h1->Fill(); //I fill histogram in cycle
for ( j = 1; j <= nX; j++){ //nX is the number of bins in h1
h2->SetBinContent(j, (h1->GetBinContent(j)) / (h1->GetBinCenter(j)));
}

What bothers me is that the errors seem to be somewhat too big.
Should I manually set bin errors in h2 or is there some function I can call?

Call “h2->Sumw2();” and then in your “for” loop, in which you “h2->SetBinContent(j, NewBinValue);”, you can also “h2->SetBinError(j, NewBinError);”.
If you do not call “h2->Sumw2();”, the errors will be calculated automatically from the “h2” bin contents.