source: Sophya/trunk/SophyaExt/CodeMinuit/cfortran/Examples/read_rwntuple.c@ 3572

Last change on this file since 3572 was 2414, checked in by cmv, 22 years ago

Exemple pour interface cfortan (CERN) cmv 21/07/2003

File size: 1.4 KB
Line 
1#include <stdlib.h>
2#include <cfortran.h>
3#include <packlib.h>
4
5#define Memory_Size 50000
6#define Number_of_Variables 27
7#define Number_of_Events 10
8
9typedef struct { float PAW[Memory_Size]; } PAWC_DEF;
10#define PAWC COMMON_BLOCK(PAWC,pawc)
11COMMON_BLOCK_DEF(PAWC_DEF,PAWC);
12
13main()
14{
15 int istat = 0;
16 int icycle = 0;
17 int i,j,Ierr;
18 int IDN = 0;
19 int record_size = 1024;
20
21 float Event[Number_of_Variables];
22 char Chtags[Number_of_Variables][3] =
23 {"A1","A2","A3","A4","A5","A6","A7","A8","A9",
24 "B1","B2","B3","B4","B5","B6","B7","B8","B9",
25 "C1","C2","C3","C4","C5","C6","C7","C8","C9"};
26
27 HLIMIT(Memory_Size);
28
29 HROPEN(1,"EXAMPLE","example.hbook","N",record_size,istat);
30 if (istat != 0) {
31 printf("Error in opening file ...\n");
32 exit;
33 }
34
35 HBOOKN(10,"Ntuple example",Number_of_Variables,"//EXAMPLE",9000,Chtags);
36
37 for (i=1; i<=Number_of_Events; i++) {
38 for (j=0; j<Number_of_Variables; j++) {
39 Event[j] = (float)i*(float)(j+1);
40 }
41 HFN(10,Event);
42 }
43
44 HROUT(0,icycle," ");
45 HREND("EXAMPLE");
46 KUCLOS(1," ",1);
47/*
48 * Read back the ntuple 10
49 */
50 HROPEN(1,"EXAMPLE","example.hbook","U",record_size,istat);
51 HRIN(10,9999,0);
52
53 for (i=1; i<=10; i++) {
54 HGN(10,IDN,i,Event,Ierr);
55 printf("%f %f %f \n", Event[0],Event[1],Event[2]);
56 }
57
58 HREND("EXAMPLE");
59 KUCLOS(1," ",1);
60}
Note: See TracBrowser for help on using the repository browser.