Re: [ROOT] gMinuit->mnemat problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 05 2002 - 10:11:07 MEST


Hi,

TMinuit::mnemat has the following signature:
void mnemat(Double_t *emat, Int_t ndim) 

You cannot fill a TMatrixD directly from this function. Instead do
  double matrix[2][2];
  gMinuit->mnemat(&matrix[0[0],2);

see: http://root.cern.ch/root/htmldoc/TMinuit.html#TMinuit:mnemat

Rene Brun

On Thu, 4 Jul 2002, Avdhesh Chandra wrote:

> 
>  Hi,
>      I am trying to get covariance matrix of the errors. I have a fit
> function which gives two paramertes, part of the code looks like 
> 
>  ---------------------------------------------------
>    TF1 *func_1 = new TF1("fitf",fitf,0.0,6.28,2);
>   //Sets initial values and parameter names
>   func_1->SetParameters(0.02,1.0);
>   func_1->SetParNames("Constant","Offset");
>   Dca_phi_1->Fit("fitf");
> 
>   TMatrixD A01(1,2); TMatrixD A02(2,2);  TMatrixD A03(2,1); 
>   TMatrixD A11(1,2); TMatrixD A12(2,2);  TMatrixD A13(2,1); 
>   TMatrixD B01(2,1); TMatrixD C01(1,1);
>   TMatrixD B11(2,1); TMatrixD C11(1,1);
> 
>   gMinuit->mnemat(A02,2); 
>   gMinuit->mnemat(A12,2); 
>   double par10 = func_1->GetParameter("Constant") ;
>   double par11 = func_1->GetParameter("Offset") ;
>   double err_par10 = func_1->GetParError(0) ;
>   double err_par11 = func_1->GetParError(1) ;
>  -------------------------------------------------------
> 
> 
>  it gives me following **ERROR** after running the code.
> 
> 
> 
> --------------------------------------------------------------------------
>   FCN=140.116 FROM MIGRAD    STATUS=CONVERGED      48 CALLS          49
> TOTAL
>                      EDM=1.65745e-17    STRATEGY= 1      ERROR MATRIX
> ACCURATE 
>   EXT PARAMETER                                   STEP         FIRST   
>   NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
>    1  Constant     1.68390e-02   3.55273e-04   2.06067e-06   3.44811e-08
>    2  Offset       1.25291e+00   2.29010e-02   1.32831e-04  -2.51413e-07
> Error: Can't call TMinuit::mnemat(A02,2) in current scope
> FILE:/prj_root/837/ckm_1/avdhesh/beam_width/1ros/test.C LINE:198
> 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 ***
> -------------------------------------------------------------------
> 
>  I am not under standing why it is not working.
>   
>  
>   one more thing is that, if i am writing to get error
> 
>   double err_par10 = func_1->GetParError("Constant") ;
>   double err_par11 = func_1->GetParError("Offset") ;
> 
>   it does not works, insted of this i have to write 
>            double err_par10 = func_1->GetParError(0) ;
>            double err_par11 = func_1->GetParError(1) ;
>  
> 
>   while  to get parameters
>            double par10 = func_1->GetParameter("Constant") ;
>            double par11 = func_1->GetParameter("Offset") ;
>     works !
> 
>   Thanks for help
>   Avdhesh
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET