From 290be05b2355e1324d58ec2bb61ae3a8acaf7d5d Mon Sep 17 00:00:00 2001 From: tlatorre Date: Thu, 20 Sep 2018 12:12:14 -0500 Subject: add a command line option to only fit the first event This commit adds the ability to run the fit program with the --skip-second-event flag to only fit the first event after a MAST bank. This way we avoid fitting secondaries like Michel electrons when fitting MC events. --- src/fit.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fit.c b/src/fit.c index 09da3a0..a7041f1 100644 --- a/src/fit.c +++ b/src/fit.c @@ -5309,6 +5309,8 @@ void usage(void) { fprintf(stderr,"Usage: ./fit [options] FILENAME\n"); fprintf(stderr," -o output file\n"); + fprintf(stderr," --skip-second-event only fit the first event after a " + " MAST bank\n"); fprintf(stderr," -h display this help message\n"); exit(1); } @@ -5381,9 +5383,15 @@ int main(int argc, char **argv) char *filename = NULL; char *output = NULL; FILE *fout = NULL; + int skip_second_event = 0; for (i = 1; i < argc; i++) { - if (argv[i][0] == '-') { + if (strlen(argv[i]) >= 2 && !strncmp(argv[i], "--", 2)) { + if (!strcmp(argv[i]+2,"skip-second-event")) { + skip_second_event = 1; + continue; + } + } else if (argv[i][0] == '-') { switch (argv[i][1]) { case 'o': output = argv[++i]; @@ -5510,6 +5518,9 @@ int main(int argc, char **argv) unpack_ev(b.data, &bev); ev.run = bev.run; ev.gtid = bev.gtr_id; + + if (!first_ev && skip_second_event) continue; + rv = get_event(f,&ev,&b); if (fit_event(&ev,xopt,&fmin) == NLOPT_FORCED_STOP) { -- cgit