aboutsummaryrefslogtreecommitdiff
path: root/utils/sddm/plot_energy.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/sddm/plot_energy.py')
-rw-r--r--utils/sddm/plot_energy.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/sddm/plot_energy.py b/utils/sddm/plot_energy.py
index be13d78..b16e2cd 100644
--- a/utils/sddm/plot_energy.py
+++ b/utils/sddm/plot_energy.py
@@ -42,6 +42,7 @@ TRIG_NHIT_100_MED = 0x00000002
TRIG_NHIT_100_HI = 0x00000004
TRIG_NHIT_20 = 0x00000008
TRIG_NHIT_20_LB = 0x00000010
+TRIG_PULSE_GT = 0x00000400
def unwrap(p, delta, axis=-1):
"""
@@ -591,6 +592,19 @@ def get_events(filenames, merge_fits=False, nhit_thresh=None, mc=False):
ev['signal'] = ~(ev.noise | ev.neck | ev.flasher | ev.breakdown | ev.muon)
ev['instrumental'] = ~ev.signal
+ n_pulse_gt = np.count_nonzero((ev.trg_type & TRIG_PULSE_GT) != 0)
+ # Pulse GT went at approximately 5 Hz for the duration of SNO
+ time_pulse_gt = n_pulse_gt/5.0
+
+ if 'jdy' in ev.columns:
+ # Calculate total time based on 10 MHz clock
+ t10 = ev['jdy']*24*3600 + ev['ut1'] + ev['ut2']/1e9
+ # Note: We don't take the max and min here because there might be bit flips
+ # in the 10 MHz clock
+ time_10_mhz = np.percentile(t10,99.9) - np.percentile(t10,0.1)
+ else:
+ time_10_mhz = np.nan
+
# Try to identify Michel electrons. Currently, the event selection is based
# on Richie's thesis. Here, we do the following:
#
@@ -634,6 +648,14 @@ def get_events(filenames, merge_fits=False, nhit_thresh=None, mc=False):
np.cos(ev_single_particle.theta1)*ev_single_particle.z
ev['udotr'] /= ev_single_particle.r
+ # Yes, this is super hacky, but I don't want to change what's returned from
+ # this function.
+ ev.attrs = {'time_pulse_gt': time_pulse_gt, 'time_10_mhz': time_10_mhz}
+
return ev
+ # Yes, this is super hacky, but I don't want to change what's returned from
+ # this function.
+ ev.attrs = {'time_pulse_gt': time_pulse_gt, 'time_10_mhz': time_10_mhz}
+
return ev, fits