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