|
|
|
@ -1,8 +1,6 @@
|
|
|
|
|
using QEDprocesses
|
|
|
|
|
using StaticArrays
|
|
|
|
|
import QEDbase.mass
|
|
|
|
|
|
|
|
|
|
# TODO check
|
|
|
|
|
const e = sqrt(4π / 137)
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
@ -12,17 +10,6 @@ Singleton definition for identification of the QED-Model.
|
|
|
|
|
"""
|
|
|
|
|
struct QEDModel <: AbstractPhysicsModel end
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
QEDParticle
|
|
|
|
|
|
|
|
|
|
Base type for all particles in the [`QEDModel`](@ref).
|
|
|
|
|
|
|
|
|
|
Its template parameter specifies the particle's direction.
|
|
|
|
|
|
|
|
|
|
The concrete types contain singletons of the types that they are, like `Photon` and `Electron` from QEDbase, and their state descriptions.
|
|
|
|
|
"""
|
|
|
|
|
abstract type QEDParticle{Direction <: ParticleDirection} <: AbstractParticle end
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
QEDProcessDescription <: AbstractProcessDescription
|
|
|
|
|
|
|
|
|
@ -35,7 +22,7 @@ struct QEDProcessDescription <: AbstractProcessDescription
|
|
|
|
|
outParticles::Dict{Type{<:QEDParticle{Outgoing}}, Int}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
QEDParticleValue{ParticleType <: QEDParticle} = Union{
|
|
|
|
|
QEDParticleValue{ParticleType <: ParticleStateful} = Union{
|
|
|
|
|
ParticleValue{ParticleType, BiSpinor},
|
|
|
|
|
ParticleValue{ParticleType, AdjointBiSpinor},
|
|
|
|
|
ParticleValue{ParticleType, DiracMatrix},
|
|
|
|
@ -43,92 +30,48 @@ QEDParticleValue{ParticleType <: QEDParticle} = Union{
|
|
|
|
|
ParticleValue{ParticleType, ComplexF64},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
PhotonStateful <: QEDParticle
|
|
|
|
|
|
|
|
|
|
A photon of the [`QEDModel`](@ref) with its state.
|
|
|
|
|
"""
|
|
|
|
|
struct PhotonStateful{Direction <: ParticleDirection, Pol <: AbstractDefinitePolarization} <: QEDParticle{Direction}
|
|
|
|
|
momentum::SFourMomentum
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
PhotonStateful{Direction}(mom::SFourMomentum) where {Direction <: ParticleDirection} =
|
|
|
|
|
PhotonStateful{Direction, PolX}(mom)
|
|
|
|
|
|
|
|
|
|
PhotonStateful{Dir, Pol}(ph::PhotonStateful) where {Dir, Pol} = PhotonStateful{Dir, Pol}(ph.momentum)
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
FermionStateful <: QEDParticle
|
|
|
|
|
|
|
|
|
|
A fermion of the [`QEDModel`](@ref) with its state.
|
|
|
|
|
"""
|
|
|
|
|
struct FermionStateful{Direction <: ParticleDirection, Spin <: AbstractDefiniteSpin} <: QEDParticle{Direction}
|
|
|
|
|
momentum::SFourMomentum
|
|
|
|
|
# TODO: mass for electron/muon/tauon representation?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
FermionStateful{Direction}(mom::SFourMomentum) where {Direction <: ParticleDirection} =
|
|
|
|
|
FermionStateful{Direction, SpinUp}(mom)
|
|
|
|
|
|
|
|
|
|
FermionStateful{Dir, Spin}(f::FermionStateful) where {Dir, Spin} = FermionStateful{Dir, Spin}(f.momentum)
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
AntiFermionStateful <: QEDParticle
|
|
|
|
|
|
|
|
|
|
An anti-fermion of the [`QEDModel`](@ref) with its state.
|
|
|
|
|
"""
|
|
|
|
|
struct AntiFermionStateful{Direction <: ParticleDirection, Spin <: AbstractDefiniteSpin} <: QEDParticle{Direction}
|
|
|
|
|
momentum::SFourMomentum
|
|
|
|
|
# TODO: mass for electron/muon/tauon representation?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
AntiFermionStateful{Direction}(mom::SFourMomentum) where {Direction <: ParticleDirection} =
|
|
|
|
|
AntiFermionStateful{Direction, SpinUp}(mom)
|
|
|
|
|
|
|
|
|
|
AntiFermionStateful{Dir, Spin}(f::AntiFermionStateful) where {Dir, Spin} = AntiFermionStateful{Dir, Spin}(f.momentum)
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
interaction_result(t1::Type{T1}, t2::Type{T2}) where {T1 <: QEDParticle, T2 <: QEDParticle}
|
|
|
|
|
|
|
|
|
|
For two given particle types that can interact, return the third.
|
|
|
|
|
"""
|
|
|
|
|
function interaction_result(t1::Type{T1}, t2::Type{T2}) where {T1 <: QEDParticle, T2 <: QEDParticle}
|
|
|
|
|
function interaction_result(t1::Type{T1}, t2::Type{T2}) where {T1 <: ParticleStateful, T2 <: ParticleStateful}
|
|
|
|
|
@assert false "Invalid interaction between particles of types $t1 and $t2"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Incoming, Electron}}, ::Type{ParticleStateful{Outgoing, Electron}}) =
|
|
|
|
|
ParticleStateful{Incoming, Photon}
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Incoming, Electron}}, ::Type{ParticleStateful{Incoming, Positron}}) =
|
|
|
|
|
ParticleStateful{Incoming, Photon}
|
|
|
|
|
interaction_result(
|
|
|
|
|
::Type{FermionStateful{Incoming, Spin1}},
|
|
|
|
|
::Type{FermionStateful{Outgoing, Spin2}},
|
|
|
|
|
) where {Spin1, Spin2} = PhotonStateful{Incoming, PolX}
|
|
|
|
|
interaction_result(
|
|
|
|
|
::Type{FermionStateful{Incoming, Spin1}},
|
|
|
|
|
::Type{AntiFermionStateful{Incoming, Spin2}},
|
|
|
|
|
) where {Spin1, Spin2} = PhotonStateful{Incoming, PolX}
|
|
|
|
|
interaction_result(::Type{FermionStateful{Incoming, Spin1}}, ::Type{<:PhotonStateful}) where {Spin1} =
|
|
|
|
|
FermionStateful{Outgoing, SpinUp}
|
|
|
|
|
::Type{ParticleStateful{Incoming, Electron}},
|
|
|
|
|
::Type{ParticleStateful{<:ParticleDirection, Photon}},
|
|
|
|
|
) = ParticleStateful{Outgoing, Electron}
|
|
|
|
|
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Outgoing, Electron}}, ::Type{ParticleStateful{Incoming, Electron}}) =
|
|
|
|
|
ParticleStateful{Incoming, Photon}
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Outgoing, Electron}}, ::Type{ParticleStateful{Outgoing, Positron}}) =
|
|
|
|
|
ParticleStateful{Incoming, Photon}
|
|
|
|
|
interaction_result(
|
|
|
|
|
::Type{FermionStateful{Outgoing, Spin1}},
|
|
|
|
|
::Type{FermionStateful{Incoming, Spin2}},
|
|
|
|
|
) where {Spin1, Spin2} = PhotonStateful{Incoming, PolX}
|
|
|
|
|
interaction_result(
|
|
|
|
|
::Type{FermionStateful{Outgoing, Spin1}},
|
|
|
|
|
::Type{AntiFermionStateful{Outgoing, Spin2}},
|
|
|
|
|
) where {Spin1, Spin2} = PhotonStateful{Incoming, PolX}
|
|
|
|
|
interaction_result(::Type{FermionStateful{Outgoing, Spin1}}, ::Type{<:PhotonStateful}) where {Spin1} =
|
|
|
|
|
FermionStateful{Incoming, SpinUp}
|
|
|
|
|
::Type{ParticleStateful{Outgoing, Electron}},
|
|
|
|
|
::Type{ParticleStateful{<:ParticleDirection, Photon}},
|
|
|
|
|
) = ParticleStateful{Incoming, Electron}
|
|
|
|
|
|
|
|
|
|
# antifermion mirror
|
|
|
|
|
interaction_result(::Type{AntiFermionStateful{Incoming, Spin}}, t2::Type{<:QEDParticle}) where {Spin} =
|
|
|
|
|
interaction_result(FermionStateful{Outgoing, Spin}, t2)
|
|
|
|
|
interaction_result(::Type{AntiFermionStateful{Outgoing, Spin}}, t2::Type{<:QEDParticle}) where {Spin} =
|
|
|
|
|
interaction_result(FermionStateful{Incoming, Spin}, t2)
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Incoming, Positron}}, t2::Type{<:ParticleStateful}) =
|
|
|
|
|
interaction_result(ParticleStateful{Outgoing, Electron}, t2)
|
|
|
|
|
interaction_result(::Type{ParticleStateful{Outgoing, Positron}}, t2::Type{<:ParticleStateful}) =
|
|
|
|
|
interaction_result(ParticleStateful{Incoming, Electron}, t2)
|
|
|
|
|
|
|
|
|
|
# photon commutativity
|
|
|
|
|
interaction_result(t1::Type{<:PhotonStateful}, t2::Type{<:QEDParticle}) = interaction_result(t2, t1)
|
|
|
|
|
interaction_result(t1::Type{<:ParticleStateful{<:ParticleDirection, Photon}}, t2::Type{<:ParticleStateful}) =
|
|
|
|
|
interaction_result(t2, t1)
|
|
|
|
|
|
|
|
|
|
# but prevent stack overflow
|
|
|
|
|
function interaction_result(t1::Type{<:PhotonStateful}, t2::Type{<:PhotonStateful})
|
|
|
|
|
function interaction_result(
|
|
|
|
|
t1::Type{ParticleStateful{<:ParticleDirection, Photon}},
|
|
|
|
|
t2::Type{ParticleStateful{<:ParticleDirection, Photon}},
|
|
|
|
|
)
|
|
|
|
|
@assert false "Invalid interaction between particles of types $t1 and $t2"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -137,18 +80,12 @@ end
|
|
|
|
|
|
|
|
|
|
Return the type of the inverted direction. E.g.
|
|
|
|
|
"""
|
|
|
|
|
propagation_result(::Type{FermionStateful{Incoming, Spin}}) where {Spin <: AbstractDefiniteSpin} =
|
|
|
|
|
FermionStateful{Outgoing, Spin}
|
|
|
|
|
propagation_result(::Type{FermionStateful{Outgoing, Spin}}) where {Spin <: AbstractDefiniteSpin} =
|
|
|
|
|
FermionStateful{Incoming, Spin}
|
|
|
|
|
propagation_result(::Type{AntiFermionStateful{Incoming, Spin}}) where {Spin <: AbstractDefiniteSpin} =
|
|
|
|
|
AntiFermionStateful{Outgoing, Spin}
|
|
|
|
|
propagation_result(::Type{AntiFermionStateful{Outgoing, Spin}}) where {Spin <: AbstractDefiniteSpin} =
|
|
|
|
|
AntiFermionStateful{Incoming, Spin}
|
|
|
|
|
propagation_result(::Type{PhotonStateful{Incoming, Pol}}) where {Pol <: AbstractDefinitePolarization} =
|
|
|
|
|
PhotonStateful{Outgoing, Pol}
|
|
|
|
|
propagation_result(::Type{PhotonStateful{Outgoing, Pol}}) where {Pol <: AbstractDefinitePolarization} =
|
|
|
|
|
PhotonStateful{Incoming, Pol}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Incoming, Electron}}) = ParticleStateful{Outgoing, Electron}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Outgoing, Electron}}) = ParticleStateful{Incoming, Electron}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Incoming, Positron}}) = ParticleStateful{Outgoing, Positron}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Outgoing, Positron}}) = ParticleStateful{Incoming, Positron}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Incoming, Photon}}) = ParticleStateful{Outgoing, Photon}
|
|
|
|
|
propagation_result(::Type{ParticleStateful{Outgoing, Photon}}) = ParticleStateful{Incoming, Photon}
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
types(::QEDModel)
|
|
|
|
@ -157,12 +94,12 @@ Return a Vector of the possible types of particle in the [`QEDModel`](@ref).
|
|
|
|
|
"""
|
|
|
|
|
function types(::QEDModel)
|
|
|
|
|
return [
|
|
|
|
|
PhotonStateful{Incoming, PolX},
|
|
|
|
|
PhotonStateful{Outgoing, PolX},
|
|
|
|
|
FermionStateful{Incoming, SpinUp},
|
|
|
|
|
FermionStateful{Outgoing, SpinUp},
|
|
|
|
|
AntiFermionStateful{Incoming, SpinUp},
|
|
|
|
|
AntiFermionStateful{Outgoing, SpinUp},
|
|
|
|
|
ParticleStateful{Incoming, Photon},
|
|
|
|
|
ParticleStateful{Outgoing, Photon},
|
|
|
|
|
ParticleStateful{Incoming, Electron},
|
|
|
|
|
ParticleStateful{Outgoing, Electron},
|
|
|
|
|
ParticleStateful{Incoming, Positron},
|
|
|
|
|
ParticleStateful{Outgoing, Positron},
|
|
|
|
|
]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -235,9 +172,9 @@ end
|
|
|
|
|
@inline isoutgoing(::Type{<:QEDParticle{Incoming}}) = false
|
|
|
|
|
@inline isoutgoing(::Type{<:QEDParticle{Outgoing}}) = true
|
|
|
|
|
|
|
|
|
|
@inline mass(::Type{<:FermionStateful}) = 1.0
|
|
|
|
|
@inline mass(::Type{<:AntiFermionStateful}) = 1.0
|
|
|
|
|
@inline mass(::Type{<:PhotonStateful}) = 0.0
|
|
|
|
|
@inline QEDbase.mass(::Type{<:FermionStateful}) = 1.0
|
|
|
|
|
@inline QEDbase.mass(::Type{<:AntiFermionStateful}) = 1.0
|
|
|
|
|
@inline QEDbase.mass(::Type{<:PhotonStateful}) = 0.0
|
|
|
|
|
|
|
|
|
|
@inline invert_momentum(p::FermionStateful{Dir, Spin}) where {Dir, Spin} =
|
|
|
|
|
FermionStateful{Dir, Spin}(-p.momentum, p.spin)
|
|
|
|
|