-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
002d5fe
commit 32b9733
Showing
17 changed files
with
1,813 additions
and
1 deletion.
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
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,33 @@ | ||
import QEDbase: propagator | ||
|
||
function _scalar_propagator(K::QEDbase.AbstractFourMomentum, mass::Real) | ||
return one(mass) / (K * K - mass^2) | ||
end | ||
|
||
function _scalar_propagator(K::QEDbase.AbstractFourMomentum) | ||
return one(getT(K)) / (K * K) | ||
end | ||
|
||
function _fermion_propagator(P::QEDbase.AbstractFourMomentum, mass::Real) | ||
return (slashed(P) + mass * one(DiracMatrix)) * _scalar_propagator(P, mass) | ||
end | ||
|
||
function _fermion_propagator(P::QEDbase.AbstractFourMomentum) | ||
return (slashed(P)) * _scalar_propagator(P) | ||
end | ||
|
||
function QEDbase.propagator( | ||
particle_type::QEDbase.BosonLike, K::QEDbase.AbstractFourMomentum | ||
) | ||
return _scalar_propagator(K, QEDbase.mass(particle_type)) | ||
end | ||
|
||
function QEDbase.propagator(particle_type::QEDbase.Photon, K::QEDbase.AbstractFourMomentum) | ||
return _scalar_propagator(K) | ||
end | ||
|
||
function QEDbase.propagator( | ||
particle_type::QEDbase.FermionLike, P::QEDbase.AbstractFourMomentum | ||
) | ||
return _fermion_propagator(P, QEDbase.mass(particle_type)) | ||
end |
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,62 @@ | ||
import QEDbase: | ||
is_particle, | ||
is_anti_particle, | ||
is_fermion, | ||
is_boson, | ||
is_incoming, | ||
is_outgoing, | ||
mass, | ||
charge | ||
|
||
# particle interface | ||
@inline is_incoming(particle::ParticleStateful) = is_incoming(particle.dir) | ||
@inline is_outgoing(particle::ParticleStateful) = is_outgoing(particle.dir) | ||
@inline QEDbase.is_fermion(particle::ParticleStateful) = | ||
QEDbase.is_fermion(particle.species) | ||
@inline QEDbase.is_boson(particle::ParticleStateful) = QEDbase.is_boson(particle.species) | ||
@inline QEDbase.is_particle(particle::ParticleStateful) = | ||
QEDbase.is_particle(particle.species) | ||
@inline QEDbase.is_anti_particle(particle::ParticleStateful) = | ||
QEDbase.is_anti_particle(particle.species) | ||
@inline QEDbase.mass(particle::ParticleStateful) = QEDbase.mass(particle.species) | ||
@inline QEDbase.charge(particle::ParticleStateful) = QEDbase.charge(particle.species) | ||
|
||
# accessors | ||
particle_direction(part::ParticleStateful) = part.dir | ||
particle_species(part::ParticleStateful) = part.species | ||
momentum(part::ParticleStateful) = part.mom | ||
|
||
""" | ||
momenta(psp::PhaseSpacePoint, ::ParticleDirection) | ||
Return a `Tuple` of all the particles' momenta for the given `ParticleDirection`. | ||
""" | ||
momenta(psp::PhaseSpacePoint, ::QEDbase.Incoming) = momentum.(psp.in_particles) | ||
momenta(psp::PhaseSpacePoint, ::QEDbase.Outgoing) = momentum.(psp.out_particles) | ||
|
||
""" | ||
Base.getindex(psp::PhaseSpacePoint, dir::Incoming, n::Int) | ||
Overload for the array indexing operator `[]`. Returns the nth incoming particle in this phase space point. | ||
""" | ||
function Base.getindex(psp::PhaseSpacePoint, ::QEDbase.Incoming, n::Int) | ||
return psp.in_particles[n] | ||
end | ||
|
||
""" | ||
Base.getindex(psp::PhaseSpacePoint, dir::Outgoing, n::Int) | ||
Overload for the array indexing operator `[]`. Returns the nth outgoing particle in this phase space point. | ||
""" | ||
function Base.getindex(psp::PhaseSpacePoint, ::QEDbase.Outgoing, n::Int) | ||
return psp.out_particles[n] | ||
end | ||
|
||
""" | ||
momentum(psp::PhaseSpacePoint, dir::ParticleDirection, n::Int) | ||
Returns the momentum of the `n`th particle in the given [`PhaseSpacePoint`](@ref) which has direction `dir`. If `n` is outside the valid range for this phase space point, a `BoundsError` is thrown. | ||
""" | ||
function momentum(psp::PhaseSpacePoint, dir::QEDbase.ParticleDirection, n::Int) | ||
return psp[dir, n].mom | ||
end |
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,158 @@ | ||
# PSP constructors from particle statefuls | ||
|
||
""" | ||
InPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_ps::Tuple{ParticleStateful}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) with only input particles from [`ParticleStateful`](@ref)s. The result will be `<: InPhaseSpacePoint` but **not** `<: OutPhaseSpacePoint`. | ||
""" | ||
function InPhaseSpacePoint( | ||
proc::PROC, model::MODEL, ps_def::PSDEF, in_ps::IN_PARTICLES | ||
) where { | ||
PROC<:QEDbase.AbstractProcessDefinition, | ||
MODEL<:QEDbase.AbstractModelDefinition, | ||
PSDEF<:QEDbase.AbstractPhasespaceDefinition, | ||
IN_PARTICLES<:Tuple{Vararg{ParticleStateful}}, | ||
} | ||
return PhaseSpacePoint(proc, model, ps_def, in_ps, ()) | ||
end | ||
|
||
""" | ||
OutPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
out_ps::Tuple{ParticleStateful}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) with only output particles from [`ParticleStateful`](@ref)s. The result will be `<: OutPhaseSpacePoint` but **not** `<: InPhaseSpacePoint`. | ||
""" | ||
function OutPhaseSpacePoint( | ||
proc::PROC, model::MODEL, ps_def::PSDEF, out_ps::OUT_PARTICLES | ||
) where { | ||
PROC<:QEDbase.AbstractProcessDefinition, | ||
MODEL<:QEDbase.AbstractModelDefinition, | ||
PSDEF<:QEDbase.AbstractPhasespaceDefinition, | ||
OUT_PARTICLES<:Tuple{Vararg{ParticleStateful}}, | ||
} | ||
return PhaseSpacePoint(proc, model, ps_def, (), out_ps) | ||
end | ||
|
||
# PSP constructors from momenta | ||
|
||
""" | ||
PhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_momenta::NTuple{N,QEDbase.AbstractFourMomentum}, | ||
out_momenta::NTuple{M,QEDbase.AbstractFourMomentum}, | ||
) | ||
Construct the phase space point from given momenta of incoming and outgoing particles regarding a given process. | ||
""" | ||
function PhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_momenta::NTuple{N,ELEMENT}, | ||
out_momenta::NTuple{M,ELEMENT}, | ||
) where {N,M,ELEMENT<:QEDbase.AbstractFourMomentum} | ||
in_particles = _build_particle_statefuls(proc, in_momenta, QEDbase.Incoming()) | ||
out_particles = _build_particle_statefuls(proc, out_momenta, QEDbase.Outgoing()) | ||
|
||
return PhaseSpacePoint(proc, model, ps_def, in_particles, out_particles) | ||
end | ||
|
||
""" | ||
InPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_momenta::NTuple{N,QEDbase.AbstractFourMomentum}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) with only input particles from given momenta. The result will be `<: InPhaseSpacePoint` but **not** `<: OutPhaseSpacePoint`. | ||
""" | ||
function InPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_momenta::NTuple{N,ELEMENT}, | ||
) where {N,ELEMENT<:QEDbase.AbstractFourMomentum} | ||
in_particles = _build_particle_statefuls(proc, in_momenta, QEDbase.Incoming()) | ||
|
||
return PhaseSpacePoint(proc, model, ps_def, in_particles, ()) | ||
end | ||
|
||
""" | ||
OutPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
out_momenta::NTuple{N,QEDbase.AbstractFourMomentum}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) with only output particles from given momenta. The result will be `<: OutPhaseSpacePoint` but **not** `<: InPhaseSpacePoint`. | ||
""" | ||
function OutPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
out_momenta::NTuple{N,ELEMENT}, | ||
) where {N,ELEMENT<:QEDbase.AbstractFourMomentum} | ||
out_particles = _build_particle_statefuls(proc, out_momenta, QEDbase.Outgoing()) | ||
|
||
return PhaseSpacePoint(proc, model, ps_def, (), out_particles) | ||
end | ||
|
||
# PSP constructors from coordinates | ||
|
||
""" | ||
PhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_coords::NTuple{N,Real}, | ||
out_coords::NTuple{M,Real}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) from given coordinates by using the [`_generate_momenta`](@ref) interface. | ||
""" | ||
function PhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_coords::NTuple{N,Real}, | ||
out_coords::NTuple{M,Real}, | ||
) where {N,M} | ||
in_ps, out_ps = _generate_momenta(proc, model, ps_def, in_coords, out_coords) | ||
return PhaseSpacePoint(proc, model, ps_def, in_ps, out_ps) | ||
end | ||
|
||
""" | ||
InPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_coords::NTuple{N,Real}, | ||
) | ||
Construct a [`PhaseSpacePoint`](@ref) from given coordinates by using the [`_generate_momenta`](@ref) interface. The result will be `<: InPhaseSpacePoint` but **not** `<: OutPhaseSpacePoint`. | ||
!!! note | ||
A similar function for [`OutPhaseSpacePoint`](@ref) does not exist from coordinates, only a full [`PhaseSpacePoint`](@ref). | ||
""" | ||
function InPhaseSpacePoint( | ||
proc::QEDbase.AbstractProcessDefinition, | ||
model::QEDbase.AbstractModelDefinition, | ||
ps_def::QEDbase.AbstractPhasespaceDefinition, | ||
in_coords::NTuple{N,Real}, | ||
) where {N} | ||
in_ps = _generate_incoming_momenta(proc, model, ps_def, in_coords) | ||
return InPhaseSpacePoint(proc, model, ps_def, in_ps) | ||
end |
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,58 @@ | ||
function Base.show(io::IO, ::SphericalCoordinateSystem) | ||
print(io, "spherical coordinates") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, ::CenterOfMomentumFrame) | ||
print(io, "center-of-momentum frame") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, ::ElectronRestFrame) | ||
print(io, "electron rest frame") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, m::MIME"text/plain", ps_def::PhasespaceDefinition) | ||
println(io, "PhasespaceDefinition") | ||
println(io, " coordinate system: $(ps_def.coord_sys)") | ||
println(io, " frame: $(ps_def.frame)") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, ps_def::PhasespaceDefinition) | ||
print(io, "$(ps_def.coord_sys) in $(ps_def.frame)") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, particle::ParticleStateful) | ||
print(io, "$(particle.dir) $(particle.species): $(particle.mom)") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, m::MIME"text/plain", particle::ParticleStateful) | ||
println(io, "ParticleStateful: $(particle.dir) $(particle.species)") | ||
println(io, " momentum: $(particle.mom)") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, psp::PhaseSpacePoint) | ||
print(io, "PhaseSpacePoint of $(psp.proc)") | ||
return nothing | ||
end | ||
|
||
function Base.show(io::IO, ::MIME"text/plain", psp::PhaseSpacePoint) | ||
println(io, "PhaseSpacePoint:") | ||
println(io, " process: $(psp.proc)") | ||
println(io, " model: $(psp.model)") | ||
println(io, " phasespace definition: $(psp.ps_def)") | ||
println(io, " incoming particles:") | ||
for p in psp.in_particles | ||
println(io, " -> $(p)") | ||
end | ||
println(io, " outgoing particles:") | ||
for p in psp.out_particles | ||
println(io, " -> $(p)") | ||
end | ||
return nothing | ||
end |
Oops, something went wrong.