int fd,ion,i,j;
int z,skipped;
- float en;
+ double en;
+ double max_e;
+ int max_chfi,max_th;
t_z Z[MAXZ];
unsigned char hit[MAXZ];
char buf[256],*p,value[6],value2[10];
j=read(fd,&buf[i],1);
if(j<=0) {
close(fd);
+ /* norm */
+ max_e=Z[0].energy;
+ max_th=Z[0].total_hits;
+ max_chfi=Z[0].cell_hits_from_ions;
+ for(i=0;i<MAXZ;i++) {
+ if(Z[i].energy>max_e) max_e=Z[i].energy;
+ if(Z[i].total_hits>max_th) max_th=Z[i].total_hits;
+ if(Z[i].cell_hits_from_ions>max_chfi) max_chfi=Z[i].cell_hits_from_ions;
+ }
for(i=0;i<MAXZ;i++)
- printf("%d %d %f %d\n",i*3,Z[i].total_hits,
- Z[i].energy,
- Z[i].cell_hits_from_ions);
+ printf("%d %f %f %f\n",i*3,1.0*Z[i].total_hits/max_th,
+ Z[i].energy/max_e,
+ 1.0*Z[i].cell_hits_from_ions/max_chfi);
printf("skipped = %d\n",skipped);
return 1;
}