13 int main(
int argc,
char** argv)
16 vector<stdhep_entry> new_event;
19 int output_n = 500000;
20 int max_output_files = 0;
21 int output_filename_digits = 2;
25 while ((c = getopt(argc, argv,
"hn:e:N:")) != -1)
29 printf(
"-h: print this help\n");
30 printf(
"-e: interval between events\n");
31 printf(
"-N: max number of files to write\n");
32 printf(
"-n: output events per output file\n");
39 output_n = atoi(optarg);
42 max_output_files = atoi(optarg);
43 output_filename_digits = strlen(optarg);
46 printf(
"Invalid option or missing option argument; -h to list options\n");
52 printf(
"Interval between nonempty events %d, output events per output file %d, max output files %d\n",
event_interval, output_n, max_output_files);
54 if (argc - optind < 2)
56 printf(
"<input stdhep filenames> <output stdhep basename>\n");
65 char *output_basename = argv[argc-1];
66 char output_filename[100];
69 int events_written = 0;
72 while (max_output_files == 0 || file_n - 1 < max_output_files) {
73 sprintf(output_filename,
"%s_%0*d.stdhep", output_basename, output_filename_digits, file_n++);
74 open_write(output_filename, ostream, output_n);
75 for (
int nevhep = 0; nevhep < output_n; nevhep++)
81 if (optind < argc - 1)
int main(int argc, char **argv)
void add_filler_particle(vector< stdhep_entry > *new_event)
void open_write(char *filename, int ostream, int n_events)
int open_read(char *filename, int istream, int n_events)
void write_stdhep(vector< stdhep_entry > *new_event, int nevhep)
int read_stdhep(vector< stdhep_entry > *new_event)
bool read_next(int istream)
void close_read(int istream)
void write_file(int ostream)
void close_write(int ostream)