Mocking
Momenta
QEDbase.Mocks.MockMomentum
— Typestruct MockMomentum{T} <: AbstractMockMomentum{T}
A concrete implementation of a four-momentum with immutable components.
Fields
E::T
: Energy component.px::T
: Momentum component in the x-direction.py::T
: Momentum component in the y-direction.pz::T
: Momentum component in the z-direction.
Example
p = MockMomentum(10.0, 1.0, 2.0, 3.0)
QEDbase.Mocks.MockMomentumMutable
— Typemutable struct MockMomentumMutable{T} <: AbstractMockMomentum{T}
A concrete implementation of a four-momentum with mutable components.
Fields
E::T
: Energy component.px::T
: Momentum component in the x-direction.py::T
: Momentum component in the y-direction.pz::T
: Momentum component in the z-direction.
Unlike MockMomentum
, this struct allows modifying individual momentum components.
Example
p = MockMomentumMutable(10.0, 1.0, 2.0, 3.0)
QEDbase.setT!(p, 12.0) # Modify energy
Model
QEDbase.Mocks.MockModel
— Typestruct MockModel <: AbstractModelDefinition
A mock model definition used for testing and validation purposes.
This model serves as a placeholder within the framework, returning a predefined interaction type when queried.
Methods
QEDbase.fundamental_interaction_type(::MockModel)
: Returns the fundamental interaction type by calling_groundtruth_interaction_type()
.
Example
model = MockModel()
interaction_type = QEDbase.fundamental_interaction_type(model)
# Output: :mock_interaction
QEDbase.Mocks.MockModel_FAIL
— Typestruct MockModel_FAIL <: AbstractModelDefinition
A mock model definition intended to represent an incorrect or failing model.
This type can be used in tests to verify error handling and robustness of the framework when encountering invalid models.
Usage
MockModel_FAIL
does not define fundamental_interaction_type
and can be used to test behavior when a model lacks proper definitions.
Example
model_fail = MockModel_FAIL()
# This may trigger an error if the framework expects a valid interaction type.
QEDbase.Mocks._groundtruth_interaction_type
— Function_groundtruth_interaction_type()::Symbol
Returns the type of interaction associated with the mock setup.
Coordinate transformations
QEDbase.Mocks.MockCoordinateTrafo
— TypeMockCoordinateTrafo <: AbstractCoordinateTransformation
A mock coordinate transformation that scales all momentum components by a factor of 2.
This transformation internally calls _groundtruth_coord_trafo
.
Usage
This type is used as a coordinate transformation within the context of QEDbase
, applying _groundtruth_coord_trafo
to momenta.
Example
p = MockMomentum(rand(4))
trafo = MockCoordinateTrafo()
transformed_p = trafo(p)
QEDbase.Mocks._groundtruth_coord_trafo
— Function_groundtruth_coord_trafo(p::AbstractMockMomentum)::AbstractMockMomentum
_groundtruth_coord_trafo(psp::MockPhaseSpacePoint)::MockPhaseSpacePoint
Applies a coordinate transformation to a given momentum p
by multiplying it by 2. If a phase space point is given, the transformation is applied to all momenta.
Cross Section/Probability
QEDbase.Mocks._groundtruth_incident_flux
— Function_groundtruth_incident_flux(in_ps)
Mock implementation of the incident flux. Return the Minkowski square of the sum of the incoming momenta:
\[\begin{align} I = \left(\sum p_i\right)^2, \end{align}\]
where $p_i\in\mathrm{ps_in}$.
QEDbase.Mocks._groundtruth_matrix_element
— Function_groundtruth_matrix_element(in_ps, out_ps)
Mock implementation for a matrix elements. Returns a list of three complex numbers without any physical meaning.
QEDbase.Mocks._groundtruth_averaging_norm
— Function_groundtruth_averaging_norm(proc)
Mock implementation of the averaging norm. Returns the inverse of the sum of all external particles of the passed process.
QEDbase.Mocks._groundtruth_is_in_phasespace
— Function_groundtruth_is_in_phasespace(in_ps, out_ps)
Mock implementation of the phase space check. Return false
if either the momentum of the first incoming particle is exactly zero(SFourMomentum)
, or if the momentum of the last outgoing momentum is exactly ones(SFourMomentum)
. Otherwise, return true.
QEDbase.Mocks._groundtruth_phase_space_factor
— Function_groundtruth_phase_space_factor(in_ps, out_ps)
Mock implementation of the phase space factor. Return the inverse of the product of the energies of all external particles.
QEDbase.Mocks._groundtruth_unsafe_probability
— Function_groundtruth_unsafe_probability(proc, in_ps, out_ps)
Mock implementation of the unsafe differential probability. Uses the test implementations of _groundtruth_matrix_element
,_groundtruth_averaging_norm
and _groundtruth_phase_space_factor
.
QEDbase.Mocks._groundtruth_safe_probability
— Function_groundtruth_safe_probability(proc, in_ps, out_ps)
Mock implementation of the safe differential probability. Uses the test implementations of _groundtruth_is_in_phasespace
and _groundtruth_unsafe_probability
.
QEDbase.Mocks._groundtruth_unsafe_diffCS
— Function_groundtruth_unsafe_diffCS(proc, in_ps, out_ps)
Mock implementation of the unsafe differential cross section. Uses the test implementations of _groundtruth_incident_flux
and _groundtruth_unsafe_probability
.
QEDbase.Mocks._groundtruth_safe_diffCS
— Function_groundtruth_safe_diffCS(proc, in_ps, out_ps)
Mock implementation of the safe differential cross section. Uses the test implementations of _groundtruth_is_in_phasespace
and _groundtruth_unsafe_diffCS
.
QEDbase.Mocks._groundtruth_total_probability
— Function_groundtruth_total_probability(in_ps::AbstractVector)
Mock implementation of the total cross section. Return the Minkowski square of the sum the momenta of all incoming particles.
Phase Space Layout
QEDbase.Mocks._groundtruth_in_moms
— Function_groundtruth_in_moms(in_coords,mom_type)
Mock implementation for building incoming momenta. Maps all components into four momenta.
QEDbase.Mocks._groundtruth_out_moms
— Function_groundtruth_out_moms(Ptot,out_coords,mom_type)
Mock implementation for building outgoing momenta. Maps all components into four momenta and adds the last momentum via energy momentum conservation.
Phase Space Point
QEDbase.Mocks.MockProcess
— TypeMockProcess(rng,incoming_particles,outgoing_particles)
QEDbase.Mocks.MockProcessSP
— TypeMockProcessSP
Process for testing with settable spin and polarization.
QEDbase.Mocks.MockProcess_FAIL_ALL
— TypeMock process with no implemented interface. Should fail every usage except construction.
QEDbase.Mocks.MockProcess_FAIL_DIFFCS
— TypeMock process with no implemented interface except the incoming and outgoing particles. Should fail every usage except construction of itself and the respective phase space point for given four-momenta.
Random Mock Momenta
QEDbase.Mocks._rand_momenta
— FunctionReturn a tuple of random four momenta, i.e. a random phase space point.
Return a vector of tuples of random four momenta, i.e. a collection of phase space points. n1 is the size of the phase space point, n2 is the number of points.
QEDbase.Mocks._rand_in_momenta_failing
— FunctionReturn a random phase space point that is failing the incoming phase space constraint, i.e. the first entry of the phase space is the null momentum.
QEDbase.Mocks._rand_out_momenta_failing
— FunctionReturn a random phase space point that is failing the outgoing phase space constraint, i.e. the last entry of the phase space is the unit momentum.
QEDbase.Mocks._rand_in_momenta_failing_mix
— FunctionReturn a collection of incoming phase space points, where the first point is failing the phase space constraint, i.e. the first entry of the vector is invalid but the others pass. n1 is the size of the phase space point, n2 is the number of points.
QEDbase.Mocks._rand_in_momenta_failing_all
— FunctionReturn a collection of incoming phase space points, where all points are failing the phase space constraint, i.e. their first entries are null momenta. n1 is the size of the phase space point, n2 is the number of points.
QEDbase.Mocks._rand_out_momenta_failing_mix
— FunctionReturn a vector of outgoing phase space points, where the first point is failing the phase space constraint, i.e. the last entry of the vector is invalid but the others pass. n1 is the size of the phase space point, n2 is the number of points.
QEDbase.Mocks._rand_out_momenta_failing_all
— FunctionReturn a vector of outgoing phase space points, where all points are failing the phase space constraint, i.e. their last entries are unit momenta. n1 is the size of the phase space point, n2 is the number of points.