Interpolation

Interpolation class for \(\eta\) Interpolation.

The Interpolator class provides methods to interpolate the positions of photons based on their \(\eta\) values.

Warning

The interpolation might lead to erroneous photon positions for clusters at the boarders of a frame. Make sure to filter out such cases.

\(\eta\)-Functions:

template<typename T>
struct Eta2

eta struct

Public Members

double x = {}

eta in x direction

double y = {}

eta in y direction

corner c = {0}

index of subcluster given as corner relative to cluster center

T sum = {}

photon energy (cluster sum)

Note

The corner value c is only relevant when one uses calculate_eta_2 or calculate_full_eta2. Otherwise its default value is cTopLeft.

Supported are the following \(\eta\)-functions:

Eta2x2
\[\begin{equation*} {\color{blue}{\eta_x}} = \frac{Q_{1,1}}{Q_{1,0} + Q_{1,1}} \quad \quad {\color{green}{\eta_y}} = \frac{Q_{1,1}}{Q_{0,1} + Q_{1,1}} \end{equation*}\]
template<typename ClusterType, typename = std::enable_if_t<is_cluster_v<ClusterType>>>
std::vector<Eta2<typename ClusterType::value_type>> aare::calculate_eta2(const ClusterVector<ClusterType> &clusters)

Calculate the eta2 values for all clusters in a ClusterVector.

template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = uint16_t>
Eta2<T> aare::calculate_eta2(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &cl)

Calculate the eta2 values for a generic sized cluster and return them in a Eta2 struct containing etay, etax and the index (as corner) of the respective 2x2 subcluster relative to the cluster center.

Eta2x2 Full
\[\begin{equation*} {\color{blue}{\eta_x}} = \frac{Q_{0,1} + Q_{1,1}}{\sum_i^{2}\sum_j^{2}Q_{i,j}} \quad \quad {\textcolor{green}{\eta_y}} = \frac{Q_{1,0} + Q_{1,1}}{\sum_i^{2}\sum_j^{2}Q_{i,j}} \end{equation*}\]
template<typename ClusterType, typename = std::enable_if_t<is_cluster_v<ClusterType>>>
std::vector<Eta2<typename ClusterType::value_type>> aare::calculate_full_eta2(const ClusterVector<ClusterType> &clusters)

Calculate the full eta2 values for all clusters in a ClusterVector.

template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType>
Eta2<T> aare::calculate_full_eta2(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &cl)

Calculate the eta2 values for a generic sized cluster and return them in a Eta2 struct containing etay, etax and the index (as corner) of the respective 2x2 subcluster relative to the cluster center.

Eta3x3
\[\begin{equation*} {\color{blue}{\eta_x}} = \frac{\sum_{i}^{3} Q_{i,2} - \sum_{i}^{3} Q_{i,0}}{\sum_{i}^{3}\sum_{j}^{3} Q_{i,j}} \quad \quad {\color{green}{\eta_y}} = \frac{\sum_{j}^{3} Q_{2,j} - \sum_{j}^{3} Q_{0,j}}{\sum_{i}^{3}\sum_{j}^{3} Q_{i,j}} \end{equation*}\]

Warning

doxygenfunction: Unable to resolve function “aare::calculate_eta3” with arguments (const ClusterVector<Cluster<T, 3, 3, CoordType>>&) in doxygen xml output for project “aare” from directory: /home/runner/work/aare/aare/build/docs/xml. Potential matches:

- template<typename ClusterType, typename = std::enable_if_t<is_cluster_v<ClusterType>>> std::vector<Eta2<typename ClusterType::value_type>> calculate_eta3(const ClusterVector<ClusterType> &clusters)
- template<typename T, typename CoordType = uint16_t> Eta2<T> calculate_eta3(const Cluster<T, 3, 3, CoordType> &cl)
- template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = uint16_t> Eta2<T> calculate_eta3(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &cl)
template<typename T, typename CoordType = uint16_t>
Eta2<T> aare::calculate_eta3(const Cluster<T, 3, 3, CoordType> &cl)

calculates Eta3 for 3x3 cluster It calculates the eta by taking into account all pixels in the 3x3 cluster

