Skip to content

Draft: Proposing faster eta calculation for `Amg::Vector3D`

During the changes included for the Calo GPU Clustering in !62160 (merged), an expression to calculate η from the Cartesian coordinates of a vector was deduced. Mathematically, this will be equivalent to the current implementation, which calls tan(atan2(sqrt(x*x + y*y), z)/2), without evaluating the rather expensive trigonometric functions, with the only expected differences coming from floating point accuracy.

The mathematical reasoning is explained in the comment added to the relevant section of the code, but the gist of it is that we can leverage the half-tangent formula and the geometrical interpretation of the trigonometric functions to express the quantity we want as just an algebraic function of x, y and z.

Though no specific performance measurement has been carried out yet, it is expected that this change will result in some gains given that we are side-stepping the evaluation of two rather expensive functions.

The purpose of the present merge request is, above all, to gauge receptiveness to this change, given its potentially far-reaching consequences.

cc @wlampl @ssnyder @mhodgkin @christos

Edited by Frank Winklmeier

Merge request reports