Re: [ROOT] Question on fitting/ obtaining fit results

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Mar 09 2004 - 15:35:19 MET


You have a problem with the second argument "dummy".
Instead of
char* dummy;
you should declare
char dummy[100]; (dimension must be bigger than the longest parameter name

Rene Brun

Alexander Dietz wrote:
> 
> Hi Rooters
> 
> I am working with ROOT -Version 3.10. and I am trying to obtain some
> fit-results (the values 'vlow' and 'vhigh'). Thetefore I am using the
> method TVirtualFitter::GetParameter(Int_t ipar, char* name, Double_t&
> value, Double_t& verr, Double_t& vlow, Double_t& vhigh)
> 
> My program:
> 
>    // creating histogram
>    TH1F* h1=new TH1F("h1","histo from a gaussian",100,-3,3);
>    h1->FillRandom("gaus",10000);
> 
>    // fitting
>    TF1* f1=new TF1("func1","gaus",0,10);
>    h1->Fit("func1");
> 
>    char* dummy;
>    Double_t v1=0;
>    Double_t v2=0;
>    Double_t v3=0;
>    Double_t v4=0;
> 
>    // getting current fitter
>    TVirtualFitter* hFitter = TVirtualFitter::GetFitter();
> 
>    // *** segmentation fault here ***
>    hFitter->GetParameter(1, dummy, v1, v2, v3, v4);
> 
> Why do I have a segmentation fault when trying to obtain the fit-results?



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