CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleanerWrapper.h

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 <map>
00007 #include <cassert>
00008 
00009 class PixelTrackCleanerWrapper {
00010 public: 
00011   PixelTrackCleanerWrapper(PixelTrackCleaner * tc) : theCleaner(tc) {}
00012   pixeltrackfitting::TracksWithTTRHs clean(
00013       const pixeltrackfitting::TracksWithTTRHs & initialT_TTRHs) {
00014     
00015     pixeltrackfitting::TracksWithRecHits initialT_TRHs;
00016     std::map<const TrackingRecHit *, TransientTrackingRecHit::ConstRecHitPointer> hitMap;
00017 
00018     for (pixeltrackfitting::TracksWithTTRHs::const_iterator it = initialT_TTRHs.begin(), iend = initialT_TTRHs.end(); it < iend; ++it) {
00019       SeedingHitSet ttrhs = it->second;
00020       std::vector<const TrackingRecHit *> trhs;
00021       for (unsigned int i=0, n=ttrhs.size(); i < n; ++i) { 
00022         const TrackingRecHit * trh = ttrhs[i]->hit();
00023         trhs.push_back(trh);
00024         hitMap[trh]=ttrhs[i];
00025       }
00026       initialT_TRHs.push_back( pixeltrackfitting::TrackWithRecHits(it->first, trhs) );
00027     }
00028 
00029     pixeltrackfitting::TracksWithRecHits finalT_TRHs = theCleaner->cleanTracks(initialT_TRHs);
00030     pixeltrackfitting::TracksWithTTRHs finalT_TTRHs;
00031 
00032     for (pixeltrackfitting::TracksWithRecHits::const_iterator it = finalT_TRHs.begin(), iend = finalT_TRHs.end(); it < iend; ++it) {
00033        const std::vector<const TrackingRecHit *> & trhs = it->second;
00034        assert(!(trhs.size()<2));
00035        if (trhs.size()<2) continue;
00036        SeedingHitSet ttrhs( hitMap[trhs[0]], hitMap[trhs[1]], trhs.size()>2 ? hitMap[trhs[2]] : SeedingHitSet::nullPtr()); 
00037        finalT_TTRHs.push_back( pixeltrackfitting::TrackWithTTRHs(it->first, ttrhs));
00038     }
00039     return finalT_TTRHs;
00040   }
00041 private:
00042   PixelTrackCleaner * theCleaner;
00043 };
00044 #endif