Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 89e46e152d5f72c49758d7759b529012 > files > 1389

cernlib-g77-devel-2006-33.fc12.i686.rpm

/*
 * This example demonstrate how to call MINUIT from C.
 *
 * For question/problems contact: Heplib.Support@cern.ch
 *
 *                                                                               
 * Authors: William Hanlon <whanlon@cosmic.utah.edu>,
 *          Gunter Folger <Gunter.Folger@cern.ch>
 */

#include <cfortran.h>
#include <minuit.h>
#define Ncont 20
int main()
{
   int error_flag=0;
   PROTOCCALLSFSUB0(FCN,fcn)
   struct {
      double x[Ncont];
      double y[Ncont];
      int n;
   } pts;
   double f_null=0.;

   MNINIT(5,6,7);   /*  initialise  */
   MNSETI(" Minuit Example ");   /* set title */
   MNPARM(1,"X",0.,.1,f_null,f_null,error_flag);
   MNPARM(2,"-Y-",0.,.01,f_null,f_null,error_flag);
   MNEXCM(C_FUNCTION(FCN,fcn),"MIGRAD",0,0,error_flag,0);
   MNEXCM(C_FUNCTION(FCN,fcn),"MINOS",0,0,error_flag,0);
   MNCONT(C_FUNCTION(FCN,fcn),1,2,Ncont,pts.x[0],pts.y[0],pts.n, 0);
}