Thanks for the help, Wim. This gets me tantalizingly close!
What I have so far:
import ROOT
h = ROOT.TH1F("h","test",100,-2,2)
h.FillRandom("gaus",1000)
h.Fit("gaus")
ROOT.gROOT.ProcessLine("TVirtualFitter *fitter =
TVirtualFitter::GetFitter()")
fitter = ROOT.gROOT.GetGlobal( "fitter", 1 )
fitter
# output is <__main__.TVirtualFitter instance at 0x41ead50c>
# looks good so far!
fitter.IsA()
# output is <__main__.TClass instance at 0x41ead5ec>
# that also works
fitter.GetParameter(1) # try something simple first
*** Break *** segmentation violation
Generating stack trace...
0xffffe420 in <unknown function>
0x40c0c9b3 in G__CallFunc::ExecDouble(void*) + 0x77 from
/usr/local/root/lib/libCint.so
0x403e1edb in PyROOT::MethodHolder::execute(void*, double&) + 0x61 from
/usr/local/root/lib/libPyROOT.so
0x403e2055 in PyROOT::MethodHolder::operator()(_object*, _object*) +
0x10d from /usr/local/root/lib/libPyROOT.so
0x403df590 in PyROOT::MethodDispatcher::operator()(_object*, _object*)
+ 0xe4 from /usr/local/root/lib/libPyROOT.so
0x403df37b in PyROOT::MethodDispatcher::invoke(_object*, _object*,
_object*) + 0x35 from /usr/local/root/lib/libPyROOT.so
0x40066be3 in PyCFunction_Call + 0x5f from /usr/lib/libpython2.3.so.1.0
Aborted
Ack! I didn't see that coming! I get this on every method call of
fitter, except IsA and other trivial inherited methods like GetName, etc.
Any more clues?
- Topher
WLavrijsen@lbl.gov wrote:
>Topher,
>
>some of the things you are trying to do are best interpreted by me as new
>feature requests. :) That's for later.
>
>For now, one hopefully helpful hint: the list of globals is not synchronized
>under PyROOT (I haven't looked into the why of that), whereas under CINT, it
>is synchronized.
>
>Get your global with the second parameter set to 1 (ie. load = true) to force
>synchronization. Note, though that gMinuit doesn't exist by default. Ie, do
>something like:
>
> >>> import ROOT
> >>> minuit = ROOT.TMinuit()
> >>> not not ROOT.gROOT.GetGlobal( "gMinuit", 1 )
> 1
>
>(the TMinuit ctor sets gMinuit to 'this').
>
>More later ...
>
>HTH,
> Wim
>
>
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET