[ROOT] dummy problem for fitting in a stand alone program

From: Tommaso.Chiarusi@bo.infn.it
Date: Mon Jan 12 2004 - 19:49:12 MET


dear rooters,
I've a dummy (I hope) problem with the TH1F::Fit() method, when running a stand
alone
program. 

I tried to isolate the part of the code which fails, writing the core of the
program directly involved with the crash!
 
Note that the program compiles, but it dumps a SegFault as running time.

The "gdb" debugger points 
/usr/usersm/chiarusi/zonalavoro/root_v3.10.02/lib/libHist.so
out as the "hot point" of the problem!

Just to know is  that I realized all of this as converting a
good-working program under Linux RH 7.2 with Root v 3.03/9 to 
the new system i have, which is the following:
--------------------------------------------------

Computer specifics:
Intel PC with Red Hat Linux release 9 (Shrike)
Root Version   3.10/02  16 December 2003
--------------------------------------------------




The dummy program to which I reduced the original is the following:
//-------------------------------------------------
#include <iostream>
#include "TH1.h"
#include "TH1F.h" 
#include "TF1.h"
#define NEWVERS

using namespace std;

int main()
{      

  TH1F *h= new TH1F("h","",100,-10,10);
  h->FillRandom("gaus");


  TF1 *f1 = new TF1("f1","gaus",-5,5);
  h->Fit("f1","R");

   return 0;
  
}
///

//-------------------------------------------------------


As I said before it compiles but it crashes as running, dumping the following
lines:

Error in <TRegexp::Index>: Bad Regular Expression
 
 *** Break *** segmentation violation
 Generating stack trace...
 0x4078fe25 in TH1::Fit(char const*, char const*, char const*, double, double) +
0x7b from /usr/usersm/chiarusi/zonalavoro/root_v3.10.02/lib/libHist.so
 0x08048b59 in main + 0x18d from ./cancella2
 0x42015704 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
 0x0804893d in std::ios_base::Init::~Init [in-charge]() + 0x31 from ./cancella2
Abort (core dumped)


I also used the "gdb" program to try to solve the bug, and I got the following
messages:

Error in <TRegexp::Index>: Bad Regular Expression

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1090449600 (LWP 25112)]
0x4078ff98 in TH1::Fit(TF1*, char const*, char const*, double, double) ()
   from /usr/usersm/chiarusi/zonalavoro/root_v3.10.02/lib/libHist.so
(gdb) bt
#0  0x4078ff98 in TH1::Fit(TF1*, char const*, char const*, double, double)
    () from /usr/usersm/chiarusi/zonalavoro/root_v3.10.02/lib/libHist.so
#1  0x4078fe25 in TH1::Fit(char const*, char const*, char const*, double,
double) () from /usr/usersm/chiarusi/zonalavoro/root_v3.10.02/lib/libHist.so
#2  0x08048b59 in main () at cancella2.C:23
#3  0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) 





THANKS,
TOMMASO



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET