bachelor_thesis/prog/python/qqgg/analytical_xs.org

146 lines
3.9 KiB
Org Mode
Raw Normal View History

2020-03-30 15:43:55 +02:00
#+PROPERTY: header-args :exports both :output-dir results
2020-03-27 15:43:13 +01:00
2020-03-27 13:39:00 +01:00
* Init
** Required Modules
#+NAME: e988e3f2-ad1f-49a3-ad60-bedba3863283
2020-03-27 19:34:22 +01:00
#+begin_src ipython :session :exports both
import numpy as np
import matplotlib.pyplot as plt
#+end_src
2020-03-27 13:39:00 +01:00
#+RESULTS: e988e3f2-ad1f-49a3-ad60-bedba3863283
** Utilities
#+NAME: 53548778-a4c1-461a-9b1f-0f401df12b08
2020-03-30 15:43:55 +02:00
#+BEGIN_SRC ipython :session :exports both
2020-03-27 13:39:00 +01:00
%run ../utility.py
#+END_SRC
#+RESULTS: 53548778-a4c1-461a-9b1f-0f401df12b08
2020-03-30 15:43:55 +02:00
* Implementation
2020-03-27 13:39:00 +01:00
#+NAME: 777a013b-6c20-44bd-b58b-6a7690c21c0e
2020-03-30 15:43:55 +02:00
#+BEGIN_SRC ipython :session :exports both :results raw drawer :exports code :tangle tangled/xs.py
2020-03-27 13:39:00 +01:00
"""
Implementation of the analytical cross section for q q_bar ->
gamma gamma
Author: Valentin Boettcher <hiro@protagon.space>
"""
import numpy as np
from scipy.constants import alpha
# 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-03-27 14:30:55 +01:00
return charge**4*(alpha/esp)**2/6
2020-03-27 13:39:00 +01:00
2020-03-28 11:43:21 +01:00
def diff_xs(θ, charge, esp):
2020-03-27 13:39:00 +01:00
"""
Calculates the differential cross section as a function of the
2020-03-30 15:43:55 +02:00
azimuth angle θ in units of 1/GeV².
2020-03-27 13:39:00 +01:00
Arguments:
2020-03-28 11:43:21 +01:00
θ -- azimuth angle
2020-03-27 13:39:00 +01: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-03-28 11:43:21 +01:00
return f*((np.cos(θ)**+1)/np.sin(θ)**2)
2020-03-27 13:39:00 +01:00
def diff_xs_eta(η, charge, esp):
2020-03-27 13:39:00 +01:00
"""
Calculates the differential cross section as a function of the
pseudo rapidity of the photons in units of 1/GeV^2.
Arguments:
2020-03-28 11:43:21 +01:00
η -- pseudo rapidity
2020-03-27 13:39:00 +01: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-03-28 11:43:21 +01:00
return f*(2*np.cosh(η)**2 - 1)
2020-03-27 13:39:00 +01:00
def total_xs_eta(η, charge, esp):
2020-03-27 13:39:00 +01:00
"""
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
2020-03-28 11:43:21 +01:00
the interval [-η, η] will be used.
2020-03-27 13:39:00 +01:00
Arguments:
2020-03-28 11:43:21 +01:00
η -- pseudo rapidity (tuple or number)
2020-03-27 13:39:00 +01:00
esp -- center of momentum energy in GeV
charge -- charge of the particle in units of the elementar charge
"""
f = energy_factor(charge, esp)
2020-03-28 11:43:21 +01:00
if not isinstance(η, tuple):
η = (-η, η)
2020-03-27 13:39:00 +01:00
2020-03-28 11:43:21 +01:00
if len(η) != 2:
raise ValueError('Invalid η cut.')
2020-03-27 13:39:00 +01:00
def F(x):
return np.tanh(x) - 2*x
2020-03-28 11:43:21 +01:00
return 2*np.pi*f*(F(η[0]) - F(η[1]))
2020-03-27 13:39:00 +01:00
#+END_SRC
#+RESULTS: 777a013b-6c20-44bd-b58b-6a7690c21c0e
:RESULTS:
:END:
* Calculations
** XS qq -> gamma gamma
First, set up the input parameters.
#+NAME: 7e62918a-2935-41ac-94e0-f0e7c3af8e0d
2020-03-27 19:34:22 +01:00
#+BEGIN_SRC ipython :session :exports both :results raw drawer
2020-03-28 11:43:21 +01:00
η = 2.5
2020-03-27 13:39:00 +01:00
charge = 1/3
esp = 200 # GeV
#+END_SRC
#+RESULTS: 7e62918a-2935-41ac-94e0-f0e7c3af8e0d
:RESULTS:
:END:
And now calculate the cross section in picobarn.
#+NAME: cf853fb6-d338-482e-bc55-bd9f8e796495
2020-03-30 15:43:55 +02:00
#+BEGIN_SRC ipython :session :exports both :results drawer output file :file xs.tex
xs_gev = total_xs_eta(η, charge, esp)
2020-03-28 11:43:21 +01:00
xs_pb = gev_to_pb(xs_gev)
2020-03-30 15:43:55 +02:00
print(tex_value(xs_pb, unit=r'\pico\barn', prefix=r'\sigma = ', prec=5))
2020-03-27 13:39:00 +01:00
#+END_SRC
#+RESULTS: cf853fb6-d338-482e-bc55-bd9f8e796495
:RESULTS:
2020-03-30 15:43:55 +02:00
[[file:results/xs.tex]]
2020-03-27 14:30:55 +01:00
:END:
2020-03-27 15:43:13 +01:00
Compared to sherpa, it's pretty close.
2020-03-27 14:30:55 +01:00
#+NAME: 81b5ed93-0312-45dc-beec-e2ba92e22626
2020-03-27 19:34:22 +01:00
#+BEGIN_SRC ipython :session :exports both :results raw drawer
2020-03-27 14:30:55 +01:00
sherpa = 0.0538009
xs_pb/sherpa
#+END_SRC
#+RESULTS: 81b5ed93-0312-45dc-beec-e2ba92e22626
:RESULTS:
0.9998585425137037
:END:
2020-03-27 15:43:13 +01:00
I had to set the runcard option ~EW_SCHEME: alpha0~ to use the pure
QED coupling constant.