StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
test6.C
1 // #include "St_pamc_Module.h"
2 test6(){
3 Int_t i;
4 Int_t j;
5 Int_t k;
6 printf(" Creating the tables \n");
7 
8 St_scalars *sc = new St_scalars(10);
9 St_vectors *ve = new St_vectors(10);
10 
11 printf(" Calling the 'pamc'module \n");
12 
13 table_head_st *t1_h = sc.GetHeader();
14 table_head_st *t2_h = ve.GetHeader();
15 
16 t1_h.nok = 10;
17 t2_h.nok = 10;
18 
19 TFile ff("pamc.root");
20 
21 ve.Read("vectors");
22 sc.Read("scalars");
23 
24 printf(" Checking the results \n");
25 
26 table_head_st *t1_h = sc.GetHeader();
27 table_head_st *t2_h = ve.GetHeader();
28 
29 printf(" Table = %s, type = %s_st \n", t1_h->name, t1_h->type);
30 printf(" Table = %s, type = %s_st \n", t2_h->name, t2_h->type);
31 printf(" t1_h.nok = %i, t2_h.nok = %i \n", t1_h.nok, t2_h.nok);
32 printf(" t1_h.rbytes = %i, t2_h.rbytes = %i \n", t1_h.rbytes, t2_h.rbytes);
33 
34 scalars_st *t1 = sc.GetTable();
35 vectors_st *t2 = ve.GetTable();
36 
37 for(k=0;k<(t1_h->nok);k++) {
38  printf(" scalars_st t1[%i]: \n ", k);
39  printf("\t aShort=%i \n", t1[k].aShort);
40  printf("\t aUshort=%i\n", t1[k].aUshort);
41  printf("\t aLong=%i\n", t1[k].aLong);
42  printf("\t aUlong=%i\n", t1[k].aUlong);
43  printf("\t aChar=%c\n", t1[k].aChar);
44  printf("\t aOctet=%x\n", t1[k].aOctet);
45  printf("\t aFloat=%f\n", t1[k].aFloat);
46  printf("\t aDouble=%e\n", t1[k].aDouble);
47  printf("\n");
48 }
49 for(k=0;k<(t2_h->nok);k++){
50  printf(" vectors_st t2[%i]: \n ", k);
51 
52 
53  //*-* t2[i].bShorts[j] = i+j;
54  printf("\t bShorts[3]: ");
55  for(j=0;j<3;j++) printf("\t %i ", t2[k].bShorts[j]);
56  printf("\n");
57 
58  //*-* t2[i].bUshorts[j] = i+j;
59  printf("\t bUshorts[3]: ");
60  for(j=0;j<3;j++) printf("\t %i ", t2[k].bUshorts[j]);
61  printf("\n");
62 
63  //*-* t2[i].bLongs[j] = i+j;
64  printf("\t bLongs[3]: ");
65  for(j=0;j<3;j++) printf("\t %i ", t2[k].bLongs[j]);
66  printf("\n");
67 
68  //*-* t2[i].bUlongs[j] = i+j;
69  printf("\t bUlongs[3]: ");
70  for(j=0;j<3;j++) printf("\t %i ", t2[k].bUlongs[j]);
71  printf("\n");
72 
73  //*-* t2[i].bChars[j] = '-';
74  printf("\t aOctet=%x\n", t1[k].aOctet);
75  printf("\t bChars[3]: ");
76  for(j=0;j<3;j++) printf("\t '%x' ", t2[k].bChars[j]);
77  printf("\n");
78 
79  //*-* t2[i].bOctets[j] = i+j;
80  printf("\t bOctets[3]: ");
81  for(j=0;j<3;j++) printf("\t %x ", t2[k].bOctets[j]);
82  printf("\n");
83 
84  //*-* t2[i].bFloats[j] = i+j;
85  printf("\t bFloats[3]: ");
86  for(j=0;j<3;j++) printf("\t %f ", t2[k].bFloats[j]);
87  printf("\n");
88 
89  //*-* t2[i].bDoubles[j] = i+j;
90  printf("\t bDoubles[3]: ");
91  for(j=0;j<3;j++) printf("\t %e ", t2[k].bDoubles[j]);
92  printf("\n");
93 
94  }
95 
96 }
char type[20]
Definition: table_header.h:13
char name[20]
Definition: table_header.h:12