Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:37

0001 #ifndef Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsStore_h
0002 #define Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsStore_h
0003 
0004 /// This class manages the storage and retrieval of correlations between Alignables
0005 /// for the AlignmentParameterStore. This implementation does not stores the entries
0006 /// of the "big covariance matrix" itself, but the statistical correlations, i.e.
0007 /// R_ij=C_ij/sqrt(C_ii*C_jj) rather than C_ij.
0008 ///
0009 /// If a correlation exceeds a certain value (especially corrupted correlations with
0010 /// an absolute value bigger than 1) it is downweighted.
0011 
0012 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentCorrelationsStore.h"
0013 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentExtendedCorrelationsEntry.h"
0014 
0015 namespace edm {
0016   class ParameterSet;
0017 }
0018 
0019 class AlignmentExtendedCorrelationsStore : public AlignmentCorrelationsStore {
0020 public:
0021   typedef AlignmentExtendedCorrelationsEntry ExtendedCorrelationsEntry;
0022   typedef std::map<Alignable*, ExtendedCorrelationsEntry> ExtendedCorrelationsTable;
0023   typedef std::map<Alignable*, ExtendedCorrelationsTable*> ExtendedCorrelations;
0024 
0025   AlignmentExtendedCorrelationsStore(const edm::ParameterSet& config);
0026 
0027   ~AlignmentExtendedCorrelationsStore(void) override {}
0028 
0029   /// Write correlations directly to the covariance matrix starting at the
0030   /// given position. Indices are assumed to start from 0.
0031   void correlations(Alignable* ap1, Alignable* ap2, AlgebraicSymMatrix& cov, int row, int col) const override;
0032 
0033   /// Get correlations directly from the given position of the covariance
0034   /// matrix and store them. Indices are assumed to start from 0.
0035   void setCorrelations(Alignable* ap1, Alignable* ap2, const AlgebraicSymMatrix& cov, int row, int col) override;
0036 
0037   /// Set correlations without checking whether the maximum
0038   /// number of updates has already been reached.
0039   void setCorrelations(Alignable* ap1, Alignable* ap2, AlgebraicMatrix& mat) override;
0040 
0041   /// Get correlations.
0042   virtual void getCorrelations(Alignable* ap1, Alignable* ap2, AlgebraicMatrix& mat) const;
0043 
0044   /// Check whether correlations are stored for a given pair of alignables.
0045   bool correlationsAvailable(Alignable* ap1, Alignable* ap2) const override;
0046 
0047   /// Reset correlations.
0048   void resetCorrelations(void) override;
0049 
0050   /// Get number of stored correlations.
0051   unsigned int size(void) const override;
0052 
0053 private:
0054   void fillCorrelationsTable(Alignable* ap1,
0055                              Alignable* ap2,
0056                              ExtendedCorrelationsTable* table,
0057                              const AlgebraicSymMatrix& cov,
0058                              int row,
0059                              int col,
0060                              bool transpose);
0061 
0062   void fillCovariance(Alignable* ap1,
0063                       Alignable* ap2,
0064                       const ExtendedCorrelationsEntry& entry,
0065                       AlgebraicSymMatrix& cov,
0066                       int row,
0067                       int col) const;
0068 
0069   void fillCovarianceT(Alignable* ap1,
0070                        Alignable* ap2,
0071                        const ExtendedCorrelationsEntry& entry,
0072                        AlgebraicSymMatrix& cov,
0073                        int row,
0074                        int col) const;
0075 
0076   void readFromCovariance(Alignable* ap1,
0077                           Alignable* ap2,
0078                           ExtendedCorrelationsEntry& entry,
0079                           const AlgebraicSymMatrix& cov,
0080                           int row,
0081                           int col);
0082 
0083   void readFromCovarianceT(Alignable* ap1,
0084                            Alignable* ap2,
0085                            ExtendedCorrelationsEntry& entry,
0086                            const AlgebraicSymMatrix& cov,
0087                            int row,
0088                            int col);
0089 
0090   void resizeCorruptCorrelations(ExtendedCorrelationsEntry& entry, double maxCorr);
0091 
0092   ExtendedCorrelations theCorrelations;
0093 
0094   int theMaxUpdates;
0095   double theCut;
0096   double theWeight;
0097 };
0098 
0099 #endif