-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c1bad5a
Showing
6 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vscode/ | ||
*cache* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Copyright (c) 2024 Quan-feng WU <[email protected]> | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
from autograd import grad | ||
from autograd.numpy import sqrt | ||
|
||
def λ(x, y, z): | ||
return (x - y - z)**2 - 4 * y * z | ||
# end def λ | ||
|
||
def center_of_mass_momentum_squared(s, m1, m2): | ||
return λ(s, m1**2, m2**2) / (4 * s) | ||
# end def center_of_mass_momentum_squared | ||
|
||
def center_of_mass_momentum(s, m1, m2): | ||
return sqrt(center_of_mass_momentum_squared(s, m1, m2)) | ||
# end def center_of_mass_momentum | ||
|
||
# a + b -> 1 + 2 | ||
# s := (pa + pb)^2 | ||
# t := (pa - p1)^2 | ||
def dt_over_dCosθCM(s, ma, mb, m1, m2, cosθ): | ||
p_ini_squared = center_of_mass_momentum_squared(s, ma, mb) | ||
p_fin_squared = center_of_mass_momentum_squared(s, m1, m2) | ||
p_ini = sqrt(p_ini_squared) | ||
p_fin = sqrt(p_fin_squared) | ||
# Ea = sqrt(ma**2 + p_ini_squared) | ||
# E1 = sqrt(m1**2 + p_fin_squared) | ||
# t = ma**2 + m1**2 - 2 * (Ea * E1 - p_ini * p_fin * cosθ) | ||
return 2 * (p_ini * p_fin * cosθ) | ||
# end def dt_over_dCosθ | ||
|
||
# Laboratory frame means pb = (mb, 0, 0, 0)^T. | ||
class TransformCM2Lab: | ||
def __init__(self, s, ma, mb, m1, m2): | ||
self.s = s | ||
self.m1 = m1 | ||
self.m2 = m2 | ||
self.ma = ma | ||
self.mb = mb | ||
# end def __init__ | ||
|
||
def Eb_CM_squared(self): | ||
pb_CM_squared = center_of_mass_momentum_squared(self.s, self.ma, self.mb) | ||
return self.mb**2 + pb_CM_squared | ||
# end def Eb_CM_squared | ||
|
||
def γ_squared(self): | ||
return self.Eb_CM_squared() / self.mb**2 | ||
# end def γ_squared | ||
|
||
def β_squared(self): | ||
return 1 - 1 / self.γ_squared() | ||
# end def β_squared | ||
# end class TransformCM2Lab | ||
|
||
# θ is the angle between the direction of the initial particle a and the direction of the final particle 1. | ||
class CosθCM2CosθLab(TransformCM2Lab): | ||
def __init__(self, s, ma, mb, m1, m2): | ||
super().__init__(s, ma, mb, m1, m2) | ||
# end def __init__ | ||
|
||
def cosθLab(self, cosθCM): | ||
p_fin_CM_squared = center_of_mass_momentum_squared(self.s, self.m1, self.m2) | ||
p_fin_CM = sqrt(p_fin_CM_squared) | ||
E1_CM_squared = self.m1**2 + p_fin_CM_squared | ||
E1_CM = sqrt(E1_CM_squared) | ||
β_squared = self.β_squared() | ||
γ_squared = self.γ_squared() | ||
β = sqrt(β_squared) | ||
γ = sqrt(γ_squared) | ||
# sinθCM = sqrt(1 - cosθCM**2) | ||
sinθCM_squared = 1 - cosθCM**2 | ||
# tanθLab = p_fin_CM * sinθCM / (γ * (-β * E1_CM + p_fin_CM * cosθCM)) | ||
tanθLab_squared = p_fin_CM_squared * sinθCM_squared / ( | ||
γ_squared * (β_squared * E1_CM_squared + p_fin_CM_squared * cosθCM**2 - 2 * β * E1_CM * p_fin_CM * cosθCM) | ||
) | ||
|
||
return sqrt(1 / (1 + tanθLab_squared)) | ||
# end def cosθLab | ||
|
||
def dCosθLab_over_dCosθCM(self, cosθCM): | ||
g = grad(self.cosθLab) | ||
return g(cosθCM) | ||
# end def dCosθLab_over_dCosθCM | ||
# end class CosθCM2CosθLab | ||
|
||
class CosθLab2CosθCM(TransformCM2Lab): | ||
def __init__(self, s, ma, mb, m1, m2): | ||
super().__init__(s, ma, mb, m1, m2) | ||
# end def __init__ | ||
|
||
def __check_result(self, cosθCM, cosθLab): | ||
γ = sqrt(self.γ_squared()) | ||
β = sqrt(self.β_squared()) | ||
p_fin_CM_squared = center_of_mass_momentum_squared(self.s, self.m1, self.m2) | ||
p_fin_CM = sqrt(p_fin_CM_squared) | ||
E1_CM = sqrt(self.m1**2 + p_fin_CM_squared) | ||
|
||
return γ * (-β * E1_CM + p_fin_CM * cosθCM) - p_fin_CM * sqrt(1 - cosθCM**2) * cosθLab / sqrt(1 - cosθLab**2) | ||
# end def __check_result | ||
|
||
def cosθCM(self, cosθLab): | ||
cosθLab_squared = cosθLab**2 | ||
|
||
p_fin_CM_squared = center_of_mass_momentum_squared(self.s, self.m1, self.m2) | ||
p_fin_CM = sqrt(p_fin_CM_squared) | ||
E1_CM_squared = self.m1**2 + p_fin_CM_squared | ||
E1_CM = sqrt(E1_CM_squared) | ||
β_squared = self.β_squared() | ||
γ_squared = self.γ_squared() | ||
β = sqrt(β_squared) | ||
γ = sqrt(γ_squared) | ||
|
||
# print("p_fin_CM = {}".format(p_fin_CM)) | ||
# print("E1_CM = {}".format(E1_CM)) | ||
# print("β = {}".format(β)) | ||
# print("γ = {}".format(γ)) | ||
|
||
Δ = ( | ||
p_fin_CM_squared**2 * cosθLab_squared**2 + | ||
p_fin_CM_squared * cosθLab_squared * (1 - cosθLab_squared) * | ||
(p_fin_CM_squared - E1_CM_squared * β_squared) * γ_squared | ||
) | ||
numerator = E1_CM * p_fin_CM * (1 - cosθLab_squared) * β * γ_squared | ||
denominator = p_fin_CM_squared * (γ_squared + cosθLab_squared * (1 - γ_squared)) | ||
|
||
result1 = (numerator + sqrt(Δ)) / denominator | ||
result2 = (numerator - sqrt(Δ)) / denominator | ||
|
||
error1 = self.__check_result(result1, cosθLab) | ||
error2 = self.__check_result(result2, cosθLab) | ||
if abs(error1) < abs(error2): | ||
assert abs(error1) < 1e-10 | ||
return result1 | ||
else: | ||
assert abs(error2) < 1e-10 | ||
return result2 | ||
# end def cosθCM | ||
|
||
def dCosθCM_over_dCosθLab(self, cosθLab): | ||
g = grad(self.cosθCM) | ||
return g(cosθLab) | ||
# end def dCosθCM_over_dCosθLab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) 2024 Quan-feng WU <[email protected]> | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
import numpy as np | ||
from numpy import cross, pi | ||
|
||
class dσ_over_dCosθ: | ||
def __init__(self): | ||
self.α = 1/137.035999084 | ||
self.gOverΛ = 1 | ||
self.ZX = 1 | ||
self.κ = 1 | ||
# end def __init__ | ||
|
||
def F(self, Δ): | ||
return self.ZX**2 * Δ**2 / (self.κ**2 + Δ**2) | ||
# end def F | ||
|
||
def set_α(self, α): | ||
self.α = α | ||
# end def set_α | ||
|
||
def set_gOverΛ(self, gOverΛ): | ||
self.gOverΛ = gOverΛ | ||
# end def set_gOverΛ | ||
|
||
def set_ZX(self, ZX): | ||
self.ZX = ZX | ||
# end def set_ZX | ||
|
||
def __call__(self, ω, cosθ): | ||
coeff = 2 * pi * self.ZX**2 * self.α * self.gOverΛ**2 / (32 * pi) | ||
numerator = 1 + cosθ | ||
denominator = 1 + 2 * (self.κ / (2 * ω))**2 - cosθ | ||
return coeff * numerator / denominator | ||
# end def __call__ | ||
# end class dσdCosθ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) 2024 Quan-feng WU <[email protected]> | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
class dσ_over_dt: | ||
def __init__(self): | ||
self.α = 1/137.035999084 | ||
self.ZX = 1 | ||
self.gOverΛ = 1 | ||
self.FXt = lambda t: 1 | ||
self.ma = 1 | ||
self.mX = 1000 | ||
# end def __init__ | ||
|
||
def set_α(self, α): | ||
self.α = α | ||
# end def set_α | ||
|
||
def set_ZX(self, ZX): | ||
self.ZX = ZX | ||
# end def set_ZX | ||
|
||
def set_gOverΛ(self, gOverΛ): | ||
self.gOverΛ = gOverΛ | ||
# end def set_gOverΛ | ||
|
||
def set_FXt(self, FXt): | ||
self.FXt = FXt | ||
# end def set_FXt | ||
|
||
def set_ma(self, ma): | ||
self.ma = ma | ||
# end def set_ma | ||
|
||
def set_mX(self, mX): | ||
self.mX = mX | ||
# end def set_mX | ||
|
||
def __call__(self, s, t): | ||
coeff = -self.α * self.ZX**2 * self.gOverΛ**2 * abs(self.FXt(t))**2 / 8 | ||
numerator = self.ma**4 * self.mX**2 - self.ma**2 * t * (s + self.mX**2) + t * ((s - self.mX**2)**2 + s * t) | ||
denominator = t**2 * (s - self.mX**2)**2 | ||
|
||
return coeff * numerator / denominator | ||
# end def __call__ | ||
# end class dσdt | ||
|
||
if __name__ == "__main__": | ||
from numpy import sqrt | ||
|
||
import sys | ||
sys.path.append("..") | ||
from Kinematics import center_of_mass_momentum | ||
|
||
MeV = 1 | ||
keV = 1e-3 * MeV | ||
|
||
diff_Xsection = dσ_over_dt() | ||
|
||
Eγ = 10 * MeV | ||
ma = 1 * MeV | ||
mX = 931 * MeV | ||
diff_Xsection.set_ma(ma) | ||
diff_Xsection.set_mX(mX) | ||
|
||
pin = Eγ * sqrt(mX / (2 * Eγ + mX)) | ||
EX = sqrt(pin**2 + mX**2) | ||
s = (pin + EX)**2 | ||
print((Eγ + mX)**2 - Eγ**2 - s) | ||
print(center_of_mass_momentum(s, 0, mX) - pin) | ||
pfi = center_of_mass_momentum(s, ma, EX) | ||
|
||
t = ma**2 - 2 * (pin * sqrt(pfi**2 + ma**2) - pin * pfi * -1) | ||
|
||
print(diff_Xsection(s, t)) | ||
# end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Quan-feng WU <[email protected]> | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
def __init__(): | ||
pass | ||
# end def __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Quan-feng WU <[email protected]> | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
def __init__(): | ||
pass | ||
# end def __init__ |