Go to the documentation of this file.00001 #include "TrackingTools/TrackFitters/interface/KFSplittingFitter.h"
00002 #include "TrackingTools/TrackFitters/interface/TrajectoryStateWithArbitraryError.h"
00003 #include "TrackingTools/TrackFitters/interface/RecHitSplitter.h"
00004 #include "TrackingTools/TrackFitters/interface/RecHitSorter.h"
00005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00006
00007 std::vector<Trajectory> KFSplittingFitter::fit(const Trajectory& aTraj) const {
00008
00009 typedef RecHitSplitter::RecHitContainer RecHitContainer;
00010
00011 if(aTraj.empty()) return std::vector<Trajectory>();
00012
00013 TM firstTM = aTraj.firstMeasurement();
00014 TSOS firstTsos =
00015 TrajectoryStateWithArbitraryError()(firstTM.predictedState());
00016
00017 RecHitContainer hits = aTraj.recHits();
00018 RecHitContainer result;
00019 result.reserve(hits.size());
00020 for(RecHitContainer::iterator ihit = hits.begin(); ihit != hits.end();
00021 ihit++) {
00022 if(!(**ihit).isValid()) result.push_back(*ihit);
00023 else if((**ihit).transientHits().size() == 1) result.push_back(*ihit);
00024 else {
00025 RecHitContainer splitted = RecHitSplitter().split((**ihit).transientHits());
00026 RecHitContainer sorted =
00027 RecHitSorter().sortHits(splitted, aTraj.direction());
00028 for (RecHitContainer::iterator srt = sorted.begin(); srt != sorted.end(); srt++) {
00029 result.push_back(*srt);
00030
00031 }
00032 }
00033 }
00034
00035
00036 return KFTrajectoryFitter::fit(aTraj.seed(), result, firstTsos);
00037
00038 }
00039
00040 std::vector<Trajectory> KFSplittingFitter::fit(const TrajectorySeed& aSeed,
00041 const RecHitContainer& hits,
00042 const TSOS& firstPredTsos) const {
00043
00044 RecHitContainer result;
00045 result.reserve(hits.size());
00046 for(RecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end();
00047 ihit++) {
00048 if(!(**ihit).isValid()) result.push_back(*ihit);
00049 else if((**ihit).transientHits().size() == 1) result.push_back(*ihit);
00050 else {
00051 RecHitContainer splitted = RecHitSplitter().split((**ihit).transientHits());
00052 RecHitContainer sorted =
00053 RecHitSorter().sortHits(splitted, aSeed.direction());
00054 for (RecHitContainer::iterator srt = sorted.begin(); srt != sorted.end(); srt++) {
00055 result.push_back(*srt);
00056
00057 }
00058 }
00059 }
00060
00061 return KFTrajectoryFitter::fit(aSeed, result, firstPredTsos);
00062
00063 }
00064