Re: [ROOT] Getting the RMS of a subrange of a histogram

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Oct 30 2002 - 20:56:15 MET


Hi Amber,

If you have TH1* h;
do:
  h->GetXaxis()->SetRange(10,30); //to restrict range to bins 10 to 30
included
  h->GetMeaN(); //will return the mean in the axis range
  h->GetXaxis()->SetRange(); //set range to all bins again

If you have a TH2 or TH3, you can use the same technique on
the X,Y and Z axis


Rene Brun


On Wed, 30 Oct 2002, Amber Jenkins wrote:

> Hi,
> 
> Sorry for what is probably a very trivial question. I am trying to obtain
> the RMS of a subrange of a 1D histogram.
> 
> Is there any way of doing this without re-drawing the histogram over the
> required subrange? I can change the range of the histogram using the GUI,
> and the RMS is then automatically recalculated. But I would prefer to do
> this in a macro instead. I tried using SetRange() on the command line, but
> this didn't work.
> 
> Thanks for your help!
> 
> 	Amber
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET