Question on Histogram Normalization

Dear All,

I have a problem with 1-D histogram normalization. What I want to do is to divide total number of entries in the histogram by number of entries in each bin and thus histogram will be independent from the bin values. To do that I’m using following lines in my macro and I’m not sure if this is correct way or not.

for (Int_t k=1; k<=fPt->GetNbinsX(); ++k)
{
fPt->SetBinContent(k, fPt->GetBinContent(k) / fPt->GetBinWidth(k));
fPt->SetBinError(k, fPt->GetBinError(k) / fPt->GetBinWidth(k));
}

Please let me know your comments of this operation.

Thank you,

Kind regards,

Ayben

I assume that you meant the inverse ::slight_smile:

see TH::Scale doc and do

double nentries = fPt->GetEntries(); fPt->Scale(1./nentries,"width");
Rene