CMS 3D CMS Logo

PixelTrackCleanerWrapper.h
Go to the documentation of this file.
1 #ifndef RecoPixelVertexing_PixelTrackFitting_PixelTrackCleanerWrapper_H
2 #define RecoPixelVertexing_PixelTrackFitting_PixelTrackCleanerWrapper_H
3 
7 
8 #include <map>
9 #include <cassert>
10 
12 public:
15  const pixeltrackfitting::TracksWithTTRHs & initialT_TTRHs) const {
16 
18  std::map<const TrackingRecHit *, SeedingHitSet::ConstRecHitPointer> hitMap;
19 
20  for (pixeltrackfitting::TracksWithTTRHs::const_iterator it = initialT_TTRHs.begin(), iend = initialT_TTRHs.end(); it < iend; ++it) {
21  SeedingHitSet ttrhs = it->second;
22  std::vector<const TrackingRecHit *> trhs;
23  for (unsigned int i=0, n=ttrhs.size(); i < n; ++i) {
24  const TrackingRecHit * trh = ttrhs[i]->hit();
25  trhs.push_back(trh);
26  hitMap[trh]=ttrhs[i];
27  }
28  initialT_TRHs.push_back( pixeltrackfitting::TrackWithRecHits(it->first, trhs) );
29  }
30 
31  pixeltrackfitting::TracksWithRecHits finalT_TRHs = theCleaner->cleanTracks(initialT_TRHs);
33 
34  for (pixeltrackfitting::TracksWithRecHits::const_iterator it = finalT_TRHs.begin(), iend = finalT_TRHs.end(); it < iend; ++it) {
35  const std::vector<const TrackingRecHit *> & trhs = it->second;
36  assert(!(trhs.size()<2));
37  if (trhs.size()<2) continue;
38  SeedingHitSet ttrhs( hitMap[trhs[0]], hitMap[trhs[1]],
39  trhs.size()>2 ? hitMap[trhs[2]] : SeedingHitSet::nullPtr(),
40  trhs.size()>3 ? hitMap[trhs[3]] : SeedingHitSet::nullPtr() );
41 
42  finalT_TTRHs.push_back( pixeltrackfitting::TrackWithTTRHs(it->first, ttrhs));
43  }
44  return finalT_TTRHs;
45  }
46 private:
48 };
49 #endif
int i
Definition: DBlmapReader.cc:9
std::pair< reco::Track *, SeedingHitSet > TrackWithTTRHs
virtual TracksWithRecHits cleanTracks(const TracksWithRecHits &tracksWithRecHits) const
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs) const
std::vector< TrackWithTTRHs > TracksWithTTRHs
const PixelTrackCleaner * theCleaner
static ConstRecHitPointer nullPtr()
Definition: SeedingHitSet.h:13
std::pair< reco::Track *, std::vector< const TrackingRecHit * > > TrackWithRecHits
std::vector< TrackWithRecHits > TracksWithRecHits
unsigned int size() const
Definition: SeedingHitSet.h:46
PixelTrackCleanerWrapper(const PixelTrackCleaner *tc)