diff options
Diffstat (limited to 'utils/dc-closure-test')
-rwxr-xr-x | utils/dc-closure-test | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/utils/dc-closure-test b/utils/dc-closure-test index b688b0f..c362cdb 100755 --- a/utils/dc-closure-test +++ b/utils/dc-closure-test @@ -442,17 +442,19 @@ if __name__ == '__main__': ev = ev[ev.prompt] ev = ev[ev.nhit_cal > 100] + # Note: Technically we want to know the fitted fraction only for events + # which *would* reconstruct above 20 MeV. However, there is no way to know + # if the energy is above 20 MeV without fitting it. However, since I only + # skip fitting events based on the gtid, there shouldn't be any correlation + # with energy and so the fitted fraction here should be correct. fitted_fraction = {} for bg in ['signal','muon','noise','neck','flasher','breakdown']: if np.count_nonzero(ev[bg]): fitted_fraction[bg] = np.count_nonzero(ev[bg] & ~np.isnan(ev.fmin))/np.count_nonzero(ev[bg]) print("Fitted fraction for %s: %.0f %%" % (bg,fitted_fraction[bg]*100)) - elif bg != 'signal': - print_warning("Warning: No %s events in sample, assuming 10%% fitted fraction" % bg) - fitted_fraction[bg] = 0.1 else: - print_warning("Warning: No signal events in sample, assuming 100%% fitted fraction") - fitted_fraction[bg] = 1.0 + print_warning("Warning: No %s events in sample!" % bg) + sys.exit(1) ev = ev[~np.isnan(ev.fmin)] ev = ev[ev.ke > 20] @@ -464,16 +466,11 @@ if __name__ == '__main__': ev = z_cut(ev) ev = udotr_cut(ev) - ev['noise'] = ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_ITC | DC_ESUM) != 0 - ev['neck'] = ((ev.dc & DC_NECK) != 0) & ~ev.noise - ev['flasher'] = ((ev.dc & DC_FLASHER) != 0) & ~(ev.noise | ev.neck) & (ev.nhit < 1000) - ev['breakdown'] = ((ev.dc & (DC_FLASHER | DC_BREAKDOWN)) != 0) & ~(ev.noise | ev.neck) & (ev.nhit >= 1000) - ev['muon'] = ((ev.dc & DC_MUON) != 0) & ~(ev.noise | ev.neck | ev.flasher | ev.breakdown) - ev['signal'] = ~(ev.noise | ev.neck | ev.flasher | ev.breakdown | ev.muon) - ev_mc = get_events(args.mc, merge_fits=True) 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)] + ev_mc = ev_mc[ev_mc.ke > 20] # figure out bins for high level variables ev_mc = radius_cut(ev_mc) @@ -482,13 +479,6 @@ if __name__ == '__main__': ev_mc = z_cut(ev_mc) ev_mc = udotr_cut(ev_mc) - ev_mc['noise'] = ev_mc.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_ITC | DC_ESUM) != 0 - ev_mc['neck'] = ((ev_mc.dc & DC_NECK) != 0) & ~ev_mc.noise - ev_mc['flasher'] = ((ev_mc.dc & DC_FLASHER) != 0) & ~(ev_mc.noise | ev_mc.neck) & (ev_mc.nhit < 1000) - ev_mc['breakdown'] = ((ev_mc.dc & (DC_FLASHER | DC_BREAKDOWN)) != 0) & ~(ev_mc.noise | ev_mc.neck) & (ev_mc.nhit >= 1000) - ev_mc['muon'] = ((ev_mc.dc & DC_MUON) != 0) & ~(ev_mc.noise | ev_mc.neck | ev_mc.flasher | ev_mc.breakdown) - ev_mc['signal'] = ~(ev_mc.noise | ev_mc.neck | ev_mc.flasher | ev_mc.breakdown | ev_mc.muon) - contamination_pull = {} nbg = {} |