after the latest update (to 2.00/12) none of my root programs worked
properly anymore. A few hours of headache let me to the conclusion that
something may be wrong with the GetRMS method of class TH1.
Here is a small program producing wrong results:
//
// jw 10/98
//
//
#include <TROOT.h>
#include <TApplication.h>
#include <TRint.h>
#include <TF1.h>
#include <TH1.h>
extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
TROOT root("correlation", "CORRELATION", initfuncs);
int main(int argc, char **argv)
{
int local_argc(1);
//TApplication* theApp = new TApplication("App", &local_argc, argv);
TRint *theApp= new TRint("Rint", &local_argc, argv, 0, 0);
// 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());
theApp->Run();
delete theApp;
return 0 ;
}
Compiling this (with gcc or egcs) and executing results in:
[...]
*******************************************
* *
* 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]
When drawing (histo->Draw()) also RMS=0.0999939 shows up.
Whats wrong with my program, or is this is a bug in root ?
Is this a local problem with our installation here ?
Bye,
Joerg Westphalen
PS. In my original programs i am using Fill(x,w), not FillRandom(),
producing the same problem.
-- -------------------------------------------------------------------- Joerg Westphalen Email: Joerg.Westphalen@desy.de DESY - Theorie - Julius-Brecht-Str. 7 Notkestr. 85, 22603 Hamburg 22609 Hamburg Tel: 040-8998-3605 (buero) Tel: 040-8078007 (privat) Fax: 040-8994-3605 Geb. 2a, Zi. 409 --------------------------------------------------------------------