def update(self): self.player.update() for object in self.groups.emitters: particle = Particle(10, 10, random.randrange(-1, 2), random.randrange(-5, -2), object, 50, (255, 255, 255), 0.1) self.groups.addtogroup(particle, self.groups.particles) for p in self.groups.particles: p.update() if p.shoulddie: p.kill() if self.fps: self.fpsmeter.text = str(round(self.clock.get_fps(), 2)) + " FPS" self.fpsmeter.update()
elif type_ == 2: x = WIDTH + 5 skull = SkullCircle(x, y, type_, death_color, win) skull_group.add(skull) score_msg.update(score) particle_group.update() skull_group.update() p.update(color, player_alive) tile_group.update() if pygame.sprite.spritecollide(p, skull_group, False) and player_alive: deadly_tile_fx.play() x, y = p.x, p.y for i in range(20): particle = Particle(x, y, color, win) particle_group.add(particle) player_alive = False skull_group.empty() if player_alive: for tile in tile_group: collision = tile.check_collision(p) if collision and target_tile: if tile.is_deadly_tile: deadly_tile_fx.play() for i in range(30): particle = Particle(x, y, color, win) particle_group.add(particle) player_alive = False if tile.is_target_tile:
def __init__(self, mass, mixing_angle_square): # add model label? self.mass = mass self.mixing_angle_square = mixing_angle_square # define the HNL hnl = Particle('hnl', 'lepton', self.mass) # get the model V_el_square = self.mixing_angle_square V_mu_square = self.mixing_angle_square V_tau_square = self.mixing_angle_square # list of the decays of interest # leptonic self.B_to_eHNL = Decay(B_meson, el, hnl, V_el_square, Vub_pdg, 'leptonic') self.Bc_to_eHNL = Decay(B_sub_c_meson, el, hnl, V_el_square, Vcb_pdg, 'leptonic') self.D_to_eHNL = Decay(D_meson, el, hnl, V_el_square, Vcd_pdg, 'leptonic') self.Ds_to_eHNL = Decay(D_sub_s_meson, el, hnl, V_el_square, Vcs_pdg, 'leptonic') self.B_to_uHNL = Decay(B_meson, mu, hnl, V_mu_square, Vub_pdg, 'leptonic') self.Bc_to_uHNL = Decay(B_sub_c_meson, mu, hnl, V_mu_square, Vcb_pdg, 'leptonic') self.D_to_uHNL = Decay(D_meson, mu, hnl, V_mu_square, Vcd_pdg, 'leptonic') self.Ds_to_uHNL = Decay(D_sub_s_meson, mu, hnl, V_mu_square, Vcs_pdg, 'leptonic') self.B_to_tHNL = Decay(B_meson, tau, hnl, V_tau_square, Vub_pdg, 'leptonic') self.Bc_to_tHNL = Decay(B_sub_c_meson, tau, hnl, V_tau_square, Vcb_pdg, 'leptonic') self.D_to_tHNL = Decay(D_meson, tau, hnl, V_tau_square, Vcd_pdg, 'leptonic') self.Ds_to_tHNL = Decay(D_sub_s_meson, tau, hnl, V_tau_square, Vcs_pdg, 'leptonic') # semileptonic into pseudoscalar meson self.B_to_D0eHNL = Decay(B_meson, [D0_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.B_to_pi0eHNL = Decay(B_meson, [pi0_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_pieHNL = Decay(B0_meson, [pi_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_DeHNL = Decay(B0_meson, [D_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.Bs_to_KeHNL = Decay(B_sub_s_meson, [K_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='Bs_to_K') self.Bs_to_DseHNL = Decay(B_sub_s_meson, [D_sub_s_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.D_to_K0eHNL = Decay(D_meson, [K0_meson, el], hnl, V_el_square, Vcs_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_K') self.D_to_pi0eHNL = Decay(D_meson, [pi0_meson, el], hnl, V_el_square, Vcd_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_pi') self.D0_to_pieHNL = Decay(D0_meson, [pi_meson, el], hnl, V_el_square, Vcd_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_pi') self.D0_to_KeHNL = Decay(D0_meson, [K_meson, el], hnl, V_el_square, Vcs_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_K') self.B_to_D0uHNL = Decay(B_meson, [D0_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.B_to_pi0uHNL = Decay(B_meson, [pi0_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_piuHNL = Decay(B0_meson, [pi_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_DuHNL = Decay(B0_meson, [D_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.Bs_to_KuHNL = Decay(B_sub_s_meson, [K_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='Bs_to_K') self.Bs_to_DsuHNL = Decay(B_sub_s_meson, [D_sub_s_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.D_to_K0uHNL = Decay(D_meson, [K0_meson, mu], hnl, V_mu_square, Vcs_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_K') self.D_to_pi0uHNL = Decay(D_meson, [pi0_meson, mu], hnl, V_mu_square, Vcd_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_pi') self.D0_to_piuHNL = Decay(D0_meson, [pi_meson, mu], hnl, V_mu_square, Vcd_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_pi') self.D0_to_KuHNL = Decay(D0_meson, [K_meson, mu], hnl, V_mu_square, Vcs_pdg, 'semileptonic_pseudoscalar', formFactorLabel='D_to_K') self.B_to_D0tHNL = Decay(B_meson, [D0_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.B_to_pi0tHNL = Decay(B_meson, [pi0_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_pitHNL = Decay(B0_meson, [pi_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_pi') self.B0_to_DtHNL = Decay(B0_meson, [D_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') self.Bs_to_KtHNL = Decay(B_sub_s_meson, [K_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_pseudoscalar', formFactorLabel='Bs_to_K') self.Bs_to_DstHNL = Decay(B_sub_s_meson, [D_sub_s_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_pseudoscalar', formFactorLabel='B_to_D') # semileptonic into vector meson self.B_to_rho0eHNL = Decay(B_meson, [rho0_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.B_to_D0stareHNL = Decay(B_meson, [D0star_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_DstareHNL = Decay(B0_meson, [Dstar_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_rhoeHNL = Decay(B0_meson, [rho_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.Bs_to_DsstareHNL = Decay(B_sub_s_meson, [D_sub_sstar_meson, el], hnl, V_el_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Dsstar') self.Bs_to_KstareHNL = Decay(B_sub_s_meson, [Kstar_meson, el], hnl, V_el_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Kstar') self.D_to_K0stareHNL = Decay(D_meson, [K0star_meson, el], hnl, V_el_square, Vcs_pdg, 'semileptonic_vector', formFactorLabel='D_to_Kstar') self.D0_to_KstareHNL = Decay(D0_meson, [Kstar_meson, el], hnl, V_el_square, Vcs_pdg, 'semileptonic_vector', formFactorLabel='D_to_Kstar') self.B_to_rho0uHNL = Decay(B_meson, [rho0_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.B_to_D0staruHNL = Decay(B_meson, [D0star_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_DstaruHNL = Decay(B0_meson, [Dstar_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_rhouHNL = Decay(B0_meson, [rho_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.Bs_to_DsstaruHNL = Decay(B_sub_s_meson, [D_sub_sstar_meson, mu], hnl, V_mu_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Dsstar') self.Bs_to_KstaruHNL = Decay(B_sub_s_meson, [Kstar_meson, mu], hnl, V_mu_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Kstar') self.D_to_K0staruHNL = Decay(D_meson, [K0star_meson, mu], hnl, V_mu_square, Vcs_pdg, 'semileptonic_vector', formFactorLabel='D_to_Kstar') self.D0_to_KstaruHNL = Decay(D0_meson, [Kstar_meson, mu], hnl, V_mu_square, Vcs_pdg, 'semileptonic_vector', formFactorLabel='D_to_Kstar') self.B_to_rho0tHNL = Decay(B_meson, [rho0_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.B_to_D0startHNL = Decay(B_meson, [D0star_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_DstartHNL = Decay(B0_meson, [Dstar_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='B_to_Dstar') self.B0_to_rhotHNL = Decay(B0_meson, [rho_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='B_to_rho') self.Bs_to_DsstartHNL = Decay(B_sub_s_meson, [D_sub_sstar_meson, tau], hnl, V_tau_square, Vcb_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Dsstar') self.Bs_to_KstartHNL = Decay(B_sub_s_meson, [Kstar_meson, tau], hnl, V_tau_square, Vub_pdg, 'semileptonic_vector', formFactorLabel='Bs_to_Kstar')
fraction_B_sub_c = 0.001 # CKM matrix elements Vud_pdg = 0.97417 Vus_pdg = 0.2248 Vub_pdg = 0.00409 Vcb_pdg = 40.5e-3 Vcd_pdg = 0.220 Vcs_pdg = 0.995 ## PARTICLES ## # beauty mesons B_meson = Particle('B_meson', 'meson', m_B_pdg, dc_B, lifetime_B, fraction=fraction_B) B0_meson = Particle('B0_meson', 'meson', m_B0_pdg, lifetime=lifetime_B0, fraction=fraction_B0) B_sub_c_meson = Particle('B_sub_c_meson', 'meson', m_B_sub_c_pdg, dc_B_sub_c, lifetime_B_sub_c, fraction=fraction_B_sub_c) B_sub_s_meson = Particle('B_sub_s_meson', 'meson',
clicks = 0 dot_circle = circle_group.sprites()[pos] x, y = dot_circle.rect.center d.update(x, y, win, color) for circle in circle_group: if circle.complete: if pygame.sprite.collide_mask(p, circle): if circle.i == pos: pos = random.randint(0, 11) x, y = circle.rect.center for i in range(10): particle = Particle(x, y, color, win) particle_group.add(particle) score += 1 dash_fx.play() p.dr *= -1 x, y = p.rect.center if (x < 0 or x > WIDTH or y < 0 or y > HEIGHT): for i in range(10): particle = Particle(x, y, WHITE, win) particle_group.add(particle) p.alive = False dead_fx.play() if not p.alive and len(particle_group) == 0:
for dot in dot_group: if dot.rect.colliderect(p): dot.kill() score_fx.play() score += 1 if highscore <= score: highscore = score if pygame.sprite.spritecollide(p, ball_group, False) and player_alive: death_fx.play() x, y = p.rect.center for i in range(20): particle = Particle(x, y, WHITE, win) particle_group.add(particle) player_alive = False p.reset() if p.can_move and len(dot_group) == 0 and player_alive: dot_index = random.randint(1, 4) dot_pos = dot_list[dot_index - 1] dot = Dot(*dot_pos, win) dot_group.add(dot) shadow_group.empty() shadow = Shadow(dot_index, win) shadow_group.add(shadow) if not player_alive and len(particle_group) == 0:
def win_particles(): for x,y in [(40, 120), (WIDTH - 20, 240), (15, HEIGHT - 30)]: for i in range(10): particle = Particle (x,y, 2, WHITE, win) win_particle_group.add(particle)
def destroy_bird(): x, y = p.rect.center for i in range (50): c = random.choice(c_list) particle = Particle(x,y, 1,c, win) destruct_group.add(particle)