Example #1
0
                                                 end_time + bin_width,
                                                 bin_width)

                # compare len(time_window_positron) with len(number_pe_per_bin_positron):
                missing_zeros = len(time_window_positron) - len(
                    number_pe_per_bin_positron)

                # append the missing_zeros to number_pe_per_bin_positron:
                number_pe_per_bin_positron = np.pad(number_pe_per_bin_positron,
                                                    (0, missing_zeros),
                                                    'constant',
                                                    constant_values=(0.0, 0.0))

                # analyze the hittime distribution of these event:
                tot_ratio_positron, npe_norm_positron = pulse_shape(
                    time_window_positron, number_pe_per_bin_positron,
                    start_tail[index], stop_tail[index1])

                # append tail-to-total ratio to array:
                array_tot_ratio_positron.append(tot_ratio_positron)

                # append zeros to npe_norm_positron to get a average length of the hittimes:
                npe_norm_positron = np.pad(
                    npe_norm_positron,
                    (0, length_average_hittime - len(npe_norm_positron)),
                    'constant',
                    constant_values=(0.0, 0.0))

                # add the normalized hittime distribution (npe_norm_positron) to the average hittime distribution
                # (hittime_average_positron):
                hittime_average_positron = hittime_average_positron + npe_norm_positron
            time_window_neutron = np.arange(min_time_neutron,
                                            end_time + bin_width, bin_width)

            # compare len(time_window_neutron) with len(number_pe_per_bin_neutron):
            missing_zeros = len(time_window_neutron) - len(
                number_pe_per_bin_neutron)

            # append the missing_zeros to number_pe_per_bin_neutron:
            number_pe_per_bin_neutron = np.pad(number_pe_per_bin_neutron,
                                               (0, missing_zeros),
                                               'constant',
                                               constant_values=(0.0, 0.0))

            # analyze the hittime distribution of these event:
            tot_ratio_neutron, npe_norm_neutron = pulse_shape(
                time_window_neutron, number_pe_per_bin_neutron,
                start_tail[index], stop_tail[index])

            # check if tot-value is not 0:
            if tot_ratio_neutron == 0:
                continue

            # increment number of analyzed events:
            num_events_analyzed_neutron += 1

            # append tail-to-total ratio to array:
            array_tot_ratio_neutron.append(tot_ratio_neutron)

            # append zeros to npe_norm_neutron to get a average length of the hittimes:
            npe_norm_neutron = np.pad(
                npe_norm_neutron,
                        "ERROR: set binwidth ({0:.1f} ns) != binwidth from pulse shape file ({1:.1f} ns)"
                        .format(binwidth, bin_width_IBD))

                # the rest of pulse_shape_data_IBD is the hittime distribution histogram in nPE per bin. Take only the
                # prompt signal defined by start_time and end_time:
                nPE_per_bin_IBD = pulse_shape_data_IBD[6:(int(
                    (end_time + binwidth + np.abs(min_time_IBD)) / binwidth) +
                                                          3)]

                # set the time window corresponding to nPE_per_bin_IBD:
                time_window_IBD = np.arange(min_time_IBD, end_time + binwidth,
                                            binwidth)

                # analyze pulse shape of this event:
                ttr_IBD, npe_norm_IBD = pulse_shape(time_window_IBD,
                                                    nPE_per_bin_IBD,
                                                    start_tail[index],
                                                    stop_tail[index1])

                # append tail-to-total ratio to array:
                array_TTR_IBD.append(ttr_IBD)
                # append filenumber and eventID to arrays:
                filenumber_IBD.append(filenumber)
                evtID_IBD.append(event)

                # append zeros to npe_norm_IBD to get a average length of the hittimes:
                npe_norm_IBD = np.pad(
                    npe_norm_IBD,
                    (0, length_average_hittime - len(npe_norm_IBD)),
                    'constant',
                    constant_values=(0.0, 0.0))