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

From: Edmond Offermann (edmondoffermann@yahoo.com)
Date: Mon Mar 29 2004 - 23:13:58 MEST


Hi John,

Ok, since your are using TVirtualFitter, gMinuit
is probably not defined . Have a look at 
test/minexam.cxx. Here an object minuit
is defined :

TVirtualFitter *minuit = TVirtualFitter::Fitter(0, 5);

Now you can do just 

   TFile f("bla.root","RECREATE");
   minuit->Write("myfit");

--- "Dr. John Krane" <jkrane@netzero.com> wrote:
> 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
> >
> >Eddy
> >
> >--- "Dr. John Krane" <jkrane@netzero.com> wrote:
> >  
> >
> >>Hi,
> >>
> >>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
>
>>f("temp_minuit_intermediate_state.root","RECREATE");
> >>    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
> >>
> >>/bin/root/lib/libCore.so
> >>(gdb) where
> >>#0  0x4025d8a2 in ROOT::TObject_IsA(void const*)
> ()
> >>from 
> >>/bin/root/lib/libCore.so
> >>#1  0x401619b4 in TClass::GetActualClass(void
> >>const*) const () from 
> >>/bin/root/lib/libCore.so
> >>#2  0x400ec4ff in TBuffer::WriteObjectAny(void
> >>const*, TClass*) () from 
> >>/bin/root/lib/libCore.so
> >>#3  0x4024f7cf in operator<<(TBuffer&, TObject
> >>const*) () from 
> >>/bin/root/lib/libCore.so
> >>#4  0x40e9d933 in TMinuit::Streamer(TBuffer&) ()
> >>from 
> >>/bin/root/lib/libMinuit.so
> >>#5  0x40101246 in TKey::TKey(TObject*, char
> const*,
> >>int) () from 
> >>/bin/root/lib/libCore.so
> >>#6  0x4010e293 in TObject::Write(char const*, int,
> >>int) () from 
> >>/bin/root/lib/libCore.so
> >>#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, 
> >>iflag=4)
> >>    at fit_idx.cpp:46
> >>#9  0x40e8458d in TMinuit::Eval(int, double*,
> >>double&, double*, int) () 
> >>from /bin/root/lib/libMinuit.so
> >>#10 0x40e8d827 in TMinuit::mnhess() () from
> >>/bin/root/lib/libMinuit.so
> >>#11 0x40e914b7 in TMinuit::mnmigr() () from
> >>/bin/root/lib/libMinuit.so
> >>#12 0x40e8a21a in TMinuit::mnexcm(char const*,
> >>double*, int, int&) () 
> >>from /bin/root/lib/libMinuit.so
> >>#13 0x40e8020f in TFitter::ExecuteCommand(char
> >>const*, double*, int) () 
> >>from /bin/root/lib/libMinuit.so
> >>#14 0x08055296 in main (argc=2, argv=0xbfffe874)
> at
> >>fit_idx.cpp:140
> >>#15 0x420156a4 in __libc_start_main () from
> >>/lib/tls/libc.so.6
> >>
> >>
> >>    
> >>
> >
> >
> >  
> >
> 
> -- 
> 
> Dr. John Krane
> jkrane@netzero.com
> 
> 



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