Segfault error from TMinuit

Hi Experts,

When i use ‘Migrad’ of TMinuit for minimization, there happen segmentation error.

Here is my TMinuit set,

        define CON 0
        ....
        myMinuit = new TMinuit(1+3*CON); // energy, R, Z, phi
        myMinuit->SetFCN(fcn);
        myMinuit->SetPrintLevel(-1);
        myMinuit->SetMaxIterations(0x3F3F3F3F);
        myMinuit->SetErrorDef(0.5);

        myMinuit->mncler();        
        myMinuit->DefineParameter(0,"E",1.,0.1,1e-3,100);
#if CON
        myMinuit->DefineParameter(1,"R",50.,10.,0.,100);
        myMinuit->DefineParameter(2,"Z",0,10.,-100.,100);
        myMinuit->DefineParameter(3,"Phi",TMath::Pi(),TMath::Pi()/100,0.,TMath::TwoPi());
#endif
        myMinuit->Migrad();

and Error message is below,

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fd19f62682e in waitpid () from /lib64/libc.so.6
#1  0x00007fd19f5b8479 in do_system () from /lib64/libc.so.6
#2  0x00007fd1a4a3b028 in TUnixSystem::StackTrace() () from /sw/packages/root/5.34.36/lib/root/libCore.so.5.34
#3  0x00007fd1a4a3a4b3 in TUnixSystem::DispatchSignals(ESignals) () from /sw/packages/root/5.34.36/lib/root/libCore.so.5.34
#4  <signal handler called>
#5  0x000000000040358a in fcn2(double*, double*) () at re_PMT_recons.cc:100
#6  0x00000000004037ac in fcn(int&, double*, double&, double*, int) () at re_PMT_recons.cc:113
#7  0x00007fd1a03034d7 in TMinuit::Eval(int, double*, double&, double*, int) () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#8  0x00007fd1a0307590 in TMinuit::mnamin() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#9  0x00007fd1a030a24f in TMinuit::mnmigr() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#10 0x00007fd1a031c7e1 in TMinuit::mnexcm(char const*, double*, int, int&) () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#11 0x00007fd1a0303576 in TMinuit::Migrad() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#12 0x0000000000404b68 in main () at re_PMT_recons.cc:304
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x000000000040358a in fcn2(double*, double*) () at re_PMT_recons.cc:100
#6  0x00000000004037ac in fcn(int&, double*, double&, double*, int) () at re_PMT_recons.cc:113
#7  0x00007fd1a03034d7 in TMinuit::Eval(int, double*, double&, double*, int) () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#8  0x00007fd1a0307590 in TMinuit::mnamin() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#9  0x00007fd1a030a24f in TMinuit::mnmigr() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#10 0x00007fd1a031c7e1 in TMinuit::mnexcm(char const*, double*, int, int&) () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#11 0x00007fd1a0303576 in TMinuit::Migrad() () from /sw/packages/root/5.34.36/lib/root/libMinuit.so.5.34
#12 0x0000000000404b68 in main () at re_PMT_recons.cc:304
===========================================================

The other parameter and loading data were worked well, even though w/o tminuit part.
It means if i remove Migrad line then running the code, everything is working. (but result is meaningless)
anyone have some Idea for this issue?
Thank you for your help!

Cheers,
Zee


ROOT Version (e.g. 6.12/02): 5.34/36
Platform, compiler (e.g. CentOS 7.3, gcc6.2): Linux version 2.6.32-696.20.1.el6.x86_64


Hi

The problem looks to be in your fcn2 function. You would need to debug it and understand why it is crashing. Maybe print the input parameters passed to the function

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.