Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "TrackingTools/TrackFitters/interface/KFSplittingFitter.h"
0002 #include "TrackingTools/TrackFitters/interface/TrajectoryStateWithArbitraryError.h"
0003 #include "TrackingTools/TrackFitters/interface/RecHitSorter.h"
0004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0005 
0006 void KFSplittingFitter::sorter(const RecHitContainer& hits, PropagationDirection dir, RecHitContainer& result) const {
0007   result.reserve(hits.size());
0008   for (RecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ihit++) {
0009     if (!(**ihit).isValid())
0010       result.push_back(*ihit);
0011     else if ((**ihit).transientHits().size() == 1)
0012       result.push_back(*ihit);
0013     else {
0014       RecHitContainer splitted = RecHitSplitter().split((**ihit).transientHits());
0015       RecHitContainer sorted = RecHitSorter().sortHits(splitted, dir);
0016       for (RecHitContainer::iterator srt = sorted.begin(); srt != sorted.end(); srt++) {
0017         result.push_back(*srt);
0018         //      result.insert(result.end(), sorted.begin(), sorted.end());
0019       }
0020     }
0021   }
0022 }
0023 
0024 Trajectory KFSplittingFitter::fitOne(const Trajectory& aTraj, fitType type) const {
0025   if (aTraj.empty())
0026     return Trajectory();
0027 
0028   const TM& firstTM = aTraj.firstMeasurement();
0029   TSOS firstTsos = TrajectoryStateWithArbitraryError()(firstTM.predictedState());
0030 
0031   RecHitContainer const& hits = aTraj.recHits();
0032   RecHitContainer result;
0033   sorter(hits, aTraj.direction(), result);
0034 
0035   return fitter.fitOne(aTraj.seed(), result, firstTsos, type);
0036 }
0037 
0038 Trajectory KFSplittingFitter::fitOne(const TrajectorySeed& aSeed, const RecHitContainer& hits, fitType type) const {
0039   RecHitContainer result;
0040   sorter(hits, aSeed.direction(), result);
0041 
0042   return fitter.fitOne(aSeed, result, type);
0043 }
0044 
0045 Trajectory KFSplittingFitter::fitOne(const TrajectorySeed& aSeed,
0046                                      const RecHitContainer& hits,
0047                                      const TSOS& firstPredTsos,
0048                                      fitType type) const {
0049   RecHitContainer result;
0050   sorter(hits, aSeed.direction(), result);
0051 
0052   return fitter.fitOne(aSeed, result, firstPredTsos, type);
0053 }