Skip to content

Development of BeamSpotMonitor algorithm

Patrick Spradlin requested to merge spradlin_202310Oct_irmon into master

Related MRs and Issues

Test with Moore!2985 (merged)

Adresses (but may not close) #288

Overview

Introduces BeamSpotMonitor, a new monitoring algorithm for accumulating interaction region statistics from an input container of primary vertexes:

  • Tr/TrackMonitors/src/BeamSpotMonitor.cpp
  • (Open to renaming suggestions)

External discussions

Contemporary implementation described in contribution of Patrick Spradlin to the RTA: WP4/5 Alignment, Calibration, QA meeting 15 Feb 2024

Target conditions

Intended to calculate and format values for conditions Conditions/LHCb/Online/InteractionRegion.yml. The example YAML file defines the format:

# Example of InteractionRegion condition
# ```
# InteractionRegion:
#     position: <avg_position_x_y_z: [float x3]>
#     spread: <spread_matrix_xx_xy_yy_xz_yz_zz: [float x6]>
# ```
---
InteractionRegion:
    position: [ "0.0*mm", "0.0*mm", "0.0*mm" ]
    spread: [ "0.0064*mm2", "0.0*mm2", "0.0064*mm2", "0.0*mm2", "0.0*mm2", "2809.0*mm2" ]

Computation of values

BeamSpotMonitor uses six accumulators for calculating sample mean positions and covariance of mean positions of input PVs

  • Gaudi::Accumulators::SigmaCounter<> in 'x', 'y', and 'z' from which mean positions and variances are computed
  • Gaudi::Accumulators::AveragingCounter<> for 'xy', 'yz', and 'zx' that are used in conjunction with statistics from the position SigmaCounters to compute the off-diagonal covariances

The mean position for the position conditions are just the return values of Gaudi::Accumulators::SigmaCounter<>::mean().

The diagonal elements of the spread matrix are the return values of Gaudi::Accumulators::SigmaCounter<>::unbiased_sample_variance().

The off-diagonal elements of the spread matrix are computed from two of the position means and the sum of the corresponding product accumulator:

  /// Unbiased sample covariance calculator for off-diagonals
  template <typename X, typename XX>
  auto calculate_spread_offdiag( X const& x, X const& y, XX const& xy ) {
    return ( xy.sum() - xy.nEntries() * x.mean() * y.mean() ) / ( xy.nEntries() - 1 );
  }

YAML writing

BeamSpotMonitor can write YAML files to a specified location. In the current version of the method, these are written when the specified number of PVs is reached for the first time and when the values of the accumulators deviate from those of the cached report by any of the configurable thresholds.

BeamSpotMonitor also has an option to toggle reporting a copy of the conditions through the messaging service at level INFO.

Edited by Patrick Spradlin

Merge request reports

Loading