Cross Eta3x3
\[\begin{equation*} {\color{blue}{\eta_x}} = \frac{Q_{1,2} - Q_{1,0}}{Q_{1,0} + Q_{1,1} + Q_{1,0}} \quad \quad {\color{green}{\eta_y}} = \frac{Q_{0,2} - Q_{0,1}}{Q_{0,1} + Q_{1,1} + Q_{1,2}} \end{equation*}\]

Warning

doxygenfunction: Unable to resolve function “aare::calculate_cross_eta3” with arguments (const ClusterVector<Cluster<T, 3, 3, CoordType>>&) in doxygen xml output for project “aare” from directory: /home/runner/work/aare/aare/build/docs/xml. Potential matches:

- template<typename ClusterType, typename = std::enable_if_t<is_cluster_v<ClusterType>>> std::vector<Eta2<typename ClusterType::value_type>> calculate_cross_eta3(const ClusterVector<ClusterType> &clusters)
- template<typename T, typename CoordType = uint16_t> Eta2<T> calculate_cross_eta3(const Cluster<T, 3, 3, CoordType> &cl)
- template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = uint16_t> Eta2<T> calculate_cross_eta3(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &cl)
template<typename T, typename CoordType = uint16_t>
Eta2<T> aare::calculate_cross_eta3(const Cluster<T, 3, 3, CoordType> &cl)

calculates cross Eta3 for 3x3 cluster cross Eta3 calculates the eta by taking into account only the cross pixels {top, bottom, left, right, center}

Interpolation class:

Warning

Make sure to use the same \(\eta\)-function during interpolation as given by the joint \(\eta\)-distribution passed to the constructor.

class Interpolator

Public Functions

Interpolator(NDView<double, 3> etacube, NDView<double, 1> xbins, NDView<double, 1> ybins, NDView<double, 1> ebins)

Constructor for the Interpolator class.

Note

note first dimension is etaX, second etaY, third photon energy

Parameters:
  • etacube – joint distribution of etaX, etaY and photon energy

  • xbins – bin edges for etaX

  • ybins – bin edges for etaY

  • ebins – bin edges for photon energy

Interpolator(NDView<double, 1> xbins, NDView<double, 1> ybins, NDView<double, 1> ebins)

Constructor for the Interpolator class.

Parameters:
  • xbins – bin edges for etaX

  • ybins – bin edges for etaY

  • ebins – bin edges for photon energy

void rosenblatttransform(NDView<double, 3> etacube)

transforms the joint eta distribution of etaX and etaY to the two independant uniform distributions based on the Roseblatt transform for each energy level

Note

note first dimension is etaX, second etaY, third photon energy

Parameters:

etacube – joint distribution of etaX, etaY and photon energy

inline NDArray<double, 3> get_ietax()
inline NDArray<double, 3> get_ietay()
template<auto EtaFunction = calculate_eta2, typename ClusterType, typename Eanble = std::enable_if_t<is_cluster_v<ClusterType>>>
std::vector<Photon> interpolate(const ClusterVector<ClusterType> &clusters)

interpolates the cluster centers for all clusters to a better precision

Template Parameters:
  • ClusterType – Type of Clusters to interpolate

  • Etafunction – Function object that calculates desired eta default: calculate_eta2

Returns:

interpolated photons (photon positions are given as double but following row column format e.g. x=0, y=0 means top row and first column of frame)

Private Functions

template<auto EtaFunction, typename ClusterType>
void interpolation_logic(Photon &photon, const double u, const double v, const corner c = corner::cTopLeft)

implements underlying interpolation logic based on EtaFunction Type

Template Parameters:

EtaFunction – Function object that calculates desired eta default:

Parameters:
  • u – transformed photon position in x between [0,1]

  • v – transformed photon position in y between [0,1]

  • c – corner of eta

template<typename T>
std::pair<double, double> bilinear_interpolation(const size_t ix, const size_t iy, const size_t ie, const Eta2<T> &eta)

bilinear interpolation of the transformed eta values

Parameters:
  • ix – index of etaX bin

  • iy – index of etaY bin

  • ie – index of energy bin

Returns:

pair of interpolated transformed eta values (ietax, ietay)

Private Members

NDArray<double, 3> m_ietax
NDArray<double, 3> m_ietay
NDArray<double, 1> m_etabinsx
NDArray<double, 1> m_etabinsy
NDArray<double, 1> m_energy_bins