CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
16  const TrackerTopology *tTopo) {
17 
19  std::map<const TrackingRecHit *, TransientTrackingRecHit::ConstRecHitPointer> hitMap;
20 
21  for (pixeltrackfitting::TracksWithTTRHs::const_iterator it = initialT_TTRHs.begin(), iend = initialT_TTRHs.end(); it < iend; ++it) {
22  SeedingHitSet ttrhs = it->second;
23  std::vector<const TrackingRecHit *> trhs;
24  for (unsigned int i=0, n=ttrhs.size(); i < n; ++i) {
25  const TrackingRecHit * trh = ttrhs[i]->hit();
26  trhs.push_back(trh);
27  hitMap[trh]=ttrhs[i];
28  }
29  initialT_TRHs.push_back( pixeltrackfitting::TrackWithRecHits(it->first, trhs) );
30  }
31 
32  pixeltrackfitting::TracksWithRecHits finalT_TRHs = theCleaner->cleanTracks(initialT_TRHs, tTopo);
34 
35  for (pixeltrackfitting::TracksWithRecHits::const_iterator it = finalT_TRHs.begin(), iend = finalT_TRHs.end(); it < iend; ++it) {
36  const std::vector<const TrackingRecHit *> & trhs = it->second;
37  assert(!(trhs.size()<2));
38  if (trhs.size()<2) continue;
39  SeedingHitSet ttrhs( hitMap[trhs[0]], hitMap[trhs[1]], trhs.size()>2 ? hitMap[trhs[2]] : SeedingHitSet::nullPtr());
40  finalT_TTRHs.push_back( pixeltrackfitting::TrackWithTTRHs(it->first, ttrhs));
41  }
42  return finalT_TTRHs;
43  }
44 private:
46 };
47 #endif
int i
Definition: DBlmapReader.cc:9
std::pair< reco::Track *, SeedingHitSet > TrackWithTTRHs
std::vector< TrackWithTTRHs > TracksWithTTRHs
PixelTrackCleanerWrapper(PixelTrackCleaner *tc)
static ConstRecHitPointer nullPtr()
Definition: SeedingHitSet.h:11
virtual TracksWithRecHits cleanTracks(const TracksWithRecHits &tracksWithRecHits, const TrackerTopology *tTopo)=0
std::pair< reco::Track *, std::vector< const TrackingRecHit * > > TrackWithRecHits
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs, const TrackerTopology *tTopo)
std::vector< TrackWithRecHits > TracksWithRecHits
unsigned int size() const
Definition: SeedingHitSet.h:41