From 61c0e06952f368db54fe6cf86eac6b4fb2a95c44 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Wed, 16 Dec 2020 13:41:44 -0600 Subject: print out livetime from run_info.log in dm-search --- utils/dm-search | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'utils') diff --git a/utils/dm-search b/utils/dm-search index 262e664..91d9b87 100755 --- a/utils/dm-search +++ b/utils/dm-search @@ -552,6 +552,7 @@ if __name__ == '__main__': parser.add_argument("--test", type=int, default=0, help="run tests to check discovery threshold") parser.add_argument("--run-list", default=None, help="run list") parser.add_argument("--mcpl", nargs='+', required=True, help="GENIE MCPL files") + parser.add_argument("--run-info", required=True, help="run_info.log autosno file") args = parser.parse_args() setup_matplotlib(args.save) @@ -563,7 +564,7 @@ if __name__ == '__main__': rhdr = pd.concat([read_hdf(filename, "rhdr").assign(filename=filename) for filename in args.filenames],ignore_index=True) for run, df in rhdr.groupby('run'): evs.append(get_events(df.filename.values, merge_fits=True, nhit_thresh=args.nhit_thresh)) - ev = pd.concat(evs) + ev = pd.concat(evs).reset_index() if args.run_list is not None: runs = np.genfromtxt(args.run_list) @@ -571,16 +572,25 @@ if __name__ == '__main__': livetime = 0.0 livetime_pulse_gt = 0.0 - for ev in evs: - if not np.isnan(ev.attrs['time_10_mhz']): - livetime += ev.attrs['time_10_mhz'] + for _ev in evs: + if not np.isnan(_ev.attrs['time_10_mhz']): + livetime += _ev.attrs['time_10_mhz'] else: - livetime += ev.attrs['time_pulse_gt'] - livetime_pulse_gt += ev.attrs['time_pulse_gt'] + livetime += _ev.attrs['time_pulse_gt'] + livetime_pulse_gt += _ev.attrs['time_pulse_gt'] print("livetime = %.2f" % livetime) print("livetime (pulse gt) = %.2f" % livetime_pulse_gt) + if args.run_info: + livetime_run_info = 0.0 + run_info = np.genfromtxt(args.run_info,usecols=range(4),dtype=(np.int,np.int,np.double,np.double)) + for run in set(ev.run.values): + for i in range(run_info.shape[0]): + if run_info[i][0] == run: + livetime_run_info += run_info[i][3] + print("livetime (run info) = %.2f" % livetime_run_info) + ev = correct_energy_bias(ev) # Note: We loop over the MC filenames here instead of just passing the -- cgit