Re: [ROOT] Accessing Minuit's error matrix using pyROOT

From: Topher Cawlfield (cawlfiel@uiuc.edu)
Date: Wed Aug 04 2004 - 00:14:51 MEST


I can now access the error matrix through pyROOT, thanks to the efforts 
of Rene and Wim.  The following works, having built root from CVS:

import ROOT
h = ROOT.TH1F("h","test",100,-2,2)
h.FillRandom("gaus",1000)
h.Fit("gaus")
fitter = ROOT.TVirtualFitter.GetFitter( ROOT.TVirtualFitter() )
fitter.GetCovarianceMatrixElement(0,1)

Yea!  Many thanks to you for getting this to work!

I can also access gMinuit via:
gMinuit = ROOT.gROOT.GetGlobal( "gMinuit", 1 )

Current problems:  (These don't bother me so much now that I have a way 
into the covariance matrix)

I can't do anything much with gMinuit though.  I'd have expected the 
following to print out the covariance matrix, for example:
 >>> gMinuit.mnexcm("SHO COV")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: NULL result without error in PyObject_Call
Seems like all other (useful) methods of gMinuit have similar problems.  
GetName() works.

So I haven't been able to populate a TMatrixD yet, and if I did I'm not 
sure I could access the elements of it.  But here I'm just playing around.

Another thing that doesn't work but should:
 >>> covm = ROOT.TMatrixD(3, 3, fitter.GetCovarianceMatrix())
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: None of the 15 overloaded methods succeeded

That's all for now.
   Topher Cawlfield



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