00001 00002 00003 00004 00005 #include "worldline.h" 00006 00007 local void print_worldline_stats(worldbundleptr wh[], int nh) 00008 { 00009 cerr << endl << "statistics on " << nh << " worldbundle"; 00010 if (nh != 1) cerr << "s"; 00011 cerr << ":" << endl; 00012 00013 int nwtot = 0, nstot = 0, netot = 0; 00014 for (int ih = 0; ih < nh; ih++) { 00015 worldbundleptr wb = wh[ih]; 00016 real t = wb->get_t_min(); 00017 int nw = wb->get_nw(), ns = count_segments(wb), ne = count_events(wb); 00018 cerr << "worldbundle " << ih << ": " 00019 << nw << " worldlines, " 00020 << ns << " segments, " 00021 << ne << " events, t = " 00022 << wb->get_t_min() << " to " << wb->get_t_max() 00023 << endl; 00024 nwtot += nw; 00025 nstot += ns; 00026 netot += ne; 00027 } 00028 cerr << "totals: " << nwtot << " worldlines, " 00029 << nstot << " segments, " << netot << " events" 00030 << endl << endl; 00031 00032 for (int ih = 0; ih < nh; ih++) 00033 wh[ih]->check(); 00034 } 00035 00036 main(int argc, char** argv) 00037 { 00038 check_help(); 00039 00040 char infile[128]; 00041 strcpy(infile, "run.out"); 00042 00043 extern char *poptarg; 00044 char* params = "F:"; 00045 int c; 00046 00047 while ((c = pgetopt(argc, argv, params)) != -1) 00048 switch(c) { 00049 case 'F': strcpy(infile, poptarg); 00050 break; 00051 case '?': params_to_usage(cerr, argv[0], params); 00052 get_help(); 00053 exit(0); 00054 } 00055 00056 ifstream s(infile); 00057 if (!s) { 00058 cerr << "Data file " << infile << " not found." << endl; 00059 exit(1); 00060 } 00061 00062 worldbundleptr wb, wh[1024]; 00063 00064 int nh = 0; 00065 while (nh < 1024 && (wb = read_bundle(s, true))) wh[nh++] = wb; 00066 00067 for (int i = 0; i < 5; i++) cerr << endl; 00068 00069 print_worldline_stats(wh, nh); 00070 }