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