Hi Georges, Unfortunately, you did not identify which version you are using. Your simple test works correctly with 3.02/07 (pro) or 3.03. As a general remark to speed up the investigation of this kind of problems, I cannot do much with a message like "seg violation" When you get this kind of crash, run with the debugger, eg with gdb gdb root.exe root > .x somescript.C gdb> now you get the crash and the gdb prompt, do gdb > info stack and send me the output of the command "info stack" Rene Brun On Wed, 29 May 2002, Georges Lobo wrote: > Thanks for the answer but this does not solve the segmentation violation > error I have. > I have this message even when I don't try to call mnemat. > Thanks > > ----- Original Message ----- > From: "Rene Brun" <brun@pcbrun.cern.ch> > To: "lobo" <lobo@irmm.jrc.be> > Cc: <roottalk@pcroot.cern.ch> > Sent: Tuesday, May 28, 2002 9:57 PM > Subject: Re: [ROOT] Minuit questions (seg violation error + covariance) > > > > Hi George, > > > > Replace the line: > > gMinuit->mnemat(matrix,3); > > by > > gMinuit->mnemat(&matrix[0][0],3); > > > > Rene Brun > > > > On Mon, 27 May 2002, lobo wrote: > > > > > Hi rooters, > > > I have a problem since some days concerning Minuit in root. > > > I have written a small testfile to explain my problems. > > > // testfit.C > > > void testfit() { > > > > > > Double_t x1[] = {1000,16100,83000,223426,425938}; > > > Double_t y1[] = > {0.0194932,0.00299029,0.00168717,0.00167152,0.00134782}; > > > Double_t ex1[] = {40,500,1000,1574.5,3062.5}; > > > Double_t ey1[] = > > > {0.00232989,0.000269625,0.000142085,0.000110943,7.1839e-05}; > > > TGraphErrors *fluxbkg = new TGraphErrors(5,x1,y1,ex1,ey1); > > > fluxbkg->Print(); > > > TF1 *fitFcn = new TF1("fitFcn",Background,0,450000,3); > > > fitFcn->SetParameters(0.,1.,-0.5.); > > > fitFcn->Draw(); > > > fluxbkg->Fit("fitFcn"); > > > double matrix[3][3]; > > > gMinuit->mnemat(matrix,3); > > > } > > > > > > Double_t Background(Double_t *x, Double_t *par) { > > > Double_t fitval = TMath::Power(x[0],par[2]); > > > return(par[0]+par[1]*fitval); > > > > > > > > > } > > > > > > When I load this file (.L testfit.C) and I execute it I got a > segmentation > > > violation error after the fit. > > > > > > [root][1] .L testfit.C > > > [root][2] testfit(); > > > x[0]=1000, y[0]=0.0194932, ex[0]=40, ey[0]=0.00232989 > > > x[1]=16100, y[1]=0.00299029, ex[1]=500, ey[1]=0.000269625 > > > x[2]=83000, y[2]=0.00168717, ex[2]=1000, ey[2]=0.000142085 > > > x[3]=223426, y[3]=0.00167152, ex[3]=1574.5, ey[3]=0.000110943 > > > x[4]=425938, y[4]=0.00134782, ex[4]=3062.5, ey[4]=7.1839e-05 > > > <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 > > > ********** > > > ** 1 **SET ERR 1 > > > ********** > > > ********** > > > ** 5 **MIGRAD 5000 5.539e-12 > > > ********** > > > MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT. > > > MIGRAD MINIMIZATION HAS CONVERGED. > > > FCN=3.59539 FROM MIGRAD STATUS=CONVERGED 258 CALLS 259 > > > TOTAL > > > EDM=6.36245e-15 STRATEGY= 1 ERROR MATRIX > > > UNCERTAINTY > > > 1.6 per cent > > > EXT PARAMETER STEP FIRST > > > NO. NAME VALUE ERROR SIZE DERIVATIVE > > > 1 p0 1.30041e-03 8.98106e-05 -0.00000e+00 1.21824e-03 > > > 2 p1 6.12043e+00 3.81528e+00 0.00000e+00 -1.66377e-07 > > > 3 p2 -8.43509e-01 7.80422e-02 -0.00000e+00 -6.64307e-06 > > > FCN=3.59539 FROM MIGRAD STATUS=CONVERGED 258 CALLS 259 > > > TOTAL > > > EDM=6.36245e-15 STRATEGY= 1 ERROR MATRIX > > > UNCERTAINTY > > > 1.6 per cent > > > EXT PARAMETER STEP FIRST > > > NO. NAME VALUE ERROR SIZE DERIVATIVE > > > 1 p0 1.30041e-03 8.98106e-05 -0.00000e+00 1.21824e-03 > > > 2 p1 6.12043e+00 3.81528e+00 0.00000e+00 -1.66377e-07 > > > 3 p2 -8.43509e-01 7.80422e-02 -0.00000e+00 -6.64307e-06 > > > > > > *** Break *** segmentation violation > > > Root > Function testfit() busy flag cleared > > > > > > The starnge thing is if I type all the instruction one by one in the > root > > > session I got no error, except it I don't type the line fitFcn->Draw(); > > > before. > > > > > > example if I type > > > ... > > > [root] TF1 *fitFcn = new TF1("fitFcn",Background,0,450000,3); > > > [root] fitFcn->SetParameters(0.,1.,-0.5.); > > > [root] fitFcn->Draw(); > > > [root] fluxbkg->Fit("fitFcn"); > > > .... > > > I have no no segvi error. > > > But if I type > > > > > > [root] TF1 *fitFcn = new TF1("fitFcn",Background,0,450000,3); > > > [root] fitFcn->SetParameters(0.,1.,-0.5.); > > > [root] fluxbkg->Fit("fitFcn"); > > > I got a > > > *** Break *** segmentation violation > > > > > > The other thing is about the mnemat call. When thing are working well I > > > got an error when retrieveing the matrix. > > > [root] double matrix[3][3]; > > > [root] gMinuit->mnemat(matrix,3); > > > > > > Error: Can't call TMinuit::mnemat(matrix,3) in current scope > > > FILE:/tmp/fileOCWcoy_cint LINE:1 > > > Possible candidates are... > > > filename line:size busy function type and name (in TMinuit) > > > (compiled) 0:0 0 public: virtual void mnemat(Double_t* > > > emat,Int_t ndim); > > > filename line:size busy function type and name (in TNamed) > > > filename line:size busy function type and name (in TObject) > > > *** Interpreter error recovered *** > > > > > > Could please someone tell me what is wrong ? I surely made a mistake but > I > > > can't figure out which. > > > Thanks in advance. > > > > > > > > > > > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET