From b11000942eb96c5b50a18030b0b8bb130a3701af Mon Sep 17 00:00:00 2001 From: tlatorre Date: Mon, 16 Nov 2020 08:00:44 -0600 Subject: loop over MC filenames --- utils/chi2 | 9 ++++++++- utils/dc | 9 ++++++++- utils/dc-closure-test | 10 +++++++++- utils/dm-search | 9 ++++++++- utils/plot-michels | 10 +++++++++- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/utils/chi2 b/utils/chi2 index 329fd65..ecbf940 100755 --- a/utils/chi2 +++ b/utils/chi2 @@ -432,7 +432,14 @@ if __name__ == '__main__': ev = correct_energy_bias(ev) - ev_mc = get_events(args.mc, merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False) + # Note: We loop over the MC filenames here instead of just passing the + # whole list to get_events() because I had to rerun some of the MC events + # using SNOMAN and so most of the runs actually have two different files + # and otherwise the GTIDs will clash + ev_mcs = [] + for filename in args.mc: + ev_mcs.append(get_events([filename], merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False)) + ev_mc = pd.concat(ev_mcs) muon_mc = get_events(args.muon_mc, merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False) weights = pd.concat([read_hdf(filename, "weights") for filename in args.weights],ignore_index=True) diff --git a/utils/dc b/utils/dc index 2032092..933f3d3 100755 --- a/utils/dc +++ b/utils/dc @@ -310,7 +310,14 @@ if __name__ == '__main__': for _, row in ev[ev[bg]].iterrows(): data[bg][row.radius_cut][row.psi_cut][row.z_cut][row.udotr_cut] += 1 - ev_mc = get_events(args.mc, merge_fits=True, apply_nhit_trigger=False) + # Note: We loop over the MC filenames here instead of just passing the + # whole list to get_events() because I had to rerun some of the MC events + # using SNOMAN and so most of the runs actually have two different files + # and otherwise the GTIDs will clash + ev_mcs = [] + for filename in args.mc: + ev_mcs.append(get_events([filename], merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False)) + ev_mc = pd.concat(ev_mcs) ev_mc = ev_mc[ev_mc.prompt] ev_mc = ev_mc[ev_mc.nhit_cal > 100] diff --git a/utils/dc-closure-test b/utils/dc-closure-test index 3c53a1b..738e4f3 100755 --- a/utils/dc-closure-test +++ b/utils/dc-closure-test @@ -466,7 +466,15 @@ if __name__ == '__main__': ev = z_cut(ev) ev = udotr_cut(ev) - ev_mc = get_events(args.mc, merge_fits=True, apply_nhit_trigger=False) + # Note: We loop over the MC filenames here instead of just passing the + # whole list to get_events() because I had to rerun some of the MC events + # using SNOMAN and so most of the runs actually have two different files + # and otherwise the GTIDs will clash + ev_mcs = [] + for filename in args.mc: + ev_mcs.append(get_events([filename], merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False)) + ev_mc = pd.concat(ev_mcs) + ev_mc = ev_mc[ev_mc.prompt] ev_mc = ev_mc[ev_mc.nhit_cal > 100] ev_mc = ev_mc[~np.isnan(ev_mc.fmin)] diff --git a/utils/dm-search b/utils/dm-search index 1d14d05..e24114c 100755 --- a/utils/dm-search +++ b/utils/dm-search @@ -475,7 +475,14 @@ if __name__ == '__main__': ev = correct_energy_bias(ev) - ev_mc = get_events(args.mc, merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False) + # Note: We loop over the MC filenames here instead of just passing the + # whole list to get_events() because I had to rerun some of the MC events + # using SNOMAN and so most of the runs actually have two different files + # and otherwise the GTIDs will clash + ev_mcs = [] + for filename in args.mc: + ev_mcs.append(get_events([filename], merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False)) + ev_mc = pd.concat(ev_mcs) muon_mc = get_events(args.muon_mc, merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False) weights = pd.concat([read_hdf(filename, "weights") for filename in args.weights],ignore_index=True) diff --git a/utils/plot-michels b/utils/plot-michels index ff88315..b2727ca 100755 --- a/utils/plot-michels +++ b/utils/plot-michels @@ -113,7 +113,15 @@ if __name__ == '__main__': evs.append(get_events(df.filename.values, merge_fits=True, nhit_thresh=args.nhit_thresh)) ev = pd.concat(evs) ev = correct_energy_bias(ev) - ev_mc = get_events(args.mc, merge_fits=True, apply_nhit_trigger=False) + + # Note: We loop over the MC filenames here instead of just passing the + # whole list to get_events() because I had to rerun some of the MC events + # using SNOMAN and so most of the runs actually have two different files + # and otherwise the GTIDs will clash + ev_mcs = [] + for filename in args.mc: + ev_mcs.append(get_events([filename], merge_fits=True, nhit_thresh=args.nhit_thresh, apply_nhit_trigger=False)) + ev_mc = pd.concat(ev_mcs) ev_mc = correct_energy_bias(ev_mc) # Drop events without fits -- cgit