Home | News | Documentation | Download

Area under a histogram

I have dNch/d#eta, charged particle multiplicity per unit rapidity, at various rapidities(from -1.0 to +1.0 with the increments of 0.1). Now I want to find #deltaN in a range(0.0 to 0.5), #deltaN being the integrated charged particle multiplicity. How can I obtain that given that I have dNch/d#eta at 0.0, 0.1, 0.2, 0.3, 0.4 and 0.5.

I guess the right method to get the area under an histogram should be Integral()

TH1::Integral() gives the sum of bin contents, as is mentioned in the root manual. I see that it gives me the mean of bin contents. So how is that the value of the integral under the curve?

What about the option “width” ?

It is not completely clear to me what kind of physics data you are dealing with however it seems like perhaps you want to do something more complex than simply TH1::Integral(). (Which will literally integrate the bin contents between two limits.)

If my suspicions are correct then you are probably looking for an algorithm beyond what ROOT provides, in which case you should be able to quite easily roll your own.

If you can give some more details of the problem then perhaps I can help, unless I am mistaken in my assumption. For example it is not completely clear to me what Nch is. eta presumably is “rapidity”, I don’t recall the exact definition.

Hi Kaiser,

Exactly.

How come? Can you share an example please?