HFitter
jhplot

Class HFitter

  • All Implemented Interfaces:
    Serializable


    public class HFitterextends Objectimplements Serializable
    Fit data (H1D or P1D). Some details can be found in http://confluence.slac.stanford .edu/display/JAS3/Functions+and+Fitting+Users+Guide
    See Also:
    Serialized Form
    • Constructor Detail

      • HFitter

        public HFitter(String method)
        Create a fitter using some method. The supported types are:
        uml - unbinned maximum likelihood
        leastsquares - least Squares
        cleverchi2 - "clever" chi2
        chi2 - Chi2 (default)
        bml - binned maximum likelihood

        When a function is provided to the fitter the user has to be aware that the AIDA prescription is to leave the input function unchanged, create a clone, do the fit on the clone and return the clone in the fit result. There advantage to this approach is that the input function can be reused as is for multiple identical fits while the fitted-cloned function is left unchanged in the fit result. The default is noClone=false.

        Parameters:
        method - the fit method (Could be: uml, leastsquares, cleverchi2, chi2, bml)
      • HFitter

        public HFitter()
        Create a fitter with the Chi2 method by default.
    • Method Detail

      • getFitMethods

        public String[] getFitMethods()
        Return available fit methods.
        Returns:
        Fit methods
      • getFitMethod

        public String getFitMethod()
        Returns the current fit method.
        Returns:
        Fit methods
      • setFitMethod

        public void setFitMethod(String method)
        Sets the fit method. Available methods are: uml, leastsquares, cleverchi2, chi2, bml.
        Parameters:
        The - fit method.
      • addFunc

        public void addFunc(String name,           IFunction f)
        Add a new function to catalog.
        Parameters:
        name - function name
        f - input function
      • getFitEngines

        public String[] getFitEngines()
        Return available fit engines.
        Returns:
        Fit methods
      • setFunc

        public void setFunc(IFunction func)
        Set fit functions
      • getFuncCatalog

        public String[] getFuncCatalog()
        Return list of available functions
        Returns:
        list of functions
      • setFunc

        public void setFunc(String func)
        Set fit functions from predefined string.
        G - Gaussian
        E - Exponential
        Pn' - Polynomial (n is an integer, i.e "P0","P1", "P2').
        Parameters:
        func - string: G (Gaussian),E (exponential),landau (landa),pow (power law), and polynomial: P0,P1,P2,P3..
      • getPar

        public double getPar(String name)
        Get parameter value
        Parameters:
        name - parameter name
        Returns:
        value
      • setPar

        public void setPar(String name,          double value)
        Set parameter to a value
        Parameters:
        name - parameter name
        value - value to be set.
      • setParStep

        public void setParStep(String name,              double step)
        Set step size for parameter (say 0.01)
        Parameters:
        name - parameter name
        step - step used in minimization
      • setParFixed

        public void setParFixed(String name)
        Fix a given parameter to a constant value
        Parameters:
        name - parameter name to be fixed
      • setParFixed

        public void setParFixed(String name,               boolean fix)
        Fix a given parameter to a constant value or not
        Parameters:
        name - parameter name to be fixed or not
        fix - true if the parameter should be fixed.
      • setParRange

        public void setParRange(String name,               double min,               double max)
        Set range for parameter during the fit
        Parameters:
        name - parameter name
        min - min value
        max - max value
      • setParConstraint

        public void setParConstraint(String constraint)
        Set parameter constraint Example: Set parameter "mean1" to be identical to "mean2" as: "mean1=mean2"
        Parameters:
        constraint -
      • getFunc

        public IFunction getFunc()
        Return function
        Returns:
        function
      • setFunc

        public void setFunc(String name,           int dimension,           String function,           String parameters)
        Set functions from a script. Example:
        P2 : setFunc("p2", 1, "a+b*x[0]+c*x[0]*x[0]", "a,b,c")
        parabola : setFunc('parabola',1, 'a*x[0]*x[0]+b*x[0]+c','a,b,c')

        Parameters:
        name - function name
        dimension - dimension
        function - string representing a function
        parameters - parameters (use comma)
      • fit

        public void fit(H1D h1d)
        Fit histogram
        Parameters:
        h1d - input H1D
      • fit

        public void fit(P1D p1d)
        Fit P1D
        Parameters:
        p1d - input P1D
      • fit

        public void fit(PND pnd)
        Fit PND (all errors set to be zero). Only last component is "value" of the data, other are positions in dimension-1 space.
        Parameters:
        pnd - input P1D
      • fit

        public void fit(H2D h2d)
        Fit H2D histogram
        Parameters:
        h2d - input H2D histogram
      • setRange

        public void setRange(double rmin,            double rmax)
        Set range for fitting for 1D objects (H1D, P1D)
        Parameters:
        rmin - Min X value
        rmax - Max Y value
      • getFitter

        public IFitter getFitter()
        Return Jaida fitter
        Returns:
        fitter
      • getFittedFunc

        public IFunction getFittedFunc()
        Get results of the fit in form of function
        Returns:
        results of the fit in form of function.
      • getResult

        public IFitResult getResult()
        Get result of the fit.
        Returns:
        result of the fit.
      • doc

        public void doc()
        Show online documentation.

SCaVis 2.1 © jWork.ORG