Re: [ROOT] TProfile with variable bin sizes

From: Nick van Eijndhoven (Nick@phys.uu.nl)
Date: Tue Feb 25 2003 - 13:16:06 MET


Hi Rene,
Here is my 2 cents.
In case of a new class TProfileX deriving from TProfile, one creates
an unnecessary overhead to my opinion, since some data arrays are
then always unused.
Why not introduce a new memberfunction TProfile::SetX()
(or whatever name) which acts in a way like TH1::Sumw2().
This would mean that in case one calls SetX before one starts filling,
the TProfile::Fill will internally interchange the roles of X and Y
and the mean and rms of X will be computed etc...
As far as I can judge this would be a most direct way of achieving the
desired functionality.

                                                       Cheers,
                                                        Nick.

-- 
Dr. Nick van Eijndhoven mailto:nick@phys.uu.nl http://www.phys.uu.nl/~nick
--------------------------------------------------------------------------
Org.:    Utrecht University, Faculty of Physics and Astronomy
Address: Princetonplein 5, NL-3584 CC Utrecht, The Netherlands
Phone:   +31-30-2532331(direct) +31-30-2531492(secr.)  Fax: +31-30-2518689
CERN:    +41-22-7679751(direct) +41-22-7675857(secr.)  Fax: +41-22-7679480
Offices: Buys Ballot laboratory Room 710 (Utrecht)   B23 1-020 (CERN)
--------------------------------------------------------------------------


Rene Brun wrote:
> 
> Hi Alberto,
> 
> Your analysis is correct. A TProfile does not compute the mean/rms for each bin
> along x. I agree that this would be an interesting addition.
> This extension could be implemented in two ways
>   - new class TProfileX  deriving from TProfile with two additional
> arrays           to accumulate sum(w*x) and sum(w*x*x) for each bin
>   - extend the existing TProfile with again 2 possibilities
>     - by default compute the mean/rms per bin
>     - as an option
> It would be trivial to extend the Fit functions to take into account the errors
> per bin along x.
> 
> Comments are welcome.
> 
> Rene Brun
> 
> Alberto Garcia Raboso wrote:
> >
> > Hi ROOTers,
> >
> > I need a variable bin size profile, and so I have had a look on the code
> > to see what it makes. The problem is that ROOT takes the mean and the
> > standard deviation only along the y axis, but not in the x axis. Later on
> > I need to fit the points (x_{m}, y_{m}), where x_{m} is the mean of the
> > points alog the x axis, and y_{m} the mean along the y axis, weighted eith
> > the error along the y axis.
> >
> > Does anybody know a way to do it, without having to use a TGraphErrors and
> > to calculate all the errors manually?
> >
> > Thanks in advance,
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Alberto Garcia Raboso
> > Universidad Autónoma de Madrid (Spain)
> > E-Mail: Alberto.Garcia.Raboso@cern.ch
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Well, farewell, my hobbits! You should come safe to your own
> > homes now, and I shall not be kept awake for fear of your
> > peril. We will send word when we may, and some of us may yet
> > meet at times; but I fear that we shall not all be gathered
> > together ever again.
> >
> >                       The return of the King. J.R.R. Tolkien
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET