Exemplo n.º 1
0
def main():

    nentries = 1000000
    B0_mass = 5.27955  # All masses are given in GeV/c^2
    Jpsi_mass = 3.0969
    K_mass = 0.493677
    pi_mass = 0.13957061
    mu_mass = 0.1056583745
    if len(sys.argv) > 1:
        nentries = int(sys.argv[1])

    B0 = hypy.Vector4R(B0_mass, 0.0, 0.0, 0.0)
    masses1 = [Jpsi_mass, K_mass, pi_mass]  # List of daughter particles
    masses2 = [mu_mass, mu_mass]  # List of grand-daughter particles

    phsp1 = hypy.PhaseSpace3(masses1)
    phsp2 = hypy.PhaseSpace2(masses2)

    #     Device    #

    daughters_d = hypy.host_events_3(nentries)
    grand_daughters_d = hypy.host_events_2(nentries)
    start = time.time()

    phsp1.GenerateOnhost(B0, daughters_d)
    phsp2.GenerateOnhost(daughters_d.getDaughters(0), grand_daughters_d)

    end = time.time()

    print('\n' * 2)
    print("------------------ Host -----------------")
    print("| B0 -> J/psi K pi | J/psi -> mu+ mu-")
    print("| Number of events :", nentries)
    print("| Time (ms)        :", end - start)
    print("-----------------------------------------")

    for i in range(10):
        print(daughters_d[i], grand_daughters_d[i])

    #     Host    #

    daughters_h = hypy.host_events_3(nentries)
    grand_daughters_h = hypy.host_events_2(nentries)
    start = time.time()

    phsp1.GenerateOnhost(B0, daughters_h)
    phsp2.GenerateOnhost(daughters_h.getDaughters(0), grand_daughters_h)

    end = time.time()

    print('\n' * 2)
    print("----------------- Device ----------------")
    print("| B0 -> J/psi K pi | J/psi -> mu+ mu-")
    print("| Number of events :", nentries)
    print("| Time (ms)        :", end - start)
    print("-----------------------------------------")

    for i in range(10):
        print(daughters_h[i], grand_daughters_h[i])
Exemplo n.º 2
0
def main():

    nentries = 1000000
    B0_mass = 5.27955  # All masses are given in GeV/c^2
    Jpsi_mass = 3.0969
    K_mass = 0.493677
    pi_mass = 0.13957061
    if len(sys.argv) > 1:
        nentries = int(sys.argv[1])

    B0 = hypy.Vector4R(B0_mass, 0.0, 0.0, 0.0)
    masses = [Jpsi_mass, K_mass, pi_mass]  # List of final-state particles
    phsp = hypy.PhaseSpace3(masses)

    #     Device    #
    events_d = hypy.device_events_3(nentries)
    start = time.time()
    phsp.GenerateOndevice(B0, events_d)
    end = time.time()

    print('\n' * 2)
    print("----------------- Device ----------------")
    print("| B0 -> J/psi K pi")
    print("| Number of events :", nentries)
    print("| Time (ms)        :", end - start)
    print("-----------------------------------------")

    for i in range(10):
        print(events_d[i])

    #     Host    #
    events_h = hypy.host_events_3(nentries)
    start = time.time()
    phsp.GenerateOnhost(B0, events_h)
    end = time.time()

    print('\n' * 2)
    print("------------------ Host -----------------")
    print("| B0 -> J/psi K pi")
    print("| Number of events :", nentries)
    print("| Time (ms)        :", end - start)
    print("-----------------------------------------")

    for i in range(10):
        print(events_h[i])
Exemplo n.º 3
0
    def test_generator_2(self):
        nentries = 5
        B0_mass = 5.27955
        Jpsi_mass = 3.0969
        K_mass = 0.493677
        pi_mass = 0.13957061
        mu_mass = 0.1056583745

        B0 = hypy.Vector4R(B0_mass, 0.0, 0.0, 0.0)
        masses1 = [Jpsi_mass, K_mass, pi_mass]
        masses2 = [mu_mass, mu_mass]

        phsp1 = hypy.PhaseSpace3(B0_mass, masses1)
        phsp2 = hypy.PhaseSpace2(Jpsi_mass, masses2)

        daughters_d = hypy.host_events_3(nentries)
        grand_daughters_d = hypy.host_events_2(nentries)

        phsp1.GenerateOnhost(B0, daughters_d)
        phsp2.GenerateOnhost(daughters_d.getDaughters(0), grand_daughters_d)