Look at an example in ``histo_fit.py''. This script fills a histogram, creates factories and does a fit with a Gaussian function.
One can fit data (H1D histograms or P1D data holders) using the Fit Panel based on the HFit class. You can look at the example ``histo_fit1.py''.
>>># .. define c1 as HPLot object and h1 as a H1D histogram and fill it >>>a=HFit(c1,"c1",h,"h1") # start HFit panel
After executing "HFit(c1,"c1",h,"h1")" (the arguments should be adjusted to reflect the variable names for HPlot and H1D histogarm), you will see a pop-up fit panel. Note that we pass not only the objects, but also the variable names for the HPlot and H1D class. One can also pass a P1D object instead of a histogram H1D. You need to pass the variable names if you want to generate JAIDA source code automatically.
The fit panel allows the user to set up the predefined fit functions, fit method and perform the fit. The user can also set up the initial parameters for the fit function (use "Settings" button). Once the fit is acceptable, the used can generate the output fit parameters, which will be inserted directly to the jeHEP editors as jython code. The user can also automatically generate the JAIDA source code which corresponds to the fit. Once inserted, it can further be corrected using the jeHEP editor. Then "a=HFit()" statement can be removed and the user can run the generated JAIDA code manually.
One can also specify a user-defined 1D function and add it to the HFit Panel. This is an example:
>>># .. define c1 as HPLot object and h1 as a H1D histogram and fill it >>>a=HFit(c1,"c1",h,"h1") # start HFit panel >>>a.addFunc("User1", "Tool tip", "a*x[0]+b","a,b") # add "User1" function
After executing this scrip, a new function "User1" will be added to the fit panel.