| Last change
 on this file since 3827 was             2414, checked in by cmv, 22 years ago | 
        
          | 
Exemple pour interface cfortan (CERN)   cmv 21/07/2003
 | 
        
          | File size:
            865 bytes | 
      
      
| Rev | Line |  | 
|---|
| [2414] | 1 | /* | 
|---|
|  | 2 | * This example demonstrate how to call MINUIT from C. | 
|---|
|  | 3 | * | 
|---|
|  | 4 | * For question/problems contact: Heplib.Support@cern.ch | 
|---|
|  | 5 | * | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #if defined(__hpux) || defined(_IBMR2) || defined(__alpha) || defined(__apollo) || defined(__ultrix) || defined(__sgi) || defined(__sun) | 
|---|
|  | 9 | #define extname | 
|---|
|  | 10 | #endif | 
|---|
|  | 11 |  | 
|---|
|  | 12 | #ifdef extname | 
|---|
|  | 13 | #define FCN fcn_ | 
|---|
|  | 14 | #else | 
|---|
|  | 15 | #define FCN fcn | 
|---|
|  | 16 | #endif | 
|---|
|  | 17 |  | 
|---|
|  | 18 | #include "cfortran.h" | 
|---|
|  | 19 | #include "minuit.h" | 
|---|
|  | 20 | #define Ncont 20 | 
|---|
|  | 21 | int main() | 
|---|
|  | 22 | { | 
|---|
|  | 23 | int error_flag=0; | 
|---|
|  | 24 | void *fcn(); | 
|---|
|  | 25 | struct { | 
|---|
|  | 26 | double x[Ncont]; | 
|---|
|  | 27 | double y[Ncont]; | 
|---|
|  | 28 | int n; | 
|---|
|  | 29 | } pts; | 
|---|
|  | 30 | double f_null=0.; | 
|---|
|  | 31 |  | 
|---|
|  | 32 |  | 
|---|
|  | 33 | MNINIT(5,6,7);   /*  initialise  */ | 
|---|
|  | 34 |  | 
|---|
|  | 35 | MNSETI(" Minuit Example ");   /* set title */ | 
|---|
|  | 36 |  | 
|---|
|  | 37 | MNPARM(1,"X",0.,.1,f_null,f_null,error_flag); | 
|---|
|  | 38 |  | 
|---|
|  | 39 | MNPARM(2,"-Y-",0.,.01,f_null,f_null,error_flag); | 
|---|
|  | 40 |  | 
|---|
|  | 41 | MNEXCM(fcn,"MIGRAD",0,0,error_flag,0); | 
|---|
|  | 42 |  | 
|---|
|  | 43 | MNEXCM(fcn,"MINOS",0,0,error_flag,0); | 
|---|
|  | 44 |  | 
|---|
|  | 45 | MNCONT(fcn,1,2,Ncont,pts.x[0],pts.y[0],pts.n, 0); | 
|---|
|  | 46 |  | 
|---|
|  | 47 | } | 
|---|
|  | 48 |  | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.