Example #1
0
def plot_s1_and_s2(dst):

    #sns.set_style('whitegrid')
    sns.set_style("white")
    sns.set_style("ticks")

    fig = plt.figure(figsize=(15, 6))
    ax = fig.add_subplot(1, 2, 1)
    n, b, _, _ = h1(dst.nS1.values,
                    bins=10,
                    range=(0, 10),
                    histtype='stepfilled',
                    color='steelblue',
                    lbl='nS1')
    plot_histo(PlotLabels('nS1', 'Entries', ''), ax)

    ax = fig.add_subplot(1, 2, 2)
    (_) = h1(dst.nS2.values,
             bins=10,
             range=(0, 10),
             histtype='stepfilled',
             color='crimson',
             lbl='nS2')
    plot_histo(PlotLabels('nS2', 'Entries', ''), ax)

    return n
Example #2
0
def plot_EQ(dst,
            Ebins,
            Eranges,
            Qbins,
            Qranges,
            loc_E='upper right',
            loc_Q='upper left',
            figsize=(14, 10)):
    fig = plt.figure(figsize=figsize)

    ax = fig.add_subplot(2, 2, 1)
    (_) = h1(dst.E,
             bins=Ebins,
             range=Eranges,
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('E per sipm (pes)', 'Entries', ''), ax)
    plt.legend(loc=loc_E)

    ax = fig.add_subplot(2, 2, 2)
    (_) = h1(dst.Q,
             bins=Qbins,
             range=Qranges,
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Q per sipm (pes)', 'Entries', ''), ax)
    plt.legend(loc=loc_Q)
Example #3
0
def plot_e_before_after_sel(dst, dstsel, erange):

    fig = plt.figure(figsize=(14, 6))

    ax = fig.add_subplot(1, 2, 1)
    (_) = h1(
        dst.S2e,
        bins=100,
        range=erange,
        histtype='stepfilled',
        color='crimson',
        #                 (_) = h1(dst.S2e, bins = 100, range = (500,5000), histtype='stepfilled', color='crimson',
        lbl='E (pes)')
    plot_histo(PlotLabels('E (pes)', 'Entries', ''), ax)
    plt.legend(loc='upper left')

    ax = fig.add_subplot(1, 2, 2)
    (_) = h1(dstsel.S2e,
             bins=100,
             range=erange,
             histtype='stepfilled',
             color='crimson',
             lbl='E (pes)')
    plot_histo(PlotLabels('E (pes)', 'Entries', ''), ax)
    plt.legend(loc='upper left')
Example #4
0
def plot_Zcorr(dst, tmin, tmax):

    fig = plt.figure(figsize=(14, 6))
    ax = fig.add_subplot(1, 2, 1)
    (_) = h1(dst.Zcorr,
             bins=100,
             range=(tmin, tmax),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Z (mm)', 'Entries', ''), ax)
    plt.legend(loc='upper left')
Example #5
0
def plot_event_energy(dst, group, Ebins, Eranges, Qbins, Qranges, loc_E='upper right',
                      loc_Q='upper left', figsize=(14,10)):
    """plot event energy when pandas is index by sipm fired (need a group) """

    sns.set_style("white")
    sns.set_style("ticks")

    fig = plt.figure(figsize=figsize)
    
    ax      = fig.add_subplot(2, 2, 1)
    (_) = h1(group.E, bins = Ebins, range = Eranges, histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('E total (pes)','Entries',''), ax)
    plt.legend(loc=loc_E)

    ax      = fig.add_subplot(2, 2, 2)
    (_) = h1(group.Q, bins = Qbins, range = Qranges, histtype='stepfilled',
             color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Q total (pes)','Entries',''), ax)
    plt.legend(loc=loc_Q)
Example #6
0
def plot_wcharged(w, w_cut, wbins = 50, wrange = (0., 1.), loc_E='upper right',
            loc_Q='upper right', figsize=(14,10)):
    """plot w when pandas is index by sipm fired (need a group) """

    sns.set_style("white")
    sns.set_style("ticks")

    fig = plt.figure(figsize=figsize)
    
    ax      = fig.add_subplot(2, 2, 1)
    (_) = h1(w, bins = wbins, range = wrange, histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Weighted charge before cut','Entries',''), ax)
    plt.legend(loc=loc_E)

    ax      = fig.add_subplot(2, 2, 2)
    (_) = h1(w_cut, bins = wbins, range = wrange, histtype='stepfilled',
             color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Weighted charge after cut','Entries',''), ax)
    plt.legend(loc=loc_Q)
Example #7
0
def plot_Z_DT_variables(dst):

    fig = plt.figure(figsize=(14, 6))
    ax = fig.add_subplot(1, 2, 1)
    (_) = h1(dst.Z,
             bins=100,
             range=(0, 400),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Z (mm)', 'Entries', ''), ax)
    plt.legend(loc='upper left')

    ax = fig.add_subplot(1, 2, 2)
    (_) = h1(dst.DT,
             bins=100,
             range=(0, 400),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Drift time (mus)', 'Entries', ''), ax)
    plt.legend(loc='upper left')
Example #8
0
def control_plots_longitudinal_1 (d):

    fig = plt.figure(figsize=(22,14))

    ax      = fig.add_subplot(3, 3, 1)
    nevt = h2(d.wT, d.wVar, 50, 50, [10,300], [0, 5], profile=True)
    labels(PlotLabels(x='weighted mean', y='weighted variance', title=None))

    ax      = fig.add_subplot(3, 3, 2)
    nevt = h2(d.Zmean, d.Zvar, 50, 50, [10,300], [0, 20], profile=True)
    labels(PlotLabels(x='Z mean', y='Non-weighted variance', title=None))

    ax      = fig.add_subplot(3, 3, 3)
    plt.hist(d.wVar[(d.wT>20)&(d.wT<60)], bins = 50, range = [0,5], histtype='stepfilled', color='grey', label='wt=[20,60]')
    plt.legend(loc='upper left')

    plt.hist(d.wVar[(d.wT>100)&(d.wT<140)], bins = 50, range = [0,5], histtype='stepfilled', color='crimson', label = 'wt=[100,140]')
    plot_histo(PlotLabels('weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')

    plt.hist(d.wVar[(d.wT>200)&(d.wT<240)], bins = 50, range = [0,5], histtype='stepfilled', color='cornflowerblue', label='wt=[200,240]')
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 4)
    plt.hist(d.Zvar[(d.Zmean>20)&(d.Zmean<60)], bins = 14, range = [0,15], histtype='stepfilled', color='grey', label='wt=[20,60]')
    plt.legend(loc='upper left')
    plot_histo(PlotLabels('Non-weigthed Variance','Entries',''), ax)

    plt.hist(d.Zvar[(d.Zmean>100)&(d.Zmean<140)], bins = 14, range = [0,15], histtype='stepfilled', color='crimson', alpha=0.6, label='wt=[100,140]')
    plt.legend(loc='upper left')

    plt.hist(d.Zvar[(d.Zmean>200)&(d.Zmean<240)], bins = 14, range = [0,15], histtype='stepfilled', color='cornflowerblue', alpha=0.9, label='wt=[200,240]')
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 5)
    (_) = h1(d.Zmean - d.wT , bins = 49, range = [-1.5,1.5], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Zmean - wT','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 6)
    (_) = h1(d.Zvar - d.wVar, bins = 49, range = [0,10], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Zvar - wVar','Entries',''), ax)
    plt.legend(loc='upper left')
Example #9
0
def control_plots(d):

    fig = plt.figure(figsize=(16,12))

    ax      = fig.add_subplot(3, 3, 1)
    (_) = h1(d.Z, bins = 50, range = [0,300], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Z (taking first entry in pandas, careful)','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 2)
    (_) = h1(d.Etot, bins = 50, range = [3500,6000], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('E per event','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 3)
    (_) = h1(d.ntot, bins = 20, range = [0,20], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Num of slices per event','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 4)
    (_) = h1(d.Zmean, bins = 50, range = [0,300], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Z mean per event','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 5)
    (_) = h1(d.Zvar, bins = 50, range = [0,20], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Z variance (np.var) per event','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 6)
    (_) = h1(d.Zstd, bins = 50, range = [0,5], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Z std (np.std= sqrt(np.var)) per event','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 7)
    (_) = h1(d.wT, bins = 50, range = [0,300], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Weighted by E mean','Entries',''), ax)
    plt.legend(loc='upper left')

    ax      = fig.add_subplot(3, 3, 8)
    (_) = h1(d.wVar, bins = 50, range = [0,20], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Weighted variance','Entries',''), ax)
    plt.legend(loc='upper right')

    ax      = fig.add_subplot(3, 3, 9)
    (_) = h1(d.wStd, bins = 50, range = [0,5], histtype='stepfilled', color='crimson',
                 lbl='')
    plot_histo(PlotLabels('Weighted std','Entries',''), ax)
    plt.legend(loc='upper right')
Example #10
0
def control_plots_longitudinal_2(d):
    
    fig = plt.figure(figsize=(20,16))
    ax      = fig.add_subplot(3, 3, 1)
    (_) = h1(d.wVar[(d.wT>20)&(d.wT<30)], bins = 50, range = [0,5], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')

    ax      = fig.add_subplot(3, 3, 2)
    (_) = h1(d.wVar[(d.wT>50)&(d.wT<70)], bins = 50, range = [0,5], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')

    ax      = fig.add_subplot(3, 3, 3)
    (_) = h1(d.wVar[(d.wT>100)&(d.wT<120)], bins = 50, range = [0,5], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')

    fig = plt.figure(figsize=(20,16))
    ax      = fig.add_subplot(3, 3, 1)
    (_) = h1(d.Zvar[(d.Zmean>20)&(d.Zmean<30)], bins = 50, range = [0,10], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Non-Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')

    ax      = fig.add_subplot(3, 3, 2)
    (_) = h1(d.Zvar[(d.Zmean>50)&(d.Zmean<70)], bins = 50, range = [0,10], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Non-Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')

    ax      = fig.add_subplot(3, 3, 3)
    (_) = h1(d.Zvar[(d.Zmean>100)&(d.Zmean<120)], bins = 50, range = [0,10], histtype='stepfilled', color='crimson',lbl='')
    plot_histo(PlotLabels('Non-Weighted variance','Entries',''), ax)
    plt.legend(loc='upper left')
    ax.set_yscale('log')
Example #11
0
def plot_s1_variables(dst):

    fig = plt.figure(figsize=(15, 15))

    ax = fig.add_subplot(3, 2, 1)
    (_) = h1(dst.S1e,
             bins=100,
             range=(0, 40),
             histtype='stepfilled',
             color='steelblue',
             lbl='')
    plot_histo(PlotLabels('E (pes)', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 2)
    (_) = h1(dst.S1w,
             bins=20,
             range=(0, 500),
             histtype='stepfilled',
             color='steelblue',
             lbl='')
    plot_histo(PlotLabels('Width (mus)', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 3)
    (_) = h1(dst.S1h,
             bins=100,
             range=(0, 10),
             histtype='stepfilled',
             color='steelblue',
             lbl='')
    plot_histo(PlotLabels('height/s1energy', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 4)
    (_) = h1(dst.S1h / dst.S1e,
             bins=100,
             range=(0, 0.6),
             histtype='stepfilled',
             color='steelblue',
             lbl='')
    plot_histo(PlotLabels('height/s1energy', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 5)
    (_) = h1(dst.S1t / units.mus,
             bins=20,
             range=(0, 400),
             histtype='stepfilled',
             color='steelblue',
             lbl='')
    plot_histo(PlotLabels('S1 time mus', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 6)
    plt.hist2d(dst.S1t / units.mus,
               dst.S1e,
               bins=10,
               range=[[0, 500], [0, 30]])
    plt.colorbar()
    ax.set_xlabel(r'S1 time ($\mu$s) ', fontsize=11)  #xlabel
    ax.set_ylabel('S1 height (pes)', fontsize=11)
    plt.grid(True)
Example #12
0
def plot_s2_variables(dst):

    fig = plt.figure(figsize=(14, 14))

    ax = fig.add_subplot(3, 2, 1)
    (_) = h1(dst.S2e,
             bins=100,
             range=(1000, 5000),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('E (pes)', 'Entries', ''), ax)
    plt.legend(loc='upper left')

    ax = fig.add_subplot(3, 2, 2)
    (_) = h1(dst.S2w,
             bins=20,
             range=(0, 20),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Width (mus)', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 3)
    (_) = h1(dst.S2q,
             bins=100,
             range=(0, 350),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Q (pes)', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 4)
    (_) = h1(dst.Nsipm,
             bins=25,
             range=(0, 25),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('num Sipm', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 5)
    (_) = h1(dst.X,
             bins=20,
             range=(-80, 80),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('X (mm)', 'Entries', ''), ax)
    plt.legend(loc='upper right')

    ax = fig.add_subplot(3, 2, 6)
    (_) = h1(dst.Y,
             bins=20,
             range=(-80, 80),
             histtype='stepfilled',
             color='crimson',
             lbl='')
    plot_histo(PlotLabels('Y (mm)', 'Entries', ''), ax)
    plt.legend(loc='upper right')