Hi Andreas,
Do the following:
- Load the file test.C below
- root > .L test.C
- root > test(); //this create a function "user" calling fitf
- draw the histogram you want to fit
- Select Fitpanel in the context menu
- Select the fit option "user"
- click on button Fit
By default, the button "User" will fit with a function named "user".
You can change this default to a different name if you like.
Click on the Fitpanel button "User" with the right mouse button.
Select menu item "setMethod"
You will see a dialog box with "SetFunction("user").
Change the name "user" to eg, "andreas" (you must enter \"andreas\").
In test.C, change also the name "user" to "andreas"
//file test.C
Double_t fitf(Double_t *x, Double_t *par)
{
Double_t arg = 0;
if (par[2] != 0) arg = (x[0] - par[1])/par[2];
Double_t fitval = par[0]*TMath::Exp(-0.5*arg*arg);
return fitval;
}
void test() {
TF1 *f = new TF1("user",fitf,-3,3,3);
f->SetParameters(100,0,1);
}
Rene Brun
Andreas Zoglauer wrote:
>
> Hello,
>
> The fitpanel contains a button called "USER".
> I assume that clicking this button should produce a fit with a user
> defined function?
>
> How can I set this user defined fit function globally in my program?
>
> Thanks, Andreas
>
> ROOT: 3.02.01 (cvs)
> OS: Linux SuSE 7.2
>
> ----------------------------------------------------------------------
> Andreas Zoglauer
>
> MPI fuer extraterrestrische Physik Phone: +49/89-30000-3848
> Postfach 1312 Fax: +49/89-30000-3569
> 85741 Garching, Germany Email: zog@mpe.mpg.de
> ----------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET