CMS 3D CMS Logo

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