def Ti_histogram(T13, T23, bins=None, range_T13=None, range_T23=None, norm = None, legend = '', title = '', figlabel = '', save_fig = False): plot_functions.histogram(T23, "$T_{23} [ns]$", "entries/bin", bins=bins, range=range_T23, f = False, title = title , legend = legend) if save_fig == True: plt.savefig('plot/T23%s.pdf' % figlabel, format = 'pdf') plot_functions.histogram(T13, "$T_{13} [ns]$", "entries/bin", bins = bins, range=range_T23, f = False, title = title, legend = legend) if save_fig == True: plt.savefig('plot/T13%s.pdf' % figlabel, format = 'pdf') plot_functions.hist2d(T23, T13, "$T_{23} [ns]$", "$T_{13} [ns]$", bins=bins, range_x = range_T23, range_y = range_T13, norm = norm, title = title , legend = legend ) if save_fig == True: plt.savefig('plot/T13_T23%s.pdf' % figlabel, format = 'pdf') r, p = pearsonr(T23, T13) print("r, p T23 and T13:", r, p) return
def tof_beta_histogram(TOF, T12, x, l, beta, bins=None, range_TOF=(-5, 20.), range_T12=None, range_x = (-20., 300.), range_beta = (0., 3.), legend = '', title = '', figlabel = '', save_fig = False): plot_functions.histogram(TOF, "TOF[ns]", "entries/bin", bins = bins, range = range_TOF, f = False, title = title, legend = legend) if save_fig is True: plt.savefig('plot/TOF%s.pdf' % figlabel, format = 'pdf') plot_functions.histogram(T12, "T12[ns]", "entries/bin", bins = bins, range = range_T12, f = False, title = title, legend = legend) if save_fig is True: plt.savefig('plot/T12%s.pdf' % figlabel, format = 'pdf') plot_functions.histogram(x, "x [cm]", "entries/bin", bins=bins , range = range_x, f = False, title = title, legend = legend) if save_fig is True: plt.savefig('plot/x%s.pdf' % figlabel, format = 'pdf') plot_functions.histogram(beta, "$beta [cm/ns]$", "entries/bin", bins= bins , range = range_beta, f = False, title = title, legend = legend) if save_fig is True: plt.savefig('plot/beta%s.pdf' % figlabel, format = 'pdf') plot_functions.hist2d(TOF, l, "TOF [ns]", "l[cm]", bins=bins, range_x = range_TOF, range_y = (110., 280.), norm = LogNorm()) if save_fig is True: plt.savefig('plot/tof_l_2dhist%s.pdf' % figlabel, format = 'pdf') return
plot_functions.multiple_histogram(theta[mask], phi[mask], "theta[mask]", "phi[mask]", bins=45, range_var1=(-numpy.pi, numpy.pi), range_var2=(0., numpy.pi * 2)) plot_functions.multiple_histogram(x3, y3, "x3", "y3", bins=45) plot_functions.multiple_histogram(x3[mask], y3[mask], "x3[mask]", "y3[mask]", bins=45) plot_functions.multiple_histogram(x1, y1, "x1", "y1", bins=45) plot_functions.multiple_histogram(x1[mask], y1[mask], "x1[mask]", "y1[mask]", bins=45) plot_functions.histogram(E[mask], "E[mask]", "", bins=None, range=(0., 1000), f=False, density=False, title='', legend='') plt.ion() plt.show()
options = vars(options_parser.parse_args()) input_file_sim = options['input_file_simulation'] save_fig = options['save_fig'] position = options['s3_position'] E, P, beta, x1, y1, theta, phi, x3, y3, f = numpy.loadtxt(input_file_sim, unpack=True) mask = (f == 1) title = 'Simulazione Monte Carlo per x = %d cm ' % position range = (position - 20., position + 20.) plot_functions.histogram(x1[mask] * 100, "$x_{t}$[cm]", "entries/bin", bins=150, range=range, f=False, density=False, title=title, legend='') delay_T13 = 26.1 delay_T23 = 26.2 res = 0. TOF_sim = signal_propagation_functions.Time_Of_Flight( x1[mask], x3[mask], y1[mask], y3[mask], 0., beta[mask]) T13_sim, _ = signal_propagation_functions.DT_13(x1[mask], x3[mask], y3[mask], delay_T13, TOF_sim,
#E[MeV], P [MeV], beta, x1[m], y1[cm], theta, phi, x3[m], y3[cm], flag E, P, beta, x1, y1, theta, phi, x3, y3, f = numpy.loadtxt(input_file, unpack=True) mask = f > 0.5 print("efficienza/tot:", numpy.sum(f), len(f)) delay_T13 = numpy.ones(int(numpy.sum(f))) * 25.0 #ns delay_T23 = numpy.ones(int(numpy.sum(f))) * 25.1 #ns delay_T12 = delay_T13 z_13 = 1.22 if (plot_flag == True): plot_functions.histogram(E, 'E [MeV]', "entries/bin", bins=70, range=(150., 3000), f=False, title='Spettro degli eventi generati', density=False) plot_functions.multiple_histogram(theta, phi, '$\Theta[rad]$', "$\Phi[rad]$", bins=70, range_var1=(-numpy.pi, numpy.pi), range_var2=(0., numpy.pi * 2), title='') plot_functions.multiple_histogram(theta[mask], phi[mask], "$\Theta_{S3}[rad]$",