]> hackdaworld.org Git - physik/nlsop.git/commitdiff
calc average
authorhackbard <hackbard>
Thu, 30 Sep 2004 14:38:05 +0000 (14:38 +0000)
committerhackbard <hackbard>
Thu, 30 Sep 2004 14:38:05 +0000 (14:38 +0000)
parse_trim_collision.c

index 5469bfab49a9d9a5d8b5711269b82b2b33e252c9..eed12c57e682779728f5869a31c490230ad76a19 100644 (file)
@@ -30,6 +30,7 @@ int main(int argc,char **argv) {
 
        int fd,ion,i,j;
        int z,skipped;
+       int avg1,avg2;
        double en;
        double max_e;
        int max_chfi,max_th;
@@ -49,6 +50,8 @@ int main(int argc,char **argv) {
 
        ion=1;
        skipped=0;
+       avg1=0;
+       avg2=0;
        for(i=0;i<MAXZ;i++) {
                Z[i].cell_hits_from_ions=0;
                Z[i].total_hits=0;
@@ -73,12 +76,15 @@ int main(int argc,char **argv) {
                                        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;
+                                       avg1+=Z[i].total_hits;
+                                       avg2+=Z[i].cell_hits_from_ions;
                                }
                                for(i=0;i<MAXZ;i++) 
                                        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);
+                               printf("average hits per ion %d / %d\n",avg1/ion,avg2/ion);
                                return 1;
                        }
                        if(buf[i]=='\n') break;