Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsEntry_h
0002 #define Alignment_CommonAlignmentAlgorithm_AlignmentExtendedCorrelationsEntry_h
0003 
0004 #include <vector>
0005 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0006 
0007 /// Data container for a correlations matrix (represented by a vector of floats), with
0008 /// basic access functions. NOTE: This class is designed specifically for the use within
0009 /// AlignmentExtendedCorrelationsStore, and is not intended to be used elsewhere.
0010 
0011 class AlignmentExtendedCorrelationsEntry {
0012 public:
0013   /// Default constructor.
0014   AlignmentExtendedCorrelationsEntry(void);
0015 
0016   /// Constructor. Leaves the correlations matrix uninitialized.
0017   explicit AlignmentExtendedCorrelationsEntry(short unsigned int nRows, short unsigned int nCols);
0018 
0019   /// Constructor. Initializes all elements of the correlations matrix to the given value.
0020   explicit AlignmentExtendedCorrelationsEntry(short unsigned int nRows, short unsigned int nCols, const float init);
0021 
0022   /// Constructor from CLHEP matrix.
0023   explicit AlignmentExtendedCorrelationsEntry(const AlgebraicMatrix& mat);
0024 
0025   /// Destructor.
0026   ~AlignmentExtendedCorrelationsEntry(void) {}
0027 
0028   /// Read or write an element of the correlations matrix. NOTE: Indexing starts from [0,0].
0029   inline float& operator()(short unsigned int iRow, short unsigned int jCol) { return theData[iRow * theNCols + jCol]; }
0030 
0031   /// Read or write an element of the correlations matrix. NOTE: Indexing starts from [0,0].
0032   inline const float operator()(short unsigned int iRow, short unsigned int jCol) const {
0033     return theData[iRow * theNCols + jCol];
0034   }
0035 
0036   /// Get the number of rows of the correlation matrix.
0037   inline const short unsigned int numRow(void) const { return theNRows; }
0038 
0039   /// Get the number of columns of the correlation matrix.
0040   inline const short unsigned int numCol(void) const { return theNCols; }
0041 
0042   /// Multiply all elements of the correlations matrix with a given number.
0043   void operator*=(const float multiply);
0044 
0045   /// Retrieve the correlation matrix in a CLHEP matrix representation;
0046   AlgebraicMatrix matrix(void) const;
0047 
0048   //   /// Get the counter's value.
0049   //   inline const int counter( void ) const { return theCounter; }
0050 
0051   //   /// Increase the counter's value by 1.
0052   //   inline void incrementCounter( void ) { ++theCounter; }
0053 
0054   //   /// Decrease the counter's value by 1.
0055   //   inline void decrementCounter( void ) { --theCounter; }
0056 
0057 private:
0058   //   int theCounter;
0059 
0060   short unsigned int theNRows;
0061   short unsigned int theNCols;
0062 
0063   std::vector<float> theData;
0064 };
0065 
0066 #endif