StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DistrStat2Sectors.C
1 DistrStat2Sectors(char *filename){
2  FILE *fout1=fopen("stat-01","w");assert(fout1);
3  FILE *fout2=fopen("stat-02","w");assert(fout2);
4  FILE *fout3=fopen("stat-03","w");assert(fout3);
5  FILE *fout4=fopen("stat-04","w");assert(fout4);
6  FILE *fout5=fopen("stat-05","w");assert(fout5);
7  FILE *fout6=fopen("stat-06","w");assert(fout6);
8  FILE *fout7=fopen("stat-07","w");assert(fout7);
9  FILE *fout8=fopen("stat-08","w");assert(fout8);
10  FILE *fout9=fopen("stat-09","w");assert(fout9);
11  FILE *fout10=fopen("stat-10","w");assert(fout10);
12  FILE *fout11=fopen("stat-11","w");assert(fout11);
13  FILE *fout12=fopen("stat-12","w");assert(fout12);
14  FILE *fd2=fopen(filename,"r");assert(fd2);
15  fprintf(fout1,"#sector01/eemcPMTstat\n");
16  fprintf(fout2,"#sector02/eemcPMTstat\n");
17  fprintf(fout3,"#sector03/eemcPMTstat\n");
18  fprintf(fout4,"#sector04/eemcPMTstat\n");
19  fprintf(fout5,"#sector05/eemcPMTstat\n");
20  fprintf(fout6,"#sector06/eemcPMTstat\n");
21  fprintf(fout7,"#sector07/eemcPMTstat\n");
22  fprintf(fout8,"#sector08/eemcPMTstat\n");
23  fprintf(fout9,"#sector09/eemcPMTstat\n");
24  fprintf(fout10,"#sector10/eemcPMTstat\n");
25  fprintf(fout11,"#sector11/eemcPMTstat\n");
26  fprintf(fout12,"#sector12/eemcPMTstat\n");
27  while(1){
28  char txtx[10];
29  //n1 is the fail word, n2 is the status word
30  //they are read in as n1 and n2 from the .errs file
31  //but they should be output as n2 n1
32  char n1[10];char n2[10];
33  int ret0=fscanf(fd2,"%s %s %s",txtx,n1,n2);
34  if(ret0!=3) break;
35  if(strncmp(txtx,"a01",3)==0){
36  fprintf(fout1,"%s %s %s\n",txtx+1,n2,n1);
37  }
38  if(strncmp(txtx,"a02",3)==0){
39  fprintf(fout2,"%s %s %s\n",txtx+1,n2,n1);
40  }
41  if(strncmp(txtx,"a03",3)==0){
42  fprintf(fout3,"%s %s %s\n",txtx+1,n2,n1);
43  }
44  if(strncmp(txtx,"a04",3)==0){
45  fprintf(fout4,"%s %s %s\n",txtx+1,n2,n1);
46  }
47  if(strncmp(txtx,"a05",3)==0){
48  fprintf(fout5,"%s %s %s\n",txtx+1,n2,n1);
49  }
50  if(strncmp(txtx,"a06",3)==0){
51  fprintf(fout6,"%s %s %s\n",txtx+1,n2,n1);
52  }
53  if(strncmp(txtx,"a07",3)==0){
54  fprintf(fout7,"%s %s %s\n",txtx+1,n2,n1);
55  }
56  if(strncmp(txtx,"a08",3)==0){
57  fprintf(fout8,"%s %s %s\n",txtx+1,n2,n1);
58  }
59  if(strncmp(txtx,"a09",3)==0){
60  fprintf(fout9,"%s %s %s\n",txtx+1,n2,n1);
61  }
62  if(strncmp(txtx,"a10",3)==0){
63  fprintf(fout10,"%s %s %s\n",txtx+1,n2,n1);
64  }
65  if(strncmp(txtx,"a11",3)==0){
66  fprintf(fout11,"%s %s %s\n",txtx+1,n2,n1);
67  }
68  if(strncmp(txtx,"a12",3)==0){
69  fprintf(fout12,"%s %s %s\n",txtx+1,n2,n1);
70  }
71  }
72 
73 }