Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:38

0001 #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h"
0002 #include "TrackingTools/GsfTools/interface/GetComponents.h"
0003 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
0004 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h"
0005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0006 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0008 #include "TrackingTools/GsfTools/interface/BasicMultiTrajectoryState.h"
0009 #include "TrackingTools/GsfTracking/interface/PosteriorWeightsCalculator.h"
0010 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateAssembler.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 
0013 TrajectoryStateOnSurface GsfMultiStateUpdator::update(const TrajectoryStateOnSurface& tsos,
0014                                                       const TrackingRecHit& aRecHit) const {
0015   GetComponents comps(tsos);
0016   auto const& predictedComponents = comps();
0017   if (predictedComponents.empty()) {
0018     edm::LogError("GsfMultiStateUpdator") << "Trying to update trajectory state with zero components! ";
0019     return TrajectoryStateOnSurface();
0020   }
0021 
0022   auto&& weights = PosteriorWeightsCalculator(predictedComponents).weights(aRecHit);
0023   if (weights.empty()) {
0024     edm::LogError("GsfMultiStateUpdator") << " no weights could be retreived. invalid updated state !.";
0025     return TrajectoryStateOnSurface();
0026   }
0027 
0028   MultiTrajectoryStateAssembler result;
0029 
0030   int i = 0;
0031   for (auto const& tsosI : predictedComponents) {
0032     TrajectoryStateOnSurface updatedTSOS = KFUpdator().update(tsosI, aRecHit);
0033     if (updatedTSOS.isValid()) {
0034       result.addState(TrajectoryStateOnSurface(weights[i],
0035                                                updatedTSOS.localParameters(),
0036                                                updatedTSOS.localError(),
0037                                                updatedTSOS.surface(),
0038                                                &(tsos.globalParameters().magneticField()),
0039                                                tsosI.surfaceSide()));
0040     } else {
0041       edm::LogError("GsfMultiStateUpdator") << "KF updated state " << i << " is invalid. skipping.";
0042     }
0043     ++i;
0044   }
0045 
0046   return result.combinedState();
0047 }