]> hackdaworld.org Git - physik/nlsop.git/commitdiff
-
authorhackbard <hackbard>
Tue, 14 Sep 2004 17:57:23 +0000 (17:57 +0000)
committerhackbard <hackbard>
Tue, 14 Sep 2004 17:57:23 +0000 (17:57 +0000)
parse_trim_collision.c

index ea59d6b669ec59d97e6d2260e25232a7109759f0..5469bfab49a9d9a5d8b5711269b82b2b33e252c9 100644 (file)
@@ -30,7 +30,9 @@ int main(int argc,char **argv) {
 
        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];
@@ -63,10 +65,19 @@ int main(int argc,char **argv) {
                        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;
                        }