AlignmentExtendedCorrelationsStore

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
#ifndef Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsStore_h
#define Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsStore_h

/// This class manages the storage and retrieval of correlations between Alignables
/// for the AlignmentParameterStore. This implementation does not stores the entries
/// of the "big covariance matrix" itself, but the statistical correlations, i.e.
/// R_ij=C_ij/sqrt(C_ii*C_jj) rather than C_ij.
///
/// If a correlation exceeds a certain value (especially corrupted correlations with
/// an absolute value bigger than 1) it is downweighted.

#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentCorrelationsStore.h"
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentExtendedCorrelationsEntry.h"

namespace edm {
  class ParameterSet;
}

class AlignmentExtendedCorrelationsStore : public AlignmentCorrelationsStore {
public:
  typedef AlignmentExtendedCorrelationsEntry ExtendedCorrelationsEntry;
  typedef std::map<Alignable*, ExtendedCorrelationsEntry> ExtendedCorrelationsTable;
  typedef std::map<Alignable*, ExtendedCorrelationsTable*> ExtendedCorrelations;

  AlignmentExtendedCorrelationsStore(const edm::ParameterSet& config);

  ~AlignmentExtendedCorrelationsStore(void) override {}

  /// Write correlations directly to the covariance matrix starting at the
  /// given position. Indices are assumed to start from 0.
  void correlations(Alignable* ap1, Alignable* ap2, AlgebraicSymMatrix& cov, int row, int col) const override;

  /// Get correlations directly from the given position of the covariance
  /// matrix and store them. Indices are assumed to start from 0.
  void setCorrelations(Alignable* ap1, Alignable* ap2, const AlgebraicSymMatrix& cov, int row, int col) override;

  /// Set correlations without checking whether the maximum
  /// number of updates has already been reached.
  void setCorrelations(Alignable* ap1, Alignable* ap2, AlgebraicMatrix& mat) override;

  /// Get correlations.
  virtual void getCorrelations(Alignable* ap1, Alignable* ap2, AlgebraicMatrix& mat) const;

  /// Check whether correlations are stored for a given pair of alignables.
  bool correlationsAvailable(Alignable* ap1, Alignable* ap2) const override;

  /// Reset correlations.
  void resetCorrelations(void) override;

  /// Get number of stored correlations.
  unsigned int size(void) const override;

private:
  void fillCorrelationsTable(Alignable* ap1,
                             Alignable* ap2,
                             ExtendedCorrelationsTable* table,
                             const AlgebraicSymMatrix& cov,
                             int row,
                             int col,
                             bool transpose);

  void fillCovariance(Alignable* ap1,
                      Alignable* ap2,
                      const ExtendedCorrelationsEntry& entry,
                      AlgebraicSymMatrix& cov,
                      int row,
                      int col) const;

  void fillCovarianceT(Alignable* ap1,
                       Alignable* ap2,
                       const ExtendedCorrelationsEntry& entry,
                       AlgebraicSymMatrix& cov,
                       int row,
                       int col) const;

  void readFromCovariance(Alignable* ap1,
                          Alignable* ap2,
                          ExtendedCorrelationsEntry& entry,
                          const AlgebraicSymMatrix& cov,
                          int row,
                          int col);

  void readFromCovarianceT(Alignable* ap1,
                           Alignable* ap2,
                           ExtendedCorrelationsEntry& entry,
                           const AlgebraicSymMatrix& cov,
                           int row,
                           int col);

  void resizeCorruptCorrelations(ExtendedCorrelationsEntry& entry, double maxCorr);

  ExtendedCorrelations theCorrelations;

  int theMaxUpdates;
  double theCut;
  double theWeight;
};

#endif