CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoTracker/CkfPattern/src/SeedCleanerBySharedInput.cc

Go to the documentation of this file.
00001 #include "RecoTracker/CkfPattern/interface/SeedCleanerBySharedInput.h"
00002 
00003 bool SeedCleanerBySharedInput::good(const TrajectorySeed *seed) {
00004     typedef TrajectorySeed::const_iterator SI;
00005     typedef Trajectory::RecHitContainer::const_iterator TI;
00006     TrajectorySeed::range range = seed->recHits();
00007     SI first = range.first, curr = range.first, last = range.second;
00008 //     for (std::vector<Trajectory>::const_iterator trj = trajectories->begin(),
00009 //             trjEnd =trajectories->end();
00010 //             trj != trjEnd; ++trj) {
00011 // Try reverse direction (possible gain in speed)
00012     for (std::vector<Trajectory>::const_reverse_iterator trj = trajectories->rbegin(),
00013             trjEnd =trajectories->rend();
00014             trj != trjEnd; ++trj) {
00015         Trajectory::RecHitContainer hits = trj->recHits();
00016         TI ts = hits.begin(), tc = ts, te = hits.end();
00017         for (curr = first; curr < last; ++curr) {
00018             bool found = false;
00019             for (TI it = tc; it != te; ++it) {
00020               if ( curr->sharesInput((**it).hit(),TrackingRecHit::all) ) {
00021                     tc = it; found = true; break;         
00022                 }
00023             }
00024             if (found == false) {
00025                 for (TI it = ts; it != tc; ++it) {
00026                   if ( curr->sharesInput((**it).hit(),TrackingRecHit::all) ) {
00027                         tc = it; found = true; break;         
00028                     }
00029                 }
00030                 if (found == false) break;
00031             }
00032         }
00033         if (curr == last)  return false;   
00034     }
00035     return true;
00036 }