From d9755b85e46d75af024bf731653aac3639339b3a Mon Sep 17 00:00:00 2001 From: tlatorre Date: Fri, 25 Dec 2020 07:14:54 -0600 Subject: don't warn about rhdr banks and 50 MHz clock jumps for MC --- utils/sddm/plot_energy.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/sddm/plot_energy.py b/utils/sddm/plot_energy.py index b1c9314..dae499b 100644 --- a/utils/sddm/plot_energy.py +++ b/utils/sddm/plot_energy.py @@ -165,7 +165,7 @@ def atmospheric_events(ev): ev['atm'] = ev.atm.where(ev.gtid.isin(ev.atm_gtid[ev.atm_gtid > 0].values),other=False) return ev -def gtid_sort(ev, first_gtid): +def gtid_sort(ev, first_gtid, mc=False): """ Adds 0x1000000 to the gtid_sort column for all gtids before the first gtid in a run, which should be passed as a dictionary. This column can then be @@ -188,7 +188,8 @@ def gtid_sort(ev, first_gtid): run = ev.name if run not in first_gtid: - print_warning("No RHDR bank for run %i! Assuming first event is the first GTID." % run) + if not mc: + print_warning("No RHDR bank for run %i! Assuming first event is the first GTID." % run) first_gtid[run] = ev.gtid.iloc[0] ev.loc[ev.gtid < first_gtid[run],'gtid_sort'] += 0x1000000 @@ -530,7 +531,7 @@ def get_events(filenames, merge_fits=False, nhit_thresh=None, mc=False): # in the event and sort on that. We get the first GTID from the RHDR bank. ev['gtid_sort'] = ev['gtid'].copy() - ev = ev.groupby('run',as_index=False).apply(gtid_sort,first_gtid=first_gtid).reset_index(level=0,drop=True) + ev = ev.groupby('run',as_index=False).apply(gtid_sort,first_gtid=first_gtid,mc=mc).reset_index(level=0,drop=True) ev = ev.sort_values(by=['run','gtid_sort'],kind='mergesort') @@ -538,7 +539,7 @@ def get_events(filenames, merge_fits=False, nhit_thresh=None, mc=False): # Warn about 50 MHz clock jumps since they could indicate that the # events aren't in order. dt = np.diff(ev_run.gtr) - if np.count_nonzero((np.abs(dt) > 1e9) & (dt > -0x7ffffffffff*20.0/2)): + if not mc and np.count_nonzero((np.abs(dt) > 1e9) & (dt > -0x7ffffffffff*20.0/2)): print_warning("Warning: %i 50 MHz clock jumps in run %i. Are the events in order?" % \ (np.count_nonzero((np.abs(dt) > 1e9) & (dt > -0x7ffffffffff*20.0/2)),run)) -- cgit