diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 12:12:14 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 12:12:14 -0500 |
commit | 290be05b2355e1324d58ec2bb61ae3a8acaf7d5d (patch) | |
tree | bf226df837526d9ef2f984a381d6c57d73d81d40 | |
parent | 8538a7cbc01f5f3143cb366884dfa84ebc1625ed (diff) | |
download | sddm-290be05b2355e1324d58ec2bb61ae3a8acaf7d5d.tar.gz sddm-290be05b2355e1324d58ec2bb61ae3a8acaf7d5d.tar.bz2 sddm-290be05b2355e1324d58ec2bb61ae3a8acaf7d5d.zip |
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.
-rw-r--r-- | src/fit.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) { |