Re: [ROOT] seg fault while trying to gMinuit->Write()

From: Dr. John Krane (
Date: Mon Mar 29 2004 - 22:48:16 MEST

Hi Eddy,

Thanks for the response.  I see that the Ifit.C routine you mention uses 
a TMinuit object, which I thought was discouraged.  I am using the 
TVirtualFitter class, which gives me some of that lovely "indirection" 
that the kids are all talking about.  I wonder if this is why my 
gMinuit->Write() command pukes but you think it workes in Ifit.C.

Unfortuanately, if it is the case, then I need to find out the secret 
name ROOT uses internally for a TVirtualFitter.  gVirtualFitter maybe.  
I do want to be able to read this back in and use my existing code.  Or 
come up with something else. 

    - J

Edmond Offermann wrote:

>Hi John,
>without more specifics it is hard to tell what
>goes wrong .
>If you insert your 2 lines in tutorials/Ifit.C
>you can check that in principle it does what it is
>supposed to do
>--- "Dr. John Krane" <> wrote:
>>Some time ago, I asked how to save intermediate
>>steps during weeks-long 
>>Minuit fits.  The suggested code was simply to do
>>something like:
>>    TFile
>>    gMinuit->Write();
>>I have a class called "func_fit" that has a
>>minimization method.  
>>(Because TMinuit wants a bare function, I wrote a
>>wrapper for the member 
>>function called "dummy_func", visible in the stack
>>trace below.)  My 
>>class increments a counter every time the
>>minimization method is called; 
>>when I get zero for fmod(counter,10000), I try to
>>write the TMinuit 
>>object as above.  Unfortunately, I get the following
>>stack trace.
>>I'm confused as to the source of the problem, which
>>occurs deep in the 
>>Streamer methods.  I'm hoping somebody knows what
>>I'm doing wrong.  If 
>>anyone has any advice or proposals for tests, I'll
>>be very grateful.
>>    - John
>>Program received signal SIGSEGV, Segmentation fault.
>>[Switching to Thread 1091201184 (LWP 24100)]
>>0x4025d8a2 in ROOT::TObject_IsA(void const*) () from
>>(gdb) where
>>#0  0x4025d8a2 in ROOT::TObject_IsA(void const*) ()
>>#1  0x401619b4 in TClass::GetActualClass(void
>>const*) const () from 
>>#2  0x400ec4ff in TBuffer::WriteObjectAny(void
>>const*, TClass*) () from 
>>#3  0x4024f7cf in operator<<(TBuffer&, TObject
>>const*) () from 
>>#4  0x40e9d933 in TMinuit::Streamer(TBuffer&) ()
>>#5  0x40101246 in TKey::TKey(TObject*, char const*,
>>int) () from 
>>#6  0x4010e293 in TObject::Write(char const*, int,
>>int) () from 
>>#7  0x0805297c in func_fit::minimize(int&, double*,
>>double&, double*, 
>>int) (this=0x8059a20, npar=@0xbfffd4f4,
>>grad=0xd6f56d0, mychi2=@0xbfffd620,
>>    params=0xd6ec0b0, iflag=4) at func_fit.cpp:395
>>#8  0x080547d5 in dummy_func(int&, double*, double&,
>>double*, int) 
>>(npar=@0xbfffd4f4, grad=0xd6f56d0,
>>mychi2=@0xbfffd620, params=0xd6ec0b0, 
>>    at fit_idx.cpp:46
>>#9  0x40e8458d in TMinuit::Eval(int, double*,
>>double&, double*, int) () 
>>from /bin/root/lib/
>>#10 0x40e8d827 in TMinuit::mnhess() () from
>>#11 0x40e914b7 in TMinuit::mnmigr() () from
>>#12 0x40e8a21a in TMinuit::mnexcm(char const*,
>>double*, int, int&) () 
>>from /bin/root/lib/
>>#13 0x40e8020f in TFitter::ExecuteCommand(char
>>const*, double*, int) () 
>>from /bin/root/lib/
>>#14 0x08055296 in main (argc=2, argv=0xbfffe874) at
>>#15 0x420156a4 in __libc_start_main () from


Dr. John Krane

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