def plot_2D_Top(bus_vec, df, fig, number_of_detectors, vmin, vmax):
    df_tot = pd.DataFrame()
    for i, bus in enumerate(bus_vec):
        df_clu = df[df.Bus == bus]
        df_clu['wCh'] += (80 * i) + (i // 3) * 80
        df_tot = pd.concat([df_tot, df_clu])
    h, *_ = plt.hist2d(np.floor(df_tot['wCh'] / 20).astype(int) + 1,
                       df_tot['wCh'] % 20 + 1,
                       bins=[12 * number_of_detectors + 8, 20],
                       range=[[0.5, 12 * number_of_detectors + 0.5 + 8],
                              [0.5, 20.5]],
                       norm=LogNorm(),
                       cmap='jet',
                       vmin=vmin,
                       vmax=vmax)
    title = 'Top view'
    locs_x = [1, 12, 17, 28, 33, 44]
    ticks_x = [1, 12, 13, 25, 26, 38]
    xlabel = 'Layer'
    ylabel = 'Wire'
    fig = stylize(fig,
                  xlabel,
                  ylabel,
                  title=title,
                  colorbar=True,
                  locs_x=locs_x,
                  ticks_x=ticks_x)
    plt.colorbar()
    return fig, h
Esempio n. 2
0
def ToF_histogram(df, data_sets, window):
    # Filter clusters
    df = filter_ce_clusters(window, df)
    # Get parameters
    number_bins = int(window.tofBins.text())
    min_val = 0
    max_val = 16667
    # Produce histogram and plot
    fig = plt.figure()
    plt.hist(df.ToF * 62.5e-9 * 1e6,
             bins=number_bins,
             range=[min_val, max_val],
             log=True,
             color='black',
             zorder=4,
             histtype='step',
             label='MG')
    title = 'ToF - histogram\n%s' % data_sets
    x_label = 'ToF [$\mu$s]'
    y_label = 'Counts'
    fig = stylize(fig,
                  x_label=x_label,
                  y_label=y_label,
                  title=title,
                  yscale='log',
                  grid=True)
    return fig
 def plot_2D_bus(fig, sub_title, ce, vmin, vmax, duration):
     h, *_ = plt.hist2d(ce.wCh,
                        ce.gCh,
                        bins=[80, 40],
                        range=[[-0.5, 79.5], [79.5, 119.5]],
                        vmin=vmin,
                        vmax=vmax,
                        norm=LogNorm(),
                        cmap='jet')
     xlabel = 'Wire [Channel number]'
     ylabel = 'Grid [Channel number]'
     fig = stylize(fig, xlabel, ylabel, title=sub_title, colorbar=True)
     plt.colorbar()
     return fig, h
Esempio n. 4
0
 def PHS_2D_plot_bus(fig, events, sub_title, vmin, vmax):
     xlabel = 'Channel'
     ylabel = 'Charge [ADC channels]'
     bins = [120, 120]
     fig = stylize(fig, xlabel, ylabel, title=sub_title, colorbar=True)
     plt.hist2d(events.Channel,
                events.ADC,
                bins=bins,
                norm=LogNorm(),
                range=[[-0.5, 119.5], [0, 4400]],
                vmin=vmin,
                vmax=vmax,
                cmap='jet')
     plt.colorbar()
     return fig
Esempio n. 5
0
 def charge_scatter(fig, ce, sub_title, bus, vmin, vmax):
     xlabel = 'Collected charge wires [ADC channels]'
     ylabel = 'Collected charge grids [ADC channels]'
     bins = [200, 200]
     ADC_range = [[0, 5000], [0, 5000]]
     fig = stylize(fig, xlabel, ylabel, title=sub_title, colorbar=True)
     plt.hist2d(ce.wADC,
                ce.gADC,
                bins=bins,
                norm=LogNorm(),
                range=ADC_range,
                vmin=vmin,
                vmax=vmax,
                cmap='jet')
     plt.colorbar()
     return fig
Esempio n. 6
0
def PHS_1D_plot(events, data_sets, window):
    # Declare parameters
    number_bins = int(window.phsBins.text())
    Channel = window.Channel.value()
    Bus = window.Module.value()
    # Plot
    fig = plt.figure()
    title = ('PHS (1D) - Channel: %d, Bus: %d\nData set(s): %s' %
             (Channel, Bus, data_sets))
    xlabel = 'Counts'
    ylabel = 'Collected charge [ADC channels]'
    fig = stylize(fig, xlabel, ylabel, title, yscale='log', grid=True)
    plt.hist(events[(events.Channel == Channel) & (events.Bus == Bus)].ADC,
             bins=number_bins,
             range=[0, 4400],
             histtype='step',
             color='black',
             zorder=5)
    return fig
def plot_2D_Side(bus_vec, df, fig, number_of_detectors, vmin, vmax):

    df_tot = pd.DataFrame()
    for i, bus in enumerate(bus_vec):
        df_clu = df[df.Bus == bus]
        df_clu['gCh'] += (-80 + 1)
        df_tot = pd.concat([df_tot, df_clu])
    h, *_ = plt.hist2d(df_tot['wCh'] % 20 + 1,
                       df_tot['gCh'],
                       bins=[20, 40],
                       range=[[0.5, 20.5], [0.5, 40.5]],
                       norm=LogNorm(),
                       cmap='jet',
                       vmin=vmin,
                       vmax=vmax)

    title = 'Side view'
    xlabel = 'Wire'
    ylabel = 'Grid'
    fig = stylize(fig, xlabel, ylabel, title=title, colorbar=True)
    plt.colorbar()
    return fig, h