void plot(char *fname="photopentode_000")
{
const int wl_n = 36;
const double wl_min = 3000;
const double wl_max = 6500;
const int nx = 10;
const int ny = 10;
int nrows = (nx+1)*(ny+1);
char sbuff[256];
sprintf(sbuff, "%s.dat", fname);
FILE *fp=fopen(sbuff,"r");
if (!fp) {
printf("Error opening input file!\n");
return -1;
}
int nb;
int hdr[10];
int hdrp[10];
float *fhdr=(float *) hdrp;
float sdata[5];
while(!feof(fp)) {
for(int j=1;j<nrows;j++) {
nb=fread(hdr,sizeof(int),5,fp);
if (nb!=5) break;
printf("[%d] hdr[0]=%u [1]=%u [2]=%u [3]=%u [4]=%u\n",j, hdr[0],hdr[1],hdr[2],hdr[3],hdr[4]);
switch (hdr[0]) {
case 3:{
nb=fread(hdrp,sizeof(int),5,fp);
//~ printf("x=%u y=%u | i0=%g i1=%g t=%u\n",hdrp[0],hdrp[1],fhdr[2],fhdr[3],hdrp[4]);
//~ hdr[3]=hdrp[0];
//~ hdr[4]=hdrp[1];
//~ noise->SetPoint(icount++,hdrp[4],-fhdr[3]);
for (int i=0;i<wl_n;i++) {
nb=fread(sdata,sizeof(float),5,fp);
//~ // j=pointXY, i=wl
//~ sdata[0]=wl[0][i];
//~ sdata[1]=tok[0][i];
//~ sdata[2]=tok[j][i];
//~ sdata[3]=qe[0][i];
//~ sdata[4]=qe[j][i];
//~ printf("sdata[0]=%f [1]=%g [2]=%g [3]=%f [4]=%f\n", sdata[0], sdata[1], sdata[2], sdata[3], sdata[4]);
printf(" [%d] sdata[0]=%f [3]=%f [4]=%f\n", i, sdata[0], sdata[3], sdata[4]);
}
}
break;
}//switch (hdr[0])
}//for(int j=0;j<nrows;j++)
}//while(!feof(fp))
fclose(fp);
}