Go to the documentation of this file.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 #include "DataFormats/Math/interface/invertPosDefMatrix.h"
00007
00008 std::pair<bool,double>
00009 MRHChi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
00010 const TransientTrackingRecHit& aRecHit) const {
00011 if (!aRecHit.isValid()) {
00012 throw cms::Exception("MRHChi2MeasurementEstimator") << "Invalid RecHit passed to the MRHChi2MeasurementEstimator ";
00013 }
00014
00015 typedef AlgebraicROOTObject<2>::Vector Vec;
00016 typedef AlgebraicROOTObject<2>::SymMatrix Mat;
00017
00018 MeasurementExtractor me(tsos);
00019 double est=0;
00020 double annealing = aRecHit.getAnnealingFactor();
00021 LogDebug("MRHChi2MeasurementEstimator") << "Current annealing factor is " << annealing;
00022 TransientTrackingRecHit::ConstRecHitContainer components = aRecHit.transientHits();
00023 LogDebug("MRHChi2MeasurementEstimator") << "this hit has " << components.size() << " components";
00024 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator iter = components.begin(); iter != components.end(); iter++){
00025 Vec r = asSVector<2>((*iter)->parameters()) - me.measuredParameters<2>(**iter);
00026 Mat R = asSMatrix<2>((*iter)->parametersError())*annealing + me.measuredError<2>(**iter);
00027
00028 invertPosDefMatrix(R);
00029 LogDebug("MRHChi2MeasurementEstimator") << "Hit with weight " << (*iter)->weight();
00030 est += ROOT::Math::Similarity(r, R)*((*iter)->weight());
00031 }
00032 return returnIt(est);
00033 }