Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:01

0001 /****************************************************************************
0002  *
0003  * This is a part of TOTEM offline software.
0004  * Authors:
0005  *   Hubert Niewiadomski
0006  *   Jan Kašpar (jan.kaspar@gmail.com)
0007  *
0008  ****************************************************************************/
0009 
0010 #include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h"
0011 
0012 //----------------------------------------------------------------------------------------------------
0013 
0014 TMatrixD TotemRPLocalTrack::trackPointInterpolationCovariance(double z) const {
0015   TMatrixD h(2, 4);
0016   h(0, 0) = 1;
0017   h(1, 1) = 1;
0018   h(0, 2) = z - z0_;
0019   h(1, 3) = z - z0_;
0020 
0021   TMatrixD cov_matr(dimension, dimension);
0022   for (int i = 0; i < dimension; ++i)
0023     for (int j = 0; j < dimension; ++j)
0024       cov_matr(i, j) = CovarianceMatrixElement(i, j);
0025 
0026   TMatrixD V_hT(cov_matr, TMatrixD::kMultTranspose, h);
0027   //h*=V_hT;
0028   //return h;
0029   return TMatrixD(h, TMatrixD::kMult, V_hT);
0030 }
0031 
0032 //----------------------------------------------------------------------------------------------------
0033 
0034 TotemRPLocalTrack::TotemRPLocalTrack(double z0,
0035                                      const TVectorD &track_params_vector,
0036                                      const TMatrixD &par_covariance_matrix,
0037                                      double chiSquared)
0038     : z0_(z0), chiSquared_(chiSquared), valid_(true) {
0039   for (int i = 0; i < dimension; ++i) {
0040     track_params_vector_[i] = track_params_vector[i];
0041     for (int j = 0; j < dimension; ++j) {
0042       CovarianceMatrixElement(i, j) = par_covariance_matrix(i, j);
0043     }
0044   }
0045 }
0046 
0047 //----------------------------------------------------------------------------------------------------
0048 
0049 TVectorD TotemRPLocalTrack::parameterVector() const {
0050   TVectorD v(dimension);
0051 
0052   for (int i = 0; i < dimension; ++i)
0053     v[i] = track_params_vector_[i];
0054 
0055   return v;
0056 }
0057 
0058 //----------------------------------------------------------------------------------------------------
0059 
0060 void TotemRPLocalTrack::setParameterVector(const TVectorD &track_params_vector) {
0061   for (int i = 0; i < dimension; ++i)
0062     track_params_vector_[i] = track_params_vector[i];
0063 }
0064 
0065 //----------------------------------------------------------------------------------------------------
0066 
0067 TMatrixD TotemRPLocalTrack::covarianceMatrix() const {
0068   TMatrixD m(dimension, dimension);
0069 
0070   for (int i = 0; i < dimension; ++i)
0071     for (int j = 0; j < dimension; ++j)
0072       m(i, j) = CovarianceMatrixElement(i, j);
0073 
0074   return m;
0075 }
0076 
0077 //----------------------------------------------------------------------------------------------------
0078 
0079 void TotemRPLocalTrack::setCovarianceMatrix(const TMatrixD &par_covariance_matrix) {
0080   for (int i = 0; i < dimension; ++i)
0081     for (int j = 0; j < dimension; ++j)
0082       CovarianceMatrixElement(i, j) = par_covariance_matrix(i, j);
0083 }
0084 
0085 //----------------------------------------------------------------------------------------------------
0086 
0087 bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r) {
0088   if (l.z0_ < r.z0_)
0089     return true;
0090   if (l.z0_ > r.z0_)
0091     return true;
0092 
0093   for (int i = 0; i < TotemRPLocalTrack::dimension; ++i) {
0094     if (l.track_params_vector_[i] < r.track_params_vector_[i])
0095       return true;
0096     if (l.track_params_vector_[i] > r.track_params_vector_[i])
0097       return true;
0098   }
0099 
0100   return false;
0101 }