How to use HFITV in a batch program ?


The following example illustrate how to proceed:

       Program Hfitv_Example
 *
       Parameter (Npoints=100,Npar=3)
       Dimension X(Npoints),Y(Npoints),E(Npoints)
       Dimension Pmin(Npar),Pmax(Npar),Step(Npar),Sigpar(Npar)
       Common/PAWPAR/PAR(Npar)
       Common /PAWC/ H(100000)
       External FitFun
 *.___________________________________________
 *
       Call Igwkty(Kwtype)
       Call Hlimit(100000)
       Call Hplint(Kwtype)
 *
 * Vectors to br fitted
 *
       Do i=1,Npoints
          R    = 5.*rndm(i)
          X(i) = Float(i)
          Y(i) = X(i)*X(i)+i*R
          E(i) = R
       Enddo
 *
 * Parameters needed by Hfitv
 *
       Do i=1,Npar
          PAR(i)  = 1.
          Pmin(i) = 0.
          Pmax(i) = 0.
          Step(i) = -1.
       enddo
 *
 * Perform the fit
 *
       Call Hfitv(Npoints,Npoints,1,X,Y,E,FitFun,
      +           ' ',Npar,PAR,Step,Pmin,Pmax,Sigpar,Chi2)
 *
 * Draw the curve
 *
       Call Hplfra(0.,101.,0.,10100.,' ')
       Call Igraph(100,X,Y,'L')
 *
 * Draw the fit
 *
       Do i=1,Npoints
          Y(i) = FitFun(X(i))
       Enddo
       Call Igset('PLCI',2.)
       Call Igraph(100,X,Y,'L')
 *
       Call Igterm
       Read(*,*)
       Call Hplend
       End

       Function FitFun(X)
       Parameter (Npar=3)
       Common/PAWPAR/PAR(Npar)
       FitFun = PAR(1)*X*X + PAR(2)*X + PAR(3)
       End
 
 pcitasd29> hfitv_example
  Workstation type (?=HELP) =1 : 2
  Version 1.26/04 of HIGZ started
   MINUIT RELEASE 96.03  INITIALIZED.   DIMENSIONS 100/ 50  EPSMAC=  0.89E-15
  **********
  **    1 **SET EPS  0.1000E-06
  **********
  FLOATING-POINT NUMBERS ASSUMED ACCURATE TO   0.100E-06
  **********
  **    2 **SET ERR   1.000
  **********

      **********************************************
      *                                            *
      * Function minimization by SUBROUTINE HFITV  *
      * Variable-metric method                     *
      * ID =          0  CHOPT =                   *
      *                                            *
      **********************************************
  Convergence when estimated distance to minimum (EDM) .LT.  0.10E+01

  FCN=   333041.0     FROM MIGRAD    STATUS=FAILED       227 CALLS      228 TOTAL
                      EDM=  0.52E+03    STRATEGY= 1      ERR MATRIX NOT POS-DEF

   EXT PARAMETER                APPROXIMATE        STEP         FIRST
   NO.   NAME        VALUE          ERROR          SIZE      DERIVATIVE
    1      P1       0.99223        1.0002        0.0000       0.81988E+08
    2      P2       0.65828        1.0002        0.0000       0.93416E+06
    3      P3       0.28668        1.0002        0.0000        12019.

  CHISQUARE = 0.3433E+04  NPFIT =   100
 


Release NotesKnown bugsFAQsContributionsTutorialReference manualDown loadMiscellaneous

Paw.Support@cern.ch