CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/RecoTracker/CkfPattern/src/SeedCleanerByHitPosition.cc

Go to the documentation of this file.
00001 #include "RecoTracker/CkfPattern/interface/SeedCleanerByHitPosition.h"
00002 #include "TrackingTools/TransientTrackingRecHit/interface/RecHitComparatorByPosition.h"
00003 
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 void SeedCleanerByHitPosition::done() {
00007         // edm::LogInfo("SeedCleanerByHitPosition") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_  << " Vault: " << trajectories->size() << ".";
00008         // calls_ = comps_ = tracks_ = 0;
00009 
00010         trajectories = 0; 
00011 }
00012 bool SeedCleanerByHitPosition::good(const TrajectorySeed *seed) {
00013     static RecHitComparatorByPosition comp;
00014     typedef TrajectorySeed::const_iterator SI;
00015     typedef Trajectory::RecHitContainer::const_iterator TI;
00016     TrajectorySeed::range range = seed->recHits();
00017     SI first = range.first, curr = range.first, last = range.second;
00018     //calls_++;
00019     for (std::vector<Trajectory>::const_iterator trj = trajectories->begin(),
00020             trjEnd =trajectories->end();
00021             trj != trjEnd; ++trj) {
00022         //tracks_++;
00023         Trajectory::RecHitContainer hits = trj->recHits();
00024         TI ts = hits.begin(), tc = ts, te = hits.end();
00025         for (curr = first; curr < last; ++curr) {
00026             bool found = false;
00027             for (TI it = tc; it != te; ++it) {
00028                 //comps_++;
00029                 if (comp.equals(&(*curr), &(**it))) {
00030                     tc = it; found = true; break;         
00031                 }
00032             }
00033             if (found == false) {
00034                 for (TI it = ts; it != tc; ++it) {
00035                     //comps_++;
00036                     if (comp.equals(&(*curr), &(**it))) {
00037                         tc = it; found = true; break;         
00038                     }
00039                 }
00040                 if (found == false) break;
00041             }
00042         }
00043         if (curr == last) return false;   
00044     }
00045     return true;
00046 }