Skip to content

Commit

Permalink
Fix the interface for momentum generation (QEDjl-project#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed Jul 11, 2024
1 parent 0046cbf commit bc069be
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
25 changes: 14 additions & 11 deletions src/interfaces/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ end
#####

"""
_generate_incoming_momenta
_generate_incoming_momenta(
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
phase_space_def::AbstractPhasespaceDefinition,
Expand All @@ -242,25 +242,26 @@ Interface function to generate the four-momenta of the incoming particles from c
function _generate_incoming_momenta end

"""
_generate_outgoing_momenta
_generate_outgoing_momenta(
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
phase_space_def::AbstractPhasespaceDefinition,
out_phase_space::NTuple{N,T},
) where {N,T<:Real}
in_phase_space::NTuple{N,T},
out_phase_space::NTuple{M,T},
) where {N,M,T<:Real}
Interface function to generate the four-momenta of the outgoing particles from coordinates for a given phase-space definition.
"""
function _generate_outgoing_momenta end

"""
_generate_momenta(
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
phase_space_def::AbstractPhasespaceDefinition,
in_phase_space::NTuple{N,T},
out_phase_space::NTuple{M,T},
) where {N,M,T<:Real}
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
phase_space_def::AbstractPhasespaceDefinition,
in_phase_space::NTuple{N,T},
out_phase_space::NTuple{M,T},
) where {N,M,T<:Real}
Return four-momenta for incoming and outgoing particles for given coordinate based phase-space points.
"""
Expand All @@ -272,7 +273,9 @@ function _generate_momenta(
out_phase_space::NTuple{M,T},
) where {N,M,T<:Real}
in_momenta = _generate_incoming_momenta(proc, model, phase_space_def, in_phase_space)
out_momenta = _generate_outgoing_momenta(proc, model, phase_space_def, out_phase_space)
out_momenta = _generate_outgoing_momenta(
proc, model, phase_space_def, in_phase_space, out_phase_space
)

return in_momenta, out_momenta
end
21 changes: 11 additions & 10 deletions test/test_implementation/test_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,30 @@ struct TestPhasespaceDef_FAIL <: AbstractPhasespaceDefinition end
# dummy implementation of the process interface

function QEDbase._incident_flux(in_psp::InPhaseSpacePoint{<:TestProcess,<:TestModel})
return _groundtruth_incident_flux(momenta(in_psp, QEDbase.Incoming()))
return _groundtruth_incident_flux(momenta(in_psp, Incoming()))
end

function QEDbase._averaging_norm(proc::TestProcess)
return _groundtruth_averaging_norm(proc)
end

function QEDbase._matrix_element(psp::PhaseSpacePoint{<:TestProcess,TestModel})
in_ps = momenta(psp, QEDbase.Incoming())
out_ps = momenta(psp, QEDbase.Outgoing())
in_ps = momenta(psp, Incoming())
out_ps = momenta(psp, Outgoing())
return _groundtruth_matrix_element(in_ps, out_ps)
end

function QEDbase._is_in_phasespace(psp::PhaseSpacePoint{<:TestProcess,TestModel})
in_ps = momenta(psp, QEDbase.Incoming())
out_ps = momenta(psp, QEDbase.Outgoing())
in_ps = momenta(psp, Incoming())
out_ps = momenta(psp, Outgoing())
return _groundtruth_is_in_phasespace(in_ps, out_ps)
end

function QEDbase._phase_space_factor(
psp::PhaseSpacePoint{<:TestProcess,TestModel,TestPhasespaceDef}
)
in_ps = momenta(psp, QEDbase.Incoming())
out_ps = momenta(psp, QEDbase.Outgoing())
in_ps = momenta(psp, Incoming())
out_ps = momenta(psp, Outgoing())
return _groundtruth_phase_space_factor(in_ps, out_ps)
end

Expand All @@ -119,13 +119,14 @@ function QEDbase._generate_outgoing_momenta(
proc::TestProcess,
model::TestModel,
phase_space_def::TestPhasespaceDef,
out_phase_space::NTuple{N,T},
) where {N,T<:Real}
in_phase_space::NTuple{N,T},
out_phase_space::NTuple{M,T},
) where {N,M,T<:Real}
return _groundtruth_generate_momenta(out_phase_space)
end

function QEDbase._total_probability(
in_psp::InPhaseSpacePoint{<:TestProcess,<:TestModel,<:TestPhasespaceDef}
)
return _groundtruth_total_probability(momenta(in_psp, QEDbase.Incoming()))
return _groundtruth_total_probability(momenta(in_psp, Incoming()))
end

0 comments on commit bc069be

Please sign in to comment.