Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:29

0001 #ifndef DataFormats_GeometryCommonDetAlgo_LocalErrorBaseExtended_h
0002 #define DataFormats_GeometryCommonDetAlgo_LocalErrorBaseExtended_h
0003 
0004 #include "DataFormats/GeometrySurface/interface/TrivialError.h"
0005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0006 //
0007 // Exceptions
0008 //
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 
0011 template <class T, class ErrorWeightType>
0012 class LocalErrorBaseExtended {
0013 public:
0014   /// Tag to request a null error matrix
0015   class NullMatrix {};
0016 
0017   LocalErrorBaseExtended() {}
0018 
0019   LocalErrorBaseExtended(const NullMatrix&) {}
0020 
0021   LocalErrorBaseExtended(InvalidError) {
0022     theCartesianError[0][0] = -9999.e10f;
0023     theCartesianError[0][1] = 0;
0024     theCartesianError[1][1] = -9999.e10f;
0025     theCartesianError[2][2] = -9999.e10f;
0026     theCartesianError[1][2] = 0;
0027     theCartesianError[1][3] = 0;
0028     theCartesianError[2][3] = 0;
0029     theCartesianError[3][3] = -9999.e10f;
0030   }
0031 
0032   bool invalid() const { return theCartesianError[0][0] < -1.e10f; }
0033   bool valid() const { return !invalid(); }
0034 
0035   /**
0036    * Constructor.
0037    * The symmetric matrix stored as a lower triangular matrix
0038    */
0039   LocalErrorBaseExtended(T c11, T c21, T c31, T c41, T c22, T c32, T c42, T c33, T c43, T c44) {
0040     theCartesianError(0, 0) = c11;
0041     theCartesianError(1, 0) = c21;
0042     theCartesianError(2, 0) = c31;
0043     theCartesianError(3, 0) = c41;
0044 
0045     theCartesianError(1, 1) = c22;
0046     theCartesianError(2, 1) = c32;
0047     theCartesianError(3, 1) = c42;
0048 
0049     theCartesianError(2, 2) = c33;
0050     theCartesianError(3, 2) = c43;
0051 
0052     theCartesianError(3, 3) = c44;
0053   }
0054 
0055   LocalErrorBaseExtended(const AlgebraicSymMatrix44& err) : theCartesianError(err) {}
0056 
0057   ~LocalErrorBaseExtended() {}
0058 
0059   T cxx() const { return theCartesianError(0, 0); }
0060 
0061   T cyx() const { return theCartesianError(1, 0); }
0062 
0063   T cphixx() const { return theCartesianError(2, 0); }
0064 
0065   T cphiyx() const { return theCartesianError(3, 0); }
0066 
0067   T cyy() const { return theCartesianError(1, 1); }
0068 
0069   T cphixy() const { return theCartesianError(2, 1); }
0070 
0071   T cphiyy() const { return theCartesianError(3, 1); }
0072 
0073   T cphixphix() const { return theCartesianError(2, 2); }
0074 
0075   T cphiyphix() const { return theCartesianError(3, 2); }
0076 
0077   T cphiyphiy() const { return theCartesianError(3, 3); }
0078 
0079   /**
0080    * Access method to the matrix,
0081    * /return The SymMatrix
0082    */
0083   const AlgebraicSymMatrix44& matrix() const { return theCartesianError; }
0084 
0085   LocalErrorBaseExtended operator+(const LocalErrorBaseExtended& err) const {
0086     return LocalErrorBaseExtended(theCartesianError + err.theCartesianError);
0087   }
0088   LocalErrorBaseExtended operator-(const LocalErrorBaseExtended& err) const {
0089     return LocalErrorBaseExtended(theCartesianError - err.theCartesianError);
0090   }
0091 
0092 private:
0093   AlgebraicSymMatrix44 theCartesianError;
0094 };
0095 
0096 #endif