Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:51

0001 #ifndef CondFormats_Alignment_SurveyError_H
0002 #define CondFormats_Alignment_SurveyError_H
0003 
0004 /** \class SurveyError
0005  *
0006  *  Class to hold DB object for survey errors.
0007  *
0008  *  DB object contains the following:
0009  *    an unsigned 8-bit integer for the structure type
0010  *    an unsigned 32-bit integer for the detector's raw id
0011  *    an array of 21 floats for the error matrix of 6 alignment parameters
0012  *  The lower triangular of the error matrix is stored.
0013  *
0014  *  $Date: 2007/04/03 15:59:58 $
0015  *  $Revision: 1.1 $
0016  *  \author Chung Khim Lae
0017  */
0018 
0019 #include "CondFormats/Serialization/interface/Serializable.h"
0020 
0021 #include "CondFormats/Alignment/interface/Definitions.h"
0022 
0023 class SurveyError {
0024   typedef align::ErrorMatrix ErrorMatrix;
0025   typedef ErrorMatrix::value_type Scalar;
0026 
0027 public:
0028   inline SurveyError(uint8_t structureType = 0,          // default unknown
0029                      align::ID rawId = 0,                // default unknown
0030                      const ErrorMatrix& = ErrorMatrix()  // default 0
0031   );
0032 
0033   inline uint8_t structureType() const;
0034 
0035   inline align::ID rawId() const;
0036 
0037   inline ErrorMatrix matrix() const;
0038 
0039 private:
0040   static const unsigned int nPar_ = ErrorMatrix::kRows;
0041   static const unsigned int size_ = nPar_ * (nPar_ + 1) / 2;
0042 
0043   uint8_t m_structureType;
0044   align::ID m_rawId;
0045 
0046   Scalar m_errors[size_];
0047 
0048   COND_SERIALIZABLE;
0049 };
0050 
0051 SurveyError::SurveyError(uint8_t structureType, align::ID rawId, const ErrorMatrix& cov)
0052     : m_structureType(structureType), m_rawId(rawId) {
0053   const Scalar* data = cov.Array();  // lower triangular of cov
0054 
0055   for (unsigned int i = 0; i < size_; ++i)
0056     m_errors[i] = data[i];
0057 }
0058 
0059 uint8_t SurveyError::structureType() const { return m_structureType; }
0060 
0061 align::ID SurveyError::rawId() const { return m_rawId; }
0062 
0063 SurveyError::ErrorMatrix SurveyError::matrix() const { return ErrorMatrix(m_errors, m_errors + size_); }
0064 
0065 #endif