Re: Bug in GetRMS() with 2.00/12(gcc/Linux)

Rene Brun (Rene.Brun@cern.ch)
Tue, 20 Oct 1998 11:55:09 +0200


Joerg,
I have tested your program on several machines and always
got the correct answers (both macro and compiled code)
My suspicion is that you have a mismatch between your $ROOTSYS
and LD_LIBRARY_PATH

Rene Brun

Joerg.Westphalen@desy.de wrote:
>
> Rene,
>
> thanks for your fast reply. If i understand correctly, you claim that
> changing
> TH1F* histo(TH1F("histo","Histogram of Gluino Condensate",
> 300,10,12));
> to
> TH1F* histo = new TH1F("histo","Histogram of Gluino Condensate",
> 300,10,12);
> resolves the problem.
>
> Well, i tested it myself and found the same wrong output:
> [theol03] ~/results/root $ mist.exe
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 2.00/12 9 October 1998 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> CINT/ROOT C/C++ Interpreter version 5.13.75, Sep 23 1998
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> using data in range 28104 1.04858e+06
> 28104.000000
> 1048576.000000
> root [0] printf("%f\n", histo->GetRMS());
> 0.099994
> root [1]
>
> It may be necessary to COMPILE the program, not to use it as a macro,
> since the RMS is given correctly in interactive mode (see above!) !
>
> BTW: as far as i know C++ the original line
> TH1F* histo(new TH1F(...));
> is a perfectly valid way of initializing a variable, in fact, it appears
> to me as the standard way in C++ programming.
>
> On 20 Oct, Rene Brun wrote:
> > Joerg,
> > In your example below, you have an error when creating the TH1F *histo.
> > I have tested with the variant macro that Root behaves correctly with
> > your example.
> >
> > Rene Brun
> >
> > {
> > #include <iostream.h>
> > // estimate range for plot
> > TF1 *func = new TF1("func","exp(-0.5*((x-11.0)/0.1)^2)");
> > TH1F* histo = new TH1F("histo","Histogram of Gluino Condensate",
> > 300,10,12);
> > histo->FillRandom("func",1024*1024);
> > cout << "using data in range " << " "
> > << histo->GetMean() << " "
> > << histo->GetRMS()<< endl;
> > printf("%f\n", histo->GetMean());
> > printf("%f\n", histo->GetRMS());
> > }
> >