aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-energy
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2020-06-15 01:02:12 -0500
committertlatorre <tlatorre@uchicago.edu>2020-06-15 01:02:12 -0500
commit9d2e3acc7e3b557956ed4159231e57df9ca9c3ff (patch)
treea98b2f817dec0b01c4e5f9938345a05239192b41 /utils/plot-energy
parent05e2c30daa482330f1449d6934e482dcc5d7dbf6 (diff)
downloadsddm-9d2e3acc7e3b557956ed4159231e57df9ca9c3ff.tar.gz
sddm-9d2e3acc7e3b557956ed4159231e57df9ca9c3ff.tar.bz2
sddm-9d2e3acc7e3b557956ed4159231e57df9ca9c3ff.zip
create new plot-dc script to replace plot-energy --dc
Diffstat (limited to 'utils/plot-energy')
-rwxr-xr-xutils/plot-energy69
1 files changed, 0 insertions, 69 deletions
diff --git a/utils/plot-energy b/utils/plot-energy
index ff36a19..ede0613 100755
--- a/utils/plot-energy
+++ b/utils/plot-energy
@@ -24,10 +24,6 @@ electrons, atmospheric events with neutron followers, and prompt signal like
events. Each of these plots will have a different subplot for the particle ID
of the best fit, i.e. single electron, single muon, double electron, electron +
muon, or double muon.
-
-When run with the --dc command line argument it instead produces corner plots
-showing the distribution of the high level variables used in the contamination
-analysis for all the different instrumental backgrounds and external muons.
"""
from __future__ import print_function, division
import numpy as np
@@ -109,7 +105,6 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser("plot fit results")
parser.add_argument("filenames", nargs='+', help="input files")
- parser.add_argument("--dc", action='store_true', default=False, help="plot corner plots for backgrounds")
parser.add_argument("--save", action='store_true', default=False, help="save corner plots for backgrounds")
args = parser.parse_args()
@@ -119,70 +114,6 @@ if __name__ == '__main__':
ev, fits = get_events(args.filenames)
- if args.dc:
- ev = ev[ev.prompt]
-
- ev.set_index(['run','gtid'])
-
- ev = pd.merge(fits,ev,how='inner',on=['run','gtid'])
- ev_single_particle = ev[(ev.id2 == 0) & (ev.id3 == 0)]
- ev_single_particle = ev_single_particle.sort_values('fmin').groupby(['run','gtid']).nth(0)
- ev = ev.sort_values('fmin').groupby(['run','gtid']).nth(0)
-
- ev['cos_theta'] = np.cos(ev['theta1'])
- ev['udotr'] = np.sin(ev_single_particle.theta1)*np.cos(ev_single_particle.phi1)*ev_single_particle.x + \
- np.sin(ev_single_particle.theta1)*np.sin(ev_single_particle.phi1)*ev_single_particle.y + \
- np.cos(ev_single_particle.theta1)*ev_single_particle.z
- ev['udotr'] /= ev.r
-
- flashers = ev[ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_FLASHER | DC_NECK | DC_ITC | DC_BREAKDOWN) == DC_FLASHER]
- muon = ev[ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_FLASHER | DC_NECK | DC_ITC | DC_BREAKDOWN | DC_MUON) == DC_MUON]
- neck = ev[(ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_NECK)) == DC_NECK]
- noise = ev[(ev.dc & (DC_ITC | DC_QVNHIT | DC_JUNK | DC_CRATE_ISOTROPY)) != 0]
- breakdown = ev[ev.nhit >= 1000]
- breakdown = breakdown[breakdown.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_NECK | DC_ITC) == 0]
- breakdown = breakdown[breakdown.dc & (DC_FLASHER | DC_BREAKDOWN) != 0]
- signal = ev[ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_FLASHER | DC_NECK | DC_ITC | DC_BREAKDOWN | DC_MUON) == 0]
-
- with pd.option_context('display.max_rows', None, 'display.max_columns', None):
- print("Noise events")
- print(noise[['psi','x','y','z','id1','id2']])
- print("Muons")
- print(muon[['psi','r','id1','id2','id3','energy1','energy2','energy3']])
- print("Neck")
- print(neck[neck.psi < 6][['psi','r','id1','cos_theta']])
- print("Flashers")
- print(flashers[flashers.udotr > 0])
- print("Signal")
- print(signal)
-
- # save as PDF b/c EPS doesn't support alpha values
- if args.save:
- plot_corner_plot(breakdown,"Breakdowns",save="breakdown_corner_plot")
- plot_corner_plot(muon,"Muons",save="muon_corner_plot")
- plot_corner_plot(flashers,"Flashers",save="flashers_corner_plot")
- plot_corner_plot(neck,"Neck",save="neck_corner_plot")
- plot_corner_plot(noise,"Noise",save="noise_corner_plot")
- plot_corner_plot(signal,"Signal",save="signal_corner_plot")
- else:
- plot_corner_plot(breakdown,"Breakdowns")
- plot_corner_plot(muon,"Muons")
- plot_corner_plot(flashers,"Flashers")
- plot_corner_plot(neck,"Neck")
- plot_corner_plot(noise,"Noise")
- plot_corner_plot(signal,"Signal")
-
- fig = plt.figure()
- plot_hist2(flashers)
- despine(fig,trim=True)
- plt.suptitle("Flashers")
- fig = plt.figure()
- plot_hist2(muon,muons=True)
- despine(fig,trim=True)
- plt.suptitle("Muons")
- plt.show()
- sys.exit(0)
-
# First, do basic data cleaning which is done for all events.
ev = ev[ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_FLASHER | DC_NECK | DC_ITC | DC_BREAKDOWN) == 0]