Scattering Process Interface
Process Interface
QEDbase.AbstractProcessDefinition
— TypeAbstract base type for definitions of scattering processes. It is the root type for the process interface, which assumes that every subtype of AbstractProcessDefinition
implements at least
incoming_particles(proc_def::AbstractProcessDefinition)
outgoing_particles(proc_def::AbstractProcessDefinition)
which return a tuple of the incoming and outgoing particles, respectively.
An AbstractProcessDefinition
is also expected to contain spin and polarization information of its particles. For this, the functions
incoming_spin_pols(proc_def::AbstractProcessDefinition)
outgoing_spin_pols(proc_def::AbstractProcessDefinition)
can be overloaded. They must return a tuple of [AbstractSpinOrPolarization
], where the order must match the order of the process' particles. A default implementation is provided which assumes AllSpin
for every is_fermion
particle and AllPolarization
for every is_boson
particle.
!!! note Performance It is very beneficial for the performance of derived functions if these functions return compile-time-known values.
On top of these spin and polarization functions, the following functions are automatically defined:
multiplicity(proc_def::AbstractProcessDefinition)
incoming_multiplicity(proc_def::AbstractProcessDefinition)
outgoing_multiplicity(proc_def::AbstractProcessDefinition)
Which return the number of spin and polarization combinations that should be considered for the process. For more detail, refer to the functions' documentations.
Furthermore, to calculate scattering probabilities and differential cross sections, the following interface functions need to be implemented for every combination of CustomProcess<:AbstractProcessDefinition
, CustomModel<:AbstractModelDefinition
, and CustomPhasespaceDefinition<:AbstractPhasespaceDefinition
.
_incident_flux(psp::InPhaseSpacePoint{CustomProcess,CustomModel})
_matrix_element(psp::PhaseSpacePoint{CustomProcess,CustomModel})
_averaging_norm(proc::CustomProcess)
_is_in_phasespace(psp::PhaseSpacePoint{CustomProcess,CustomModel})
_phase_space_factor(psp::PhaseSpacePoint{CustomProcess,CustomModel,CustomPhasespaceDefinition})
Optional is the implementation of
_total_probability(psp::PhaseSpacePoint{CustomProcess,CustomModel,CustomPhasespaceDefinition})
to enable the calculation of total probabilities and cross sections.
QEDbase.incoming_particles
— Functionincoming_particles(proc_def::AbstractProcessDefinition)
Interface function for scattering processes. Return a tuple of the incoming particles for the given process definition. This function needs to be given to implement the scattering process interface.
!!! note Performance It is very beneficial for the performance of derived functions if this function returns compile-time-known values.
See also: AbstractParticleType
QEDbase.outgoing_particles
— Functionoutgoing_particles(proc_def::AbstractProcessDefinition)
Interface function for scattering processes. Return the tuple of outgoing particles for the given process definition. This function needs to be given to implement the scattering process interface.
!!! note Performance It is very beneficial for the performance of derived functions if this function returns compile-time-known values.
See also: AbstractParticleType
QEDbase.incoming_spin_pols
— Functionincoming_spin_pols(proc_def::AbstractProcessDefinition)
Interface function for scattering processes. Return the tuple of spins or polarizations for the given process definition. The order must be the same as the particles returned from incoming_particles
. A default implementation is provided, returning AllSpin
for every is_fermion
and AllPolarization
for every is_boson
.
!!! note Performance It is very beneficial for the performance of derived functions if this function returns compile-time-known values.
See also: AbstractSpinOrPolarization
QEDbase.outgoing_spin_pols
— Functionoutgoing_spin_pols(proc_def::AbstractProcessDefinition)
Interface function for scattering processes. Return the tuple of spins or polarizations for the given process definition. The order must be the same as the particles returned from outgoing_particles
. A default implementation is provided, returning AllSpin
for every is_fermion
and AllPolarization
for every is_boson
.
!!! note Performance It is very beneficial for the performance of derived functions if this function returns compile-time-known values.
See also: AbstractSpinOrPolarization
Particle Directions
QEDbase.ParticleDirection
— TypeAbstract base type for the directions of particles in the context of processes, i.e. either they are incoming or outgoing. Subtypes of this are mostly used for dispatch.
QEDbase.Incoming
— TypeIncoming <: ParticleDirection
Concrete implementation of a ParticleDirection
to indicate that a particle is incoming in the context of a given process. Mostly used for dispatch.
julia> using QEDbase
julia> Incoming()
incoming
Besides being a subtype of ParticleDirection
, Incoming
has
is_incoming(::Incoming) = true
is_outgoing(::Incoming) = false
QEDbase.Outgoing
— TypeOutgoing <: ParticleDirection
Concrete implementation of a ParticleDirection
to indicate that a particle is outgoing in the context of a given process. Mostly used for dispatch.
julia> using QEDbase
julia> Outgoing()
outgoing
Besides being a subtype of ParticleDirection
, Outgoing
has
is_incoming(::Outgoing) = false
is_outgoing(::Outgoing) = true
QEDbase.UnknownDirection
— TypeUnknownDirection <: ParticleDirection
Concrete implementation of a ParticleDirection
to indicate that a particle has an unknown direction. This can mean that a specific direction does not make sense in the given context, that the direction is unavailable, or that it is unnecessary.
julia> using QEDbase
julia> UnknownDirection()
unknown direction
Besides being a subtype of ParticleDirection
, UnknownDirection
has
is_incoming(::UnknownDirection) = false
is_outgoing(::UnknownDirection) = false
QEDbase.is_incoming
— Functionis_incoming(dir::ParticleDirection)
is_incoming(particle::AbstractParticleStateful)
Convenience function that returns true for Incoming
and incoming AbstractParticleStateful
and false otherwise.
QEDbase.is_outgoing
— Functionis_outgoing(dir::ParticleDirection)
is_outgoing(particle::AbstractParticleStateful)
Convenience function that returns true for Outgoing
and outgoing AbstractParticleStateful
and false otherwise.
Spins and Polarizations
QEDbase.AbstractSpinOrPolarization
— TypeAbstract base type for the spin or polarization of particles with is_fermion
or is_boson
, respectively.
QEDbase.spin_pols_iter
— Functionall_spin_pols(process::AbstractProcessDefinition)
This function returns an iterator, yielding every fully definite combination of spins and polarizations allowed by the process' spin_pols
. Each returned element is a Tuple of the incoming and the outgoing spins and polarizations, in the order of the process' own spins and polarizations.
This works together with the definite spins and polarizations, AllSpin
, AllPolarization
, and the synced versions SyncedPolarization
and SyncedSpin
.
julia> using QEDbase; using QEDcore; using QEDprocesses;
julia> proc = ScatteringProcess((Photon(), Photon(), Photon(), Electron()), (Photon(), Electron()), (SyncedPolarization(1), SyncedPolarization(2), SyncedPolarization(1), SpinUp()), (SyncedPolarization(2), AllSpin()))
generic QED process
incoming: photon (synced polarization 1), photon (synced polarization 2), photon (synced polarization 1), electron (spin up)
outgoing: photon (synced polarization 2), electron (all spins)
julia> for sp_combo in spin_pols_iter(proc) println(sp_combo) end
((x-polarized, x-polarized, x-polarized, spin up), (x-polarized, spin up))
((y-polarized, x-polarized, y-polarized, spin up), (x-polarized, spin up))
((x-polarized, y-polarized, x-polarized, spin up), (y-polarized, spin up))
((y-polarized, y-polarized, y-polarized, spin up), (y-polarized, spin up))
((x-polarized, x-polarized, x-polarized, spin up), (x-polarized, spin down))
((y-polarized, x-polarized, y-polarized, spin up), (x-polarized, spin down))
((x-polarized, y-polarized, x-polarized, spin up), (y-polarized, spin down))
((y-polarized, y-polarized, y-polarized, spin up), (y-polarized, spin down))
julia> length(spin_pols_iter(proc))
8
Spins
QEDbase.AbstractSpin
— TypeAbstract base type for the spin of particles with is_fermion
.
QEDbase.AbstractDefiniteSpin
— TypeAbstract base type for definite spins of particles with is_fermion
.
QEDbase.AbstractIndefiniteSpin
— TypeAbstract base type for indefinite spins of particles with is_fermion
.
One concrete type is AllSpin
.
QEDbase.SpinUp
— TypeConcrete type indicating that a particle with is_fermion
has spin-up.
julia> using QEDbase
julia> SpinUp()
spin up
QEDbase.SpinDown
— TypeConcrete type indicating that a particle with is_fermion
has spin-down.
julia> using QEDbase
julia> SpinDown()
spin down
QEDbase.AllSpin
— TypeConcrete type indicating that a particle with is_fermion
has an indefinite spin and the differential cross section calculation should average or sum over all spins, depending on the direction (Incoming
or Outgoing
) of the particle in question.
julia> using QEDbase
julia> AllSpin()
all spins
QEDbase.SyncedSpin
— TypeSyncedSpin{N::Int} <: AbstractIndefiniteSpin
An indefinite spin type, indicating that multiple particles have a synced spin. Two spins are considered synced when they have the same value for N
. This means that the resulting multiplicity will be 2 total for all particles with the same SyncedSpin
.
Having a single SyncedSpin{N}
in a process is legal. In this case, it behaves just like an AllSpin
would.
See also: multiplicity
Polarization
QEDbase.AbstractPolarization
— TypeAbstract base type for the polarization of particles with is_boson
.
QEDbase.AbstractDefinitePolarization
— TypeAbstract base type for definite polarization of particles with is_boson
.
Concrete types are PolarizationX
and PolarizationY
.
QEDbase.AbstractIndefinitePolarization
— TypeAbstract base type for indefinite polarization of particles with is_boson
.
One concrete type is AllPolarization
.
QEDbase.PolarizationX
— TypeConcrete type which indicates, that a particle with is_boson
has polarization in $x$-direction.
julia> using QEDbase
julia> PolX()
x-polarized
The notion of axes, e.g. $x$- and $y$-direction is just to distinguish two orthogonal polarization directions. However, if the three-momentum of the particle with is_boson
is aligned to the $z$-axis of a coordinate system, the polarization axes define the $x$- or $y$-axis, respectively.
There is a built-in alias for PolarizationX
:
julia> using QEDbase
julia> PolarizationX === PolX
true
QEDbase.PolX
— TypeConcrete type which indicates, that a particle with is_boson
has polarization in $x$-direction.
julia> using QEDbase
julia> PolX()
x-polarized
The notion of axes, e.g. $x$- and $y$-direction is just to distinguish two orthogonal polarization directions. However, if the three-momentum of the particle with is_boson
is aligned to the $z$-axis of a coordinate system, the polarization axes define the $x$- or $y$-axis, respectively.
There is a built-in alias for PolarizationX
:
julia> using QEDbase
julia> PolarizationX === PolX
true
QEDbase.PolarizationY
— TypeConcrete type which indicates, that a particle with is_boson
has polarization in $y$-direction.
julia> using QEDbase
julia> PolY()
y-polarized
The notion of axes, e.g. $x$- and $y$-direction is just to distinguish two orthogonal polarization directions. However, if the three-momentum of the particle with is_boson
is aligned to the $z$-axis of a coordinate system, the polarization axes define the $x$- or $y$-axis, respectively.
There is a built-in alias for PolarizationY
:
julia> using QEDbase
julia> PolarizationY === PolY
true
QEDbase.PolY
— TypeConcrete type which indicates, that a particle with is_boson
has polarization in $y$-direction.
julia> using QEDbase
julia> PolY()
y-polarized
The notion of axes, e.g. $x$- and $y$-direction is just to distinguish two orthogonal polarization directions. However, if the three-momentum of the particle with is_boson
is aligned to the $z$-axis of a coordinate system, the polarization axes define the $x$- or $y$-axis, respectively.
There is a built-in alias for PolarizationY
:
julia> using QEDbase
julia> PolarizationY === PolY
true
QEDbase.AllPolarization
— TypeConcrete type indicating that a particle with is_boson
has an indefinite polarization and the differential cross section calculation should average or sum over all polarizations, depending on the direction (Incoming
or Outgoing
) of the particle in question.
julia> using QEDbase
julia> AllPol()
all polarizations
There is a built-in alias for AllPolarization
:
julia> using QEDbase
julia> AllPolarization === AllPol
true
QEDbase.AllPol
— TypeConcrete type indicating that a particle with is_boson
has an indefinite polarization and the differential cross section calculation should average or sum over all polarizations, depending on the direction (Incoming
or Outgoing
) of the particle in question.
julia> using QEDbase
julia> AllPol()
all polarizations
There is a built-in alias for AllPolarization
:
julia> using QEDbase
julia> AllPolarization === AllPol
true
QEDbase.SyncedPolarization
— TypeSyncedPolarization{N::Int} <: AbstractIndefinitePolarization
An indefinite polarization type, indicating that multiple particles have a synced polarization. Two polarizations are considered synced when they have the same value for N
. This means that the resulting multiplicity will be 2 total for all particles with the same SyncedPolarization
.
Having a single SyncedPolarization{N}
in a process is legal. In this case, it behaves just like an AllPolarization
would.
See also: multiplicity
Utility Functions
QEDbase.number_incoming_particles
— Functionnumber_incoming_particles(proc_def::AbstractProcessDefinition)
Return the number of incoming particles of a given process.
QEDbase.number_outgoing_particles
— Functionnumber_outgoing_particles(proc_def::AbstractProcessDefinition)
Return the number of outgoing particles of a given process.
QEDbase.particles
— Functionparticles(proc_def::AbstractProcessDefinition, ::ParticleDirection)
Convenience function dispatching to incoming_particles
or outgoing_particles
depending on the given direction.
QEDbase.number_particles
— Functionnumber_particles(proc_def::AbstractProcessDefinition, dir::ParticleDirection)
Convenience function dispatching to number_incoming_particles
or number_outgoing_particles
depending on the given direction, returning the number of incoming or outgoing particles, respectively.
number_particles(proc_def::AbstractProcessDefinition, dir::ParticleDirection, species::AbstractParticleType)
Return the number of particles of the given direction and species in the given process definition.
number_particles(proc_def::AbstractProcessDefinition, particle::AbstractParticleStateful)
Return the number of particles of the given particle's direction and species in the given process definition.
QEDbase.spin_pols
— Functionspin_pols(proc_def::AbstractProcessDefinition, dir::ParticleDirection)
Return the tuple of spins and polarizations for the process in the given direction. Dispatches to incoming_spin_pols
or outgoing_spin_pols
.
QEDbase.multiplicity
— Functionmultiplicity(proc::AbstractProcessDefinition)
Return the number of spin and polarization combinations represented by proc
total. This depends on the specific AbstractSpinOrPolarization
s returned by spin_pols
for proc
. For example, a default Compton process with four indefinite spins/polarizations has a multiplicity of 2^4 = 16. A Compton process with many incoming photons that have synced polarizations will still have a multiplicity of 16.
!!! note Performance As long as incoming_spin_pols
and outgoing_spin_pols
can be evaluated at compile time, this function is completely compiled away.
!!! note Incoming and Outgoing Spins/Polarizations Note that the total multiplicity is not necessarily the incoming and outgoing multiplicities multiplied. This is the case when incoming and outgoing particles are synced with one another.
See also: SyncedPolarization
, SyncedSpin
, incoming_multiplicity
, outgoing_multiplicity
QEDbase.incoming_multiplicity
— Functionincoming_multiplicity(proc::AbstractProcessDefinition)
Return the number of spin and polarization combinations represented by proc
s incoming particles. This function only considers the incoming particles' spins and polarizations, returned by incoming_spin_pols
for proc
.
!!! note Incoming and Outgoing Spins/Polarizations Note that the total multiplicity is not necessarily the incoming and outgoing multiplicities multiplied. For the total process multiplicity, see multiplicity
.
See also: SyncedPolarization
, SyncedSpin
, multiplicity
, outgoing_multiplicity
QEDbase.outgoing_multiplicity
— Functionoutgoing_multiplicity(proc::AbstractProcessDefinition)
Return the number of spin and polarization combinations represented by proc
s outgoing particles. This function only considers the outgoing particles' spins and polarizations, returned by outgoing_spin_pols
for proc
.
!!! note Incoming and Outgoing Spins/Polarizations Note that the total multiplicity is not necessarily the incoming and outgoing multiplicities multiplied. For the total process multiplicity, see multiplicity
.
See also: SyncedPolarization
, SyncedSpin
, multiplicity
, incoming_multiplicity