CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/TrackingTools/KalmanUpdators/src/MRHChi2MeasurementEstimator.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TransientTrackingRecHit/interface/TSiTrackerMultiRecHit.h"
00002 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00003 #include "TrackingTools/KalmanUpdators/interface/MRHChi2MeasurementEstimator.h"
00004 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h"
00005 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "DataFormats/Math/interface/invertPosDefMatrix.h"
00008 
00009 std::pair<bool,double>
00010 MRHChi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
00011                                    const TransientTrackingRecHit& aRecHit) const {
00012   if (!aRecHit.isValid()) {
00013         throw cms::Exception("MRHChi2MeasurementEstimator") << "Invalid RecHit passed to the MRHChi2MeasurementEstimator ";
00014   }
00015 
00016   typedef AlgebraicROOTObject<2>::Vector Vec;
00017   typedef AlgebraicROOTObject<2>::SymMatrix Mat;
00018 
00019   //better be a multihit...
00020   TSiTrackerMultiRecHit const & mHit = dynamic_cast<TSiTrackerMultiRecHit const &>(aRecHit);  
00021   MeasurementExtractor me(tsos);
00022   double est=0;
00023   double annealing = mHit.getAnnealingFactor();
00024   LogDebug("MRHChi2MeasurementEstimator") << "Current annealing factor is " << annealing;               
00025   TransientTrackingRecHit::ConstRecHitContainer components = aRecHit.transientHits();
00026   LogDebug("MRHChi2MeasurementEstimator") << "this hit has " << components.size() << " components";     
00027   for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator iter = components.begin(); iter != components.end(); iter++){              
00028         Vec r = asSVector<2>((*iter)->parameters()) - me.measuredParameters<2>(**iter);
00029         Mat R = asSMatrix<2>((*iter)->parametersError())*annealing + me.measuredError<2>(**iter);
00030         //int ierr = ! R.Invert(); // if (ierr != 0) throw exception; // 
00031         invertPosDefMatrix(R);
00032         LogDebug("MRHChi2MeasurementEstimator") << "Hit with weight " << (*iter)->weight(); 
00033         est += ROOT::Math::Similarity(r, R)*((*iter)->weight());
00034   }     
00035   return returnIt(est);
00036 }