00001 #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h" 00002 00003 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h" 00004 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h" 00005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 00006 #include "DataFormats/GeometrySurface/interface/BoundPlane.h" 00007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" 00008 #include "TrackingTools/GsfTools/interface/BasicMultiTrajectoryState.h" 00009 #include "TrackingTools/GsfTracking/interface/PosteriorWeightsCalculator.h" 00010 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateAssembler.h" 00011 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00012 00013 TrajectoryStateOnSurface GsfMultiStateUpdator::update(const TrajectoryStateOnSurface& tsos, 00014 const TransientTrackingRecHit& aRecHit) const { 00015 00016 std::vector<TrajectoryStateOnSurface> predictedComponents = tsos.components(); 00017 if (predictedComponents.empty()) { 00018 edm::LogError("GsfMultiStateUpdator") << "Trying to update trajectory state with zero components! " ; 00019 return TrajectoryStateOnSurface(); 00020 } 00021 00022 std::vector<double> weights = PosteriorWeightsCalculator(predictedComponents).weights(aRecHit); 00023 if ( weights.empty() ) return TrajectoryStateOnSurface(); 00024 00025 MultiTrajectoryStateAssembler result; 00026 00027 int i = 0; 00028 for (std::vector<TrajectoryStateOnSurface>::const_iterator iter = predictedComponents.begin(); 00029 iter != predictedComponents.end(); iter++) { 00030 TrajectoryStateOnSurface updatedTSOS = KFUpdator().update(*iter, aRecHit); 00031 result.addState(TrajectoryStateOnSurface(updatedTSOS.localParameters(), 00032 updatedTSOS.localError(), updatedTSOS.surface(), 00033 &(tsos.globalParameters().magneticField()), 00034 (*iter).surfaceSide(), weights[i])); 00035 i++; 00036 } 00037 00038 return result.combinedState(); 00039 }