CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/TrackingTools/KalmanUpdators/src/Chi2MeasurementEstimator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00002 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
00003 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h"
00004 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00005 #include "DataFormats/Math/interface/invertPosDefMatrix.h"
00006 
00007 std::pair<bool,double> 
00008 Chi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
00009                                    const TransientTrackingRecHit& aRecHit) const {
00010     switch (aRecHit.dimension()) {
00011         case 1: return estimate<1>(tsos,aRecHit);
00012         case 2: return estimate<2>(tsos,aRecHit);
00013         case 3: return estimate<3>(tsos,aRecHit);
00014         case 4: return estimate<4>(tsos,aRecHit);
00015         case 5: return estimate<5>(tsos,aRecHit);
00016     }
00017     throw cms::Exception("RecHit of invalid size (not 1,2,3,4,5)");
00018 }
00019 
00020 template <unsigned int D> std::pair<bool,double> 
00021 Chi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
00022                                    const TransientTrackingRecHit& aRecHit) const {
00023   typedef typename AlgebraicROOTObject<D,5>::Matrix MatD5;
00024   typedef typename AlgebraicROOTObject<5,D>::Matrix Mat5D;
00025   typedef typename AlgebraicROOTObject<D,D>::SymMatrix SMatDD;
00026   typedef typename AlgebraicROOTObject<D>::Vector VecD;
00027 
00028   VecD r, rMeas; SMatDD R, RMeas; 
00029   MatD5 dummyProjMatrix;
00030 
00031   KfComponentsHolder holder;
00032   holder.template setup<D>(&r, &R, &dummyProjMatrix, &rMeas, &RMeas, tsos.localParameters().vector(), tsos.localError().matrix());
00033   aRecHit.getKfComponents(holder);
00034  
00035   R += RMeas;
00036   invertPosDefMatrix(R);
00037   double est = ROOT::Math::Similarity(r - rMeas, R);
00038   return returnIt(est);
00039 }