Closed szabo137 closed 2 months ago
@steindev @tjungni If I did not forget something, this PR is ready from my side. I would appreciate some comments from your side. 🙆♂️
This seems like a lot of code duplication for not too much gain. If I understand correctly, the idea is to allow a new, different type of representation of the FourMomenta as input. So why not make the existing functions generically accept any
AbstractPhasespaceElement
and then a function (or multiple functions) that convert anAbstractPhasespaceElement
into a specific representation? The interface of this function could even completely generically allow to specify a target type, so if more types might be added later, the only thing that needs to be added are the relevant conversion function implementations. This function would then be the identity function if it's already the correct representation, and otherwise do whatever it needs to do. This would be the_generate_incoming_momenta()
I believe. Also, it might make sense to have this function only work on a single element and then broadcast where necessary, seems more flexible.
As we discussed offline, I think this is a great idea, which would avoid a lot of code duplication. However, I think it would be necessary to develop a full-fledged conversion system first, where any given phase-space element type can be converted into four-momenta as the default phase-space element type. Therefore I suggest proceeding with this PR as it is, but open an issue to address your idea. I think adding the phase-space conversion system later will not break the API, which means it should be fine to add it later.
Edit: The respective issue is #49
@AntonReinhard could you please check is something is left over here? If not, we could proceed with this one 😊
Problem description
Currently, differential cross-sections and probabilities can only computed on given momenta. However, in some cases, one wants to calculate those quantities directly on given phase-space parameterizations, i.e. independent coordinates.
Suggested solution
One might use multiple dispatch on the element type of the incoming and outgoing phase-space of
differential_cross_section
andprobability
to determine if coordinates or momenta are passed in. Furthermore, it seems sufficient to use the following implementation ofdifferential_cross_section
as the actual interface functionThe coordinate-based implementation of the differential cross-section should then fall back onto the momentum-based implementation by a phase-space generator, e.g.
which returns the respective vector or matrix of
SFourMomentum
. Using that, the default implementation of thedifferential_cross_section
readswhich works generically.
For the evaluation of cross sections and probabilities on sets of phase space points, the implementation is the same for momenta and coordinates. Therefore, this PR introduces a general phase space element type:
AbstractPhaseSpacePoint = Union{Real, AbstractFourMomentum}
.TODO