diff --git a/orcasong/hits_to_histograms.py b/orcasong/hits_to_histograms.py index e150db5eceedd1de466fe00cfb69adfc39761c36..e7d5191318ed35124de33814ed2d96f9bf15ebab 100644 --- a/orcasong/hits_to_histograms.py +++ b/orcasong/hits_to_histograms.py @@ -40,19 +40,24 @@ def get_time_parameters(event_hits, mode=('trigger_cluster', 'all'), t_start_mar t = t[triggered == 1] t_mean = np.mean(t, dtype=np.float64) - if mode[1] == 'tight_1': - # make a tighter cut, 12.5ns / bin + if mode[1] == 'tight_0': + # make a tighter cut, 9.5ns / bin with 100 bins, useful for ORCA 115l mupage events + t_start = t_mean - 450 # trigger-cluster - 350ns + t_end = t_mean + 500 # trigger-cluster + 850ns + + elif mode[1] == 'tight_1': + # make a tighter cut, 12.5ns / bin with 60 bins t_start = t_mean - 250 # trigger-cluster - 350ns t_end = t_mean + 500 # trigger-cluster + 850ns elif mode[1] == 'tight_2': - # make an even tighter cut, 5.8ns / bin + # make an even tighter cut, 5.8ns / bin with 60 bins t_start = t_mean - 150 # trigger-cluster - 150ns t_end = t_mean + 200 # trigger-cluster + 200ns else: - assert mode[1] == 'all' - # include nearly all mc_hits from muon-CC and elec-CC, 20ns / bin + assert mode[1] == 'all' # 'all' refers to the common time range of neutrino events in 115l ORCA + # include nearly all mc_hits from muon-CC and elec-CC, 20ns / bin with 60 bins t_start = t_mean - 350 # trigger-cluster - 350ns t_end = t_mean + 850 # trigger-cluster + 850ns diff --git a/orcasong/tests/timecut_test/plots/elec-CC/.gitkeep b/orcasong/tests/timecut_test/plots/elec-CC/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/orcasong/tests/timecut_test/plots/elec-CC/.gitkeep @@ -0,0 +1 @@ + diff --git a/orcasong/tests/timecut_test/plots/muon-CC/.gitkeep b/orcasong/tests/timecut_test/plots/muon-CC/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/orcasong/tests/timecut_test/plots/muon-CC/.gitkeep @@ -0,0 +1 @@ + diff --git a/orcasong/tests/timecut_test/plots/mupage/.gitkeep b/orcasong/tests/timecut_test/plots/mupage/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/orcasong/tests/timecut_test/plots/mupage/.gitkeep @@ -0,0 +1 @@ + diff --git a/orcasong/tests/timecut_test/plots/random_noise/.gitkeep b/orcasong/tests/timecut_test/plots/random_noise/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/orcasong/tests/timecut_test/plots/random_noise/.gitkeep @@ -0,0 +1 @@ + diff --git a/orcasong/tests/timecut_test/plots/tau-CC/.gitkeep b/orcasong/tests/timecut_test/plots/tau-CC/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/orcasong/tests/timecut_test/plots/tau-CC/.gitkeep @@ -0,0 +1 @@ + diff --git a/orcasong/tests/timecut_test/timecut_test.py b/orcasong/tests/timecut_test/timecut_test.py index a6c6033a60c7a53330377732d09ca171d19f24b7..352e30a2463e5ed3f0a449e84487ddaaa7761e67 100644 --- a/orcasong/tests/timecut_test/timecut_test.py +++ b/orcasong/tests/timecut_test/timecut_test.py @@ -3,6 +3,8 @@ import numpy as np import km3pipe as kp +import matplotlib as mpl +mpl.use('Agg') import matplotlib.pyplot as plt @@ -141,7 +143,7 @@ def plot_mc_hits(savestr='', mean=''): plt.xlabel('MC-Hit time minus mean time of all triggered hits [ns]') plt.ylabel('Number of hits [#]') - title = plt.title('MC-Hit time pattern for tau-neutrino-CC events') + title = plt.title('MC-Hit time pattern for ', savestr, ' events') title.set_position([.5, 1.04]) plt.axvline(x=-250, color='black', linestyle='--', label='Timecut 1') plt.axvline(x=500, color='black', linestyle='--') @@ -156,27 +158,34 @@ def plot_mc_hits(savestr='', mean=''): if __name__ == '__main__': - ptype = 'tau-CC' + ptype = 'mupage' + + if ptype == 'mupage': + path = '/home/saturn/capn/mppi033h/Data/raw_data/mupage/' + elif ptype == 'random_noise': + path = '/home/saturn/capn/mppi033h/Data/raw_data/random_noise/' + else: + path = '/home/woody/capn/mppi033h/Data/ORCA_JTE_NEMOWATER/raw_data/h5/calibrated/with_run_id/' + ptype + '/3-100GeV/' - #path = '/home/woody/capn/mppi033h/Data/ORCA_JTE_NEMOWATER/raw_data/h5/calibrated/without_run_id/' + ptype + '/3-100GeV/' - path = '/home/woody/capn/mppi033h/Data/ORCA_JTE_NEMOWATER/raw_data/h5/calibrated/with_run_id/' + ptype + '/3-100GeV/' filenames = {'muon-CC': 'JTE.KM3Sim.gseagen.muon-CC.3-100GeV-9.1E7-1bin-3.0gspec.ORCA115_9m_2016.99.h5', 'elec-CC': 'JTE.KM3Sim.gseagen.elec-CC.3-100GeV-1.1E6-1bin-3.0gspec.ORCA115_9m_2016.99.h5', - 'tau-CC': 'tau-CC_sample.h5'} + 'tau-CC': 'tau-CC_sample.h5', + 'mupage': 'JTE.ph.ph.mupage.ph.ph.ph.ORCA115_9m_2016.99.h5', + 'random_noise': ''} filename_input = path + filenames[ptype] - # # centered with trigg hits mean - # get_time_array(filename_input, savestr=ptype) - # plot(savestr=ptype) - # - # # centered with mc_hits mean - # get_time_array_mc_hits(filename_input, savestr=ptype) - # plot_mc_hits(savestr=ptype) + # centered with trigg hits mean + get_time_array(filename_input, savestr=ptype) + plot(savestr=ptype) + + # centered with mc_hits mean + get_time_array_mc_hits(filename_input, savestr=ptype) + plot_mc_hits(savestr=ptype) # centered mc_hits with trigg hits mean for each event - #mean_triggered_time = np.load(ptype + '_mean_triggered_time_arr_each_event.npy') - #print mean_triggered_time - #get_time_array_mc_hits(filename_input, savestr=ptype, mean=('trigger', mean_triggered_time)) + mean_triggered_time = np.load(ptype + '_mean_triggered_time_arr_each_event.npy') + print(mean_triggered_time) + get_time_array_mc_hits(filename_input, savestr=ptype, mean=('trigger', mean_triggered_time)) plot_mc_hits(savestr=ptype, mean='triggered')