def exponential_nonresonant_lineshape(m2, m0, alpha, ma, mb, mc, md, lr, ld, barrierFactor=True): """ Exponential nonresonant amplitude with orbital barriers """ if barrierFactor: m = atfi.sqrt(m2) q = atfk.two_body_momentum(md, m, mc) q0 = atfk.two_body_momentum(md, m0, mc) p = atfk.two_body_momentum(m, ma, mb) p0 = atfk.two_body_momentum(m0, ma, mb) b1 = orbital_barrier_factor(p, p0, lr) b2 = orbital_barrier_factor(q, q0, ld) return atfi.complex(b1 * b2 * atfi.exp(-alpha * (m2 - m0**2)), atfi.const(0.)) else: return atfi.complex(atfi.exp(-alpha * (m2 - m0**2)), atfi.const(0.))
def generate_rotation_and_boost(moms, minit, meanpt, ptcut, rnd): """ Generate 4-momenta of final state products according to 3-body phase space distribution moms - initial particle momenta (in the rest frame) meanpt - mean Pt of the initial particle ptcut - miminum Pt of the initial particle rnd - Auxiliary random tensor """ pt = generate_pt(rnd[:, 0], meanpt, ptcut, 200.) # Pt in GeV eta = generate_eta(rnd[:, 1]) # Eta phi = generate_phi(rnd[:, 2]) # Phi theta = 2. * atfi.atan(atfi.exp(-eta)) # Theta angle p = pt / atfi.sin(theta) # Full momentum e = atfi.sqrt(p**2 + minit**2) # Energy px = p * atfi.sin(theta) * atfi.sin(phi) # 3-momentum of initial particle py = p * atfi.sin(theta) * atfi.cos(phi) pz = p * atfi.cos(theta) p4 = atfk.lorentz_vector(atfk.vector(px, py, pz), e) # 4-momentum of initial particle rotphi = uniform_random(rnd[:, 3], 0., 2 * atfi.pi()) rotpsi = uniform_random(rnd[:, 4], 0., 2 * atfi.pi()) rottheta = atfi.acos(uniform_random(rnd[:, 5], -1, 1.)) moms2 = [] for m in moms: m1 = atfk.rotate_lorentz_vector(m, rotphi, rottheta, rotpsi) moms2 += [atfk.boost_from_rest(m1, p4)] return moms2
def generate_exp(rnd, x1, x2, alpha=None): """ Exponential random distribution with constant "alpha", limited to the range x1 to x2 """ if isinstance(x1, float): x1 = atfi.const(x1) if isinstance(x2, float): x2 = atfi.const(x2) if alpha is None or alpha == 0: return uniform_random(rnd, x1, x2) else: if isinstance(alpha, float): alpha = atfi.const(alpha) xi1 = atfi.exp(-x1 / alpha) xi2 = atfi.exp(-x2 / alpha) ximin = atfi.min(xi1, xi2) ximax = atfi.max(xi1, xi2) return atfi.abs(alpha * atfi.log(uniform_random(rnd, ximin, ximax)))
def wigner_capital_d(phi, theta, psi, j, m1, m2): """Calculate Wigner capital-D function. phi, theta, psi : Rotation angles j : spin (in units of 1/2, e.g. 1 for spin=1/2) m1 and m2 : spin projections (in units of 1/2, e.g. 1 for projection 1/2) :param phi: :param theta: :param psi: :param j2: :param m2_1: :param m2_2: """ i = atfi.complex(atfi.const(0), atfi.const(1)) return (atfi.exp(-i * atfi.cast_complex(m1 / 2.0 * phi)) * atfi.cast_complex(wigner_small_d(theta, j, m1, m2)) * atfi.exp(-i * atfi.cast_complex(m2 / 2.0 * psi)))
def generate_4momenta(rnd, meanpt, ptcut, m): """ Generate random 4-momenta according to specified mean Pt, minimum Pt, and mass of the particle, flat in eta and phi """ pt = generate_pt(rnd[:, 0], meanpt, ptcut, atfi.const(200.)) # Pt in GeV eta = generate_eta(rnd[:, 1]) # Eta phi = generate_phi(rnd[:, 2]) # Phi theta = 2. * atfi.atan(atfi.exp(-eta)) p = pt / atfi.sin(theta) # Full momentum e = atfi.sqrt(p**2 + m**2) # Energy px = p * atfi.sin(theta) * atfi.sin(phi) py = p * atfi.sin(theta) * atfi.cos(phi) pz = p * atfi.cos(theta) return atfk.lorentz_vector(atfk.vector(px, py, pz), e)
def dabba_lineshape(m2ab, b, alpha, beta, ma, mb): """ Dabba line shape """ mSum = ma + mb m2a = ma**2 m2b = mb**2 sAdler = max(m2a, m2b) - 0.5 * min(m2a, m2b) mSum2 = mSum * mSum mDiff = m2ab - mSum2 rho = atfi.sqrt(1. - mSum2 / m2ab) realPart = 1.0 - beta * mDiff imagPart = b * atfi.exp(-alpha * mDiff) * (m2ab - sAdler) * rho denomFactor = realPart * realPart + imagPart * imagPart ampl = atfi.complex(realPart, imagPart) / atfi.cast_complex(denomFactor) return ampl
def random_rotation_and_boost(moms, rnd): """ Apply random boost and rotation to the list of 4-vectors moms : list of 4-vectors rnd : random array of shape (N, 6), where N is the length of 4-vector array """ pt = -5.0 * atfi.log( rnd[:, 0] ) # Random pT, exponential distribution with mean 5 GeV eta = rnd[:, 1] * 3.0 + 2.0 # Uniform distribution in pseudorapidity eta phi = rnd[:, 2] * 2.0 * atfi.pi() # Uniform distribution in phi theta = 2.0 * atfi.atan(atfi.exp(-eta)) # Theta angle is a function of eta p = pt / atfi.sin(theta) # Full momentum e = atfi.sqrt(p ** 2 + mb ** 2) # Energy of the Bs px = ( p * atfi.sin(theta) * atfi.sin(phi) ) # 3-momentum of initial particle (Bs meson) py = p * atfi.sin(theta) * atfi.cos(phi) pz = p * atfi.cos(theta) boost = atfk.lorentz_vector( atfk.vector(px, py, pz), e ) # Boost vector of the Bs meson rot_theta = atfi.acos( rnd[:, 3] * 2.0 - 1.0 ) # Random Euler rotation angles for Bs decay rot_phi = rnd[:, 4] * 2.0 * atfi.pi() rot_psi = rnd[:, 5] * 2.0 * atfi.pi() # Apply rotation and boost to the momenta in input list moms1 = [] for m in moms: m1 = atfk.rotate_lorentz_vector(m, rot_phi, rot_theta, rot_psi) moms1 += [atfk.boost_from_rest(m1, boost)] return moms1
def func(x): return 1.0 / math.sqrt(math.pi) * atfi.exp(-(x**2))