aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/zdab-cat.c11
-rwxr-xr-xutils/cat-grid-jobs42
-rwxr-xr-xutils/submit-grid-jobs6
3 files changed, 56 insertions, 3 deletions
diff --git a/src/zdab-cat.c b/src/zdab-cat.c
index d891c78..1cd2d63 100644
--- a/src/zdab-cat.c
+++ b/src/zdab-cat.c
@@ -37,6 +37,7 @@ void usage(void)
{
fprintf(stderr,"Usage: ./zdab-cat [options] FILENAME\n");
fprintf(stderr," -o output file (default: stdout)\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);
}
@@ -54,12 +55,18 @@ int main(int argc, char **argv)
char *filename = NULL;
char *output = NULL;
FILE *fout = stdout;
+ int skip_second_event = 0;
size_t nhit;
int last_run;
char dqxx_file[256];
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];
@@ -303,7 +310,7 @@ skip_mc:
/* Note the origin link for the first EV bank points back to the
* structural link location in the MAST bank. These links are super
* confusing! */
- if (b.orig == f->first_bank - KMAST_EV) break;
+ if ((b.orig == f->first_bank - KMAST_EV) || skip_second_event) break;
rv = zebra_get_bank(f,&b,b.orig);
diff --git a/utils/cat-grid-jobs b/utils/cat-grid-jobs
new file mode 100755
index 0000000..d43dfad
--- /dev/null
+++ b/utils/cat-grid-jobs
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# Copyright (c) 2019, Anthony Latorre <tlatorre at uchicago>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <https://www.gnu.org/licenses/>.
+
+from __future__ import print_function, division
+import yaml
+
+if __name__ == '__main__':
+ import argparse
+ import matplotlib.pyplot as plt
+ import numpy as np
+
+ parser = argparse.ArgumentParser("plot fit results")
+ parser.add_argument("filenames", nargs='+', help="input files")
+ args = parser.parse_args()
+
+ cat = []
+
+ for filename in args.filenames:
+ with open(filename) as f:
+ data = yaml.load(f.read())
+
+ if data is None:
+ continue
+
+ for event in data['data']:
+ if event['ev'] is not None:
+ cat.append(event)
+
+ print(yaml.dump({'data':cat},default_flow_style=False))
diff --git a/utils/submit-grid-jobs b/utils/submit-grid-jobs
index 18c6e37..8aef916 100755
--- a/utils/submit-grid-jobs
+++ b/utils/submit-grid-jobs
@@ -110,10 +110,14 @@ if __name__ == '__main__':
parser.add_argument("--dqxx-dir", type=str, help="dqxx directory", required=True)
parser.add_argument("--min-nhit", type=int, help="minimum nhit to fit an event", default=100)
parser.add_argument("--max-particles", type=int, help="maximum number of particles to fit for", default=3)
+ parser.add_argument("--skip-second-event", action='store_true', help="only fit the first event after a MAST bank", default=False)
args = parser.parse_args()
for filename in args.filenames:
- output = check_output([join(args.dir,"zdab-cat"),filename])
+ if args.skip_second_event:
+ output = check_output([join(args.dir,"zdab-cat"),"--skip-second-event",filename])
+ else:
+ output = check_output([join(args.dir,"zdab-cat"),filename])
data = yaml.load(output)
for i, event in enumerate(data['data']):