示例#1
0
def InvariantMassComp(particles, weights):
    inv_mass = particles[
        0][:, 0]  # get mass of p_0 (asssume already in rest frame)

    plt.subplot(211)  # left figure
    pt.BWCurveFit(inv_mass,
                  fit_parameters=[0, 5, 1],
                  legend=False,
                  binWidth=0.01,
                  binNum=25,
                  x_axis='$m_{B^{0}}(GeV)$',
                  y_axis='Number of Events',
                  axis=True)
    #pt.Histogram(inv_mass/1000, axis=True, x_axis='$S(GeV)$', y_axis='Number of Events', bins=25)

    plt.subplot(212)  # right figure
    mass, width = pt.BWCurveFit(
        inv_mass,
        weights=weights,
        fit_parameters=[0, 5, 1],
        legend=False,
        binWidth=0.01,
        binNum=25,
        x_axis='$m_{B^{0}}(GeV)$',
        y_axis='Weighted Number of Events',
        axis=True
    )  # fits the weighted distributions and returns the fitted masss and decay width
    return mass, width