# Normalising in Histogram

**URL:** <https://root-forum.cern.ch/t/normalising-in-histogram/51509>\
**Category:** Newbie\
**Tags:** hist\
**Created:** [September 9, 2022, 11:16am UTC](https://root-forum.cern.ch/t/normalising-in-histogram/51509 "2022-09-09T11:16:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![souvikc](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@souvikc](https://root-forum.cern.ch/u/souvikc)\
**Post date:** [September 9, 2022, 11:16am UTC](https://root-forum.cern.ch/t/normalising-in-histogram/51509/1 "2022-09-09T11:16:38Z")

</div>

Hi everyone, I want to normalize a histogram by dividing each bin with different number i.e divide count in first bin with .5 and second bin with 4. How should I proceed?

---

<div class="post-metadata">

**Author:** ![Dilicus](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilicus/32/14338_2.png) [@Dilicus](https://root-forum.cern.ch/u/Dilicus)\
**Post date:** [September 9, 2022, 12:41pm UTC](https://root-forum.cern.ch/t/normalising-in-histogram/51509/2 "2022-09-09T12:41:44Z")

</div>

Hi @souvikc and welcome to the ROOT forum.

You can loop over the channel and rescale the content of each bin

```auto
for(int i=1;i<=h->GetNbinsX();i++)
h->SetBinContent(i,h->GetBinContent(i)/w_i);

```

or you could fill an histogram with the different value you want to use and then use the function [TH1::Divide()](https://root.cern.ch/doc/master/classTH1.html#ac782a09c31b4f7de40f8fd4f77efa090)

Stefano

PS  
Just for reference,I leave below how the standard normalization to have an histogram with unit area is done

```auto
h->Scale(1./h->Integral());

```

---

<div class="post-metadata">

**Author:** ![souvikc](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@souvikc](https://root-forum.cern.ch/u/souvikc)\
**Post date:** [September 12, 2022, 5:57am UTC](https://root-forum.cern.ch/t/normalising-in-histogram/51509/3 "2022-09-12T05:57:01Z")

</div>

Thanks a lot @Dilicus. It works
