Skip to content

Commit

Permalink
Proposal for PhaseSpacePoint improvement (#63)
Browse files Browse the repository at this point in the history
Proposal for a rework of the PhaseSpacePoint, according to Issue #58

I did a lot of type magic with recursive variadic templates to find out
type information and get functions perfectly type stable. Constructing
phase space points is now always type stable and takes a maximum of
~11ns for me when constructing from momenta.

Some of the tests are failing for now because some of the interfaces
currently don't expect tuples from the PSP implementation. It might make
sense to fix this in #59

---------

Co-authored-by: Uwe Hernandez Acosta <u.hernandez@hzdr.de>
Co-authored-by: Uwe Hernandez Acosta <szabo137@users.noreply.github.com>
Co-authored-by: AntonReinhard <anton.reinhard@protonmail.com>
  • Loading branch information
4 people authored May 22, 2024
1 parent bc5f82c commit 80dbcc2
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 247 deletions.
3 changes: 1 addition & 2 deletions src/QEDprocesses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export AbstractCoordinateSystem, SphericalCoordinateSystem
export AbstractFrameOfReference, CenterOfMomentumFrame, ElectronRestFrame
export AbstractPhasespaceDefinition, PhasespaceDefinition
export ParticleStateful, PhaseSpacePoint
export spin, polarization, particle_direction, particle_species, momentum, getindex
export generate_phase_space
export spin, polarization, particle_direction, particle_species, momentum, momenta, getindex

# specific compute models
export PerturbativeQED
Expand Down
2 changes: 1 addition & 1 deletion src/cross_section/diff_cross_section.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
########################

function _incident_flux(psp::PhaseSpacePoint)
return _incident_flux(psp.proc, psp.model, momentum.(psp.in_particles))
return _incident_flux(psp.proc, psp.model, momenta(psp, Incoming()))
end

"""
Expand Down
16 changes: 4 additions & 12 deletions src/cross_section/internal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ function _unsafe_differential_probability(
in_phase_space::AbstractVector{T},
out_phase_space::AbstractVector{T},
) where {T<:QEDbase.AbstractFourMomentum}
psp = generate_phase_space(
proc, model, phase_space_def, in_phase_space, out_phase_space
)
psp = PhaseSpacePoint(proc, model, phase_space_def, in_phase_space, out_phase_space)
return unsafe_differential_probability(psp)
end

Expand Down Expand Up @@ -45,9 +43,7 @@ function _differential_probability(
in_phase_space::AbstractVector{T},
out_phase_space::AbstractVector{T},
) where {T<:QEDbase.AbstractFourMomentum}
psp = generate_phase_space(
proc, model, phase_space_def, in_phase_space, out_phase_space
)
psp = PhaseSpacePoint(proc, model, phase_space_def, in_phase_space, out_phase_space)
return differential_probability(psp)
end

Expand Down Expand Up @@ -79,9 +75,7 @@ function _unsafe_differential_cross_section(
in_phase_space::AbstractVector{T},
out_phase_space::AbstractVector{T},
) where {T<:QEDbase.AbstractFourMomentum}
psp = generate_phase_space(
proc, model, phase_space_def, in_phase_space, out_phase_space
)
psp = PhaseSpacePoint(proc, model, phase_space_def, in_phase_space, out_phase_space)
return unsafe_differential_cross_section(psp)
end

Expand Down Expand Up @@ -114,9 +108,7 @@ function _differential_cross_section(
in_phase_space::AbstractVector{T},
out_phase_space::AbstractVector{T},
) where {T<:QEDbase.AbstractFourMomentum}
psp = generate_phase_space(
proc, model, phase_space_def, in_phase_space, out_phase_space
)
psp = PhaseSpacePoint(proc, model, phase_space_def, in_phase_space, out_phase_space)
return differential_cross_section(psp)
end

Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/process_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ function _phase_space_factor end
#######################

"""
number_incoming_particles(proc_def::AbstractProcessDefinition)
Return the number of incoming particles of a given process.
Expand All @@ -150,7 +149,6 @@ Return the number of incoming particles of a given process.
end

"""
number_outgoing_particles(proc_def::AbstractProcessDefinition)
Return the number of outgoing particles of a given process.
Expand Down
Loading

0 comments on commit 80dbcc2

Please sign in to comment.