Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-10 04:02:13

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 
0034     if (double det;
0035         updatedTSOS.isValid() && updatedTSOS.localError().valid() && updatedTSOS.localError().posDef() &&
0036         (det = 0., updatedTSOS.curvilinearError().matrix().Sub<AlgebraicSymMatrix22>(0, 0).Det(det) && det > 0) &&
0037         (det = 0., updatedTSOS.curvilinearError().matrix().Sub<AlgebraicSymMatrix33>(0, 0).Det(det) && det > 0) &&
0038         (det = 0., updatedTSOS.curvilinearError().matrix().Sub<AlgebraicSymMatrix44>(0, 0).Det(det) && det > 0) &&
0039         (det = 0., updatedTSOS.curvilinearError().matrix().Det2(det) && det > 0)) {
0040       result.addState(TrajectoryStateOnSurface(weights[i],
0041                                                updatedTSOS.localParameters(),
0042                                                updatedTSOS.localError(),
0043                                                updatedTSOS.surface(),
0044                                                &(tsos.globalParameters().magneticField()),
0045                                                tsosI.surfaceSide()));
0046     } else {
0047       edm::LogError("GsfMultiStateUpdator") << "KF updated state " << i << " is invalid. skipping.";
0048     }
0049     ++i;
0050   }
0051 
0052   return result.combinedState();
0053 }