Go to the documentation of this file.00001 #ifndef RecoPixelVertexing_PixelTrackFitting_PixelTrackCleanerWrapper_H
00002 #define RecoPixelVertexing_PixelTrackFitting_PixelTrackCleanerWrapper_H
00003
00004 #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleaner.h"
00005 #include "RecoPixelVertexing/PixelTrackFitting/interface/TracksWithHits.h"
00006 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
00007
00008 #include <map>
00009 #include <cassert>
00010
00011 class PixelTrackCleanerWrapper {
00012 public:
00013 PixelTrackCleanerWrapper(PixelTrackCleaner * tc) : theCleaner(tc) {}
00014 pixeltrackfitting::TracksWithTTRHs clean(
00015 const pixeltrackfitting::TracksWithTTRHs & initialT_TTRHs,
00016 const TrackerTopology *tTopo) {
00017
00018 pixeltrackfitting::TracksWithRecHits initialT_TRHs;
00019 std::map<const TrackingRecHit *, TransientTrackingRecHit::ConstRecHitPointer> hitMap;
00020
00021 for (pixeltrackfitting::TracksWithTTRHs::const_iterator it = initialT_TTRHs.begin(), iend = initialT_TTRHs.end(); it < iend; ++it) {
00022 SeedingHitSet ttrhs = it->second;
00023 std::vector<const TrackingRecHit *> trhs;
00024 for (unsigned int i=0, n=ttrhs.size(); i < n; ++i) {
00025 const TrackingRecHit * trh = ttrhs[i]->hit();
00026 trhs.push_back(trh);
00027 hitMap[trh]=ttrhs[i];
00028 }
00029 initialT_TRHs.push_back( pixeltrackfitting::TrackWithRecHits(it->first, trhs) );
00030 }
00031
00032 pixeltrackfitting::TracksWithRecHits finalT_TRHs = theCleaner->cleanTracks(initialT_TRHs, tTopo);
00033 pixeltrackfitting::TracksWithTTRHs finalT_TTRHs;
00034
00035 for (pixeltrackfitting::TracksWithRecHits::const_iterator it = finalT_TRHs.begin(), iend = finalT_TRHs.end(); it < iend; ++it) {
00036 const std::vector<const TrackingRecHit *> & trhs = it->second;
00037 assert(!(trhs.size()<2));
00038 if (trhs.size()<2) continue;
00039 SeedingHitSet ttrhs( hitMap[trhs[0]], hitMap[trhs[1]], trhs.size()>2 ? hitMap[trhs[2]] : SeedingHitSet::nullPtr());
00040 finalT_TTRHs.push_back( pixeltrackfitting::TrackWithTTRHs(it->first, ttrhs));
00041 }
00042 return finalT_TTRHs;
00043 }
00044 private:
00045 PixelTrackCleaner * theCleaner;
00046 };
00047 #endif