Ejemplo n.º 1
0
        # preallocate number of possible delayed signals:
        number_delayed_signal = 0
        # preallocate first index of npe_per_hittime_del:
        index_first_del = 0
        # preallocate number of pe of delayed signal:
        number_pe_delayed = 0

        # analyze npe_per_hittime_del for possible delayed signals. As long as number_delayed_signal<2 and as long as
        # index has not reached the end of npe_per_hittime_del, check event for possible delayed signals
        while number_delayed_signal < 2 and index_first_del < len(
                npe_per_hittime_del):

            number_delayed, index_first_del, num_pe_delayed, begin_pulse, end_pulse = \
                NC_background_functions.analyze_delayed_signal(npe_per_hittime_del, bins_hittime_del, index_first_del,
                                                               threshold1_del, threshold2_del, min_PE_delayed,
                                                               max_PE_delayed, event_id)

            number_delayed_signal += number_delayed
            number_pe_delayed += num_pe_delayed

        if number_delayed_signal != 1:
            # 0 or more than one delayed signals that pass the delayed energy cut (-> no or more than one neutron
            # capture on hydrogen):
            number_rejected_delayed_energy_cut += 1
            # append npe of delayed signal, that wouldn't pass delayed energy cut to array:
            number_pe_delayed_rejected_array = np.append(
                number_pe_delayed_rejected_array, number_pe_delayed)

        # append number of pe of delayed signal to array:
        number_pe_total_del = np.append(number_pe_total_del, number_pe_delayed)
            hittime_real = hittime_tts - time_of_flight

            # append real hittime to array:
            hittime_array.append(hittime_real)

        # analyze hittime distribution (the same way like in prompt_signal_preselected_evts.py):
        # build histogram, where hittimes are saved:
        # set bin-edges of hittime histogram in ns (whole time window from min_time to max_time):
        bins_hittime = np.arange(min_time, max_time + 2 * binwidth, binwidth)
        # build hittime histogram:
        npe_per_hittime_all, bin_edges_hittime_all = np.histogram(hittime_array, bins_hittime)

        # analyze the whole time window (not only neutron capture time window) for the time cut:
        num_pulses, index_test1, num_of_ncaptures, begin_time_pulse, end_time_pulse = \
            NC_background_functions.analyze_delayed_signal(npe_per_hittime_all, bin_edges_hittime_all, 0,
                                                           threshold1_del, threshold2_del, min_PE_delayed,
                                                           max_PE_delayed, event)

        # do time cut:
        if begin_time_pulse <= time_limit:
            # pulse begins before time_limit:
            number_timecut_rejected += 1
            number_timecut_rejected_min += 1
        elif end_time_pulse >= max_time_ncap:
            # pulse ends after time_limit:
            number_timecut_rejected += 1
            number_timecut_rejected_max += 1
        else:
            # event passes time cut:
            flag_pass_timecut = True
            number_timecut_pass += 1