2020-03-31 15:19:51 +02:00
|
|
|
|
import numpy as np
|
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
import monte_carlo
|
|
|
|
|
|
2020-03-30 15:43:55 +02:00
|
|
|
|
"""
|
|
|
|
|
Implementation of the analytical cross section for q q_bar ->
|
|
|
|
|
gamma gamma
|
|
|
|
|
|
|
|
|
|
Author: Valentin Boettcher <hiro@protagon.space>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
|
# NOTE: a more elegant solution would be a decorator
|
|
|
|
|
def energy_factor(charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the factor common to all other values in this module
|
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementary charge
|
|
|
|
|
"""
|
|
|
|
|
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return charge ** 4 / (137.036 * esp) ** 2 / 6
|
2020-03-30 15:43:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def diff_xs(θ, charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the differential cross section as a function of the
|
|
|
|
|
azimuth angle θ in units of 1/GeV².
|
|
|
|
|
|
2020-04-01 12:14:35 +02:00
|
|
|
|
Here dΩ=sinθdθdφ
|
|
|
|
|
|
2020-03-30 15:43:55 +02:00
|
|
|
|
Arguments:
|
|
|
|
|
θ -- azimuth angle
|
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementary charge
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
f = energy_factor(charge, esp)
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return f * ((np.cos(θ) ** 2 + 1) / np.sin(θ) ** 2)
|
|
|
|
|
|
2020-03-30 15:43:55 +02:00
|
|
|
|
|
2020-03-30 19:56:02 +02:00
|
|
|
|
def diff_xs_cosθ(cosθ, charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the differential cross section as a function of the
|
|
|
|
|
cosine of the azimuth angle θ in units of 1/GeV².
|
|
|
|
|
|
2020-04-01 12:14:35 +02:00
|
|
|
|
Here dΩ=d(cosθ)dφ
|
|
|
|
|
|
2020-03-30 19:56:02 +02:00
|
|
|
|
Arguments:
|
2020-03-30 20:26:10 +02:00
|
|
|
|
cosθ -- cosine of the azimuth angle
|
2020-03-30 19:56:02 +02:00
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementary charge
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
f = energy_factor(charge, esp)
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return f * ((cosθ ** 2 + 1) / (1 - cosθ ** 2))
|
2020-03-30 19:56:02 +02:00
|
|
|
|
|
2020-04-02 15:55:07 +02:00
|
|
|
|
|
2020-03-30 15:43:55 +02:00
|
|
|
|
def diff_xs_eta(η, charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the differential cross section as a function of the
|
|
|
|
|
pseudo rapidity of the photons in units of 1/GeV^2.
|
|
|
|
|
|
2020-04-01 12:14:35 +02:00
|
|
|
|
This is actually the crossection dσ/(dφdη).
|
2020-03-30 20:26:10 +02:00
|
|
|
|
|
|
|
|
|
Arguments:
|
2020-04-01 12:14:35 +02:00
|
|
|
|
η -- pseudo rapidity
|
2020-03-30 20:26:10 +02:00
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementary charge
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
f = energy_factor(charge, esp)
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return f * (np.tanh(η) ** 2 + 1)
|
2020-03-30 20:26:10 +02:00
|
|
|
|
|
2020-04-02 15:55:07 +02:00
|
|
|
|
|
|
|
|
|
def diff_xs_p_t(p_t, charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the differential cross section as a function of the
|
|
|
|
|
transverse momentum (p_t) of the photons in units of 1/GeV^2.
|
|
|
|
|
|
|
|
|
|
This is actually the crossection dσ/(dφdp_t).
|
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
p_t -- transverse momentum in GeV
|
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementary charge
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
f = energy_factor(charge, esp)
|
2020-04-18 20:00:18 +02:00
|
|
|
|
sqrt_fact = np.sqrt(1 - (2 * p_t / esp) ** 2)
|
|
|
|
|
return f / p_t * (1 / sqrt_fact + sqrt_fact)
|
2020-04-02 15:55:07 +02:00
|
|
|
|
|
|
|
|
|
|
2020-03-30 15:43:55 +02:00
|
|
|
|
def total_xs_eta(η, charge, esp):
|
|
|
|
|
"""
|
|
|
|
|
Calculates the total cross section as a function of the pseudo
|
|
|
|
|
rapidity of the photons in units of 1/GeV^2. If the rapditiy is
|
|
|
|
|
specified as a tuple, it is interpreted as an interval. Otherwise
|
|
|
|
|
the interval [-η, η] will be used.
|
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
η -- pseudo rapidity (tuple or number)
|
|
|
|
|
esp -- center of momentum energy in GeV
|
|
|
|
|
charge -- charge of the particle in units of the elementar charge
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
f = energy_factor(charge, esp)
|
|
|
|
|
if not isinstance(η, tuple):
|
|
|
|
|
η = (-η, η)
|
|
|
|
|
|
|
|
|
|
if len(η) != 2:
|
2020-04-18 20:00:18 +02:00
|
|
|
|
raise ValueError("Invalid η cut.")
|
2020-03-30 15:43:55 +02:00
|
|
|
|
|
|
|
|
|
def F(x):
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return np.tanh(x) - 2 * x
|
2020-03-30 15:43:55 +02:00
|
|
|
|
|
2020-04-18 20:00:18 +02:00
|
|
|
|
return 2 * np.pi * f * (F(η[0]) - F(η[1]))
|
2020-03-31 15:19:51 +02:00
|
|
|
|
|
2020-04-22 11:26:13 +02:00
|
|
|
|
@numpy_cache('momentum_cache')
|
|
|
|
|
def sample_momenta(sample_num, interval, charge, esp, seed=None, **kwargs):
|
2020-04-02 16:35:43 +02:00
|
|
|
|
"""Samples `sample_num` unweighted photon 4-momenta from the
|
2020-04-22 11:26:13 +02:00
|
|
|
|
cross-section. Superflous kwargs are passed on to
|
|
|
|
|
`sample_unweighted_array`.
|
2020-03-31 15:19:51 +02:00
|
|
|
|
|
|
|
|
|
:param sample_num: number of samples to take
|
|
|
|
|
:param interval: cosθ interval to sample from
|
|
|
|
|
:param charge: the charge of the quark
|
|
|
|
|
:param esp: center of mass energy
|
|
|
|
|
:param seed: the seed for the rng, optional, default is system
|
|
|
|
|
time
|
|
|
|
|
|
2020-04-02 16:35:43 +02:00
|
|
|
|
:returns: an array of 4 photon momenta
|
2020-04-02 16:33:30 +02:00
|
|
|
|
|
2020-03-31 15:19:51 +02:00
|
|
|
|
:rtype: np.ndarray
|
2020-04-22 11:26:13 +02:00
|
|
|
|
|
2020-03-31 15:19:51 +02:00
|
|
|
|
"""
|
2020-04-22 11:26:13 +02:00
|
|
|
|
cosθ_sample = monte_carlo.sample_unweighted_array(
|
|
|
|
|
sample_num, lambda x: diff_xs_cosθ(x, charge, esp), interval_cosθ, **kwargs
|
|
|
|
|
)
|
2020-03-31 15:19:51 +02:00
|
|
|
|
φ_sample = np.random.uniform(0, 1, sample_num)
|
|
|
|
|
|
2020-04-02 15:55:07 +02:00
|
|
|
|
def make_momentum(esp, cosθ, φ):
|
2020-04-22 11:26:13 +02:00
|
|
|
|
sinθ = np.sqrt(1 - cosθ ** 2)
|
|
|
|
|
return np.array([1, sinθ * np.cos(φ), sinθ * np.sin(φ), cosθ]) * esp / 2
|
2020-03-31 15:19:51 +02:00
|
|
|
|
|
2020-04-22 11:26:13 +02:00
|
|
|
|
momenta = np.array(
|
|
|
|
|
[make_momentum(esp, cosθ, φ) for cosθ, φ in np.array([cosθ_sample, φ_sample]).T]
|
|
|
|
|
)
|
2020-04-02 16:35:43 +02:00
|
|
|
|
return momenta
|