# Project CMSSW displayed by LXR

File indexing completed on 2021-02-14 14:31:51

```0001 #ifndef _TRACKER_CURVILINEARTRAJECTORYERROR_H_
0002 #define _TRACKER_CURVILINEARTRAJECTORYERROR_H_
0003
0004 #include "DataFormats/GeometrySurface/interface/TrivialError.h"
0005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0006 #include "DataFormats/Math/interface/Error.h"
0007
0008 /** Parametrization of the error matrix in the curvilinear frame.
0009  *  This frame is tangent to the track at the point of definition,
0010  *  with Z_T parallel to the track. X_T is in the global xy plane
0011  *  and points to the left when looking into the direction of the track,
0012  *  and Y_T forms a right-handed frame with X_T and Z_T.
0013  *
0014  *  The error along Z_T is therefore zero.
0015  *  The parameters are <BR>
0016  *    sigma^2( charge / abs_momentum) <BR>
0017  *    sigma^2( lambda) <BR>
0018  *    sigma^2( phi) <BR>
0019  *    sigma^2( x_transverse)) <BR>
0020  *    sigma^2( y_transverse)) <BR> <BR>
0021  *
0022  *  Please note that lambda and phi are defined in the global frame. Lambda is the helix
0023  *  dip angle (pi/2 minus theta (polar angle)), while phi is the angle of
0024  *  inclination with the global x-axis in the transverse (global xy) plane.
0025  */
0026
0027 class CurvilinearTrajectoryError {
0028 public:
0029   /// parameter dimension
0030   enum { dimension = 5 };
0031   /// 5 parameter covariance matrix
0032   typedef math::Error<dimension>::type MathCovarianceMatrix;
0033
0034   // construct
0035   CurvilinearTrajectoryError() {}
0036
0037   CurvilinearTrajectoryError(InvalidError) : theCovarianceMatrix(ROOT::Math::SMatrixNoInit()) {
0038     theCovarianceMatrix(0, 0) = -99999.e10;
0039   }
0040
0041   /** Constructing class from a full covariance matrix. The sequence of the parameters is
0042    *  the same as the one described above.
0043    */
0044   CurvilinearTrajectoryError(const AlgebraicSymMatrix55 &aCovarianceMatrix) : theCovarianceMatrix(aCovarianceMatrix) {}
0045   template <typename M55>
0046   CurvilinearTrajectoryError(const M55 &aCovarianceMatrix) : theCovarianceMatrix(aCovarianceMatrix) {}
0047
0048   bool invalid() const { return theCovarianceMatrix(0, 0) < -1.e10; }
0049   bool valid() const { return !invalid(); }
0050
0051   // not really full check of posdef
0052   bool posDef() const {
0053     return (theCovarianceMatrix(0, 0) >= 0) && (theCovarianceMatrix(1, 1) >= 0) && (theCovarianceMatrix(2, 2) >= 0) &&
0054            (theCovarianceMatrix(3, 3) >= 0) && (theCovarianceMatrix(4, 4) >= 0);
0055   }
0056
0057   // access
0058
0059   /** Returning the covariance matrix.
0060    */
0061   const AlgebraicSymMatrix55 &matrix() const { return theCovarianceMatrix; }
0062
0063   AlgebraicSymMatrix55 &matrix() { return theCovarianceMatrix; }
0064
0065   /** Enables the multiplication of the covariance matrix with the scalar "factor".
0066    */
0067
0068   void operator*=(double factor) { theCovarianceMatrix *= factor; }
0069
0070   void zeroFieldScaling(double factor) {
0071     double root_of_factor = sqrt(factor);
0072     //scale the 0 indexed covariance by the factor
0073     for (unsigned int i = 1; i != 5; ++i)
0074       theCovarianceMatrix(i, 0) *= root_of_factor;
0075
0076     //scale all others by the scared factor
0077     for (unsigned int i = 1; i != 5; ++i)
0078       for (unsigned int j = i; j != 5; ++j)
0079         theCovarianceMatrix(i, j) *= factor;
0080     //term 0,0 is not scaled at all
0081   }
0082
0083   operator MathCovarianceMatrix &() { return theCovarianceMatrix; }
0084   operator const MathCovarianceMatrix &() const { return theCovarianceMatrix; }
0085
0086 private:
0087   AlgebraicSymMatrix55 theCovarianceMatrix;
0088 };
0089
0090 #endif```