Go to the documentation of this file.00001
00008 #include "RecoMuon/TrackerSeedGenerator/interface/RedundantSeedCleaner.h"
00009
00010
00011
00012
00013
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00016 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00017 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
00018 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00019 #include "DataFormats/MuonSeed/interface/L3MuonTrajectorySeed.h"
00020 #include "DataFormats/MuonSeed/interface/L3MuonTrajectorySeedCollection.h"
00021
00022 using namespace edm;
00023 using namespace reco;
00024
00025
00026
00027
00028
00029 void RedundantSeedCleaner::define(std::vector<TrajectorySeed> & coll)
00030 {
00031
00032 std::vector<TrajectorySeed> triplets;
00033
00034
00035 for(TrajectorySeedCollection::iterator itr =coll.begin(); itr != coll.end(); ++itr){
00036
00037 if(itr->nHits()==3) triplets.push_back(*itr);
00038
00039 }
00040
00041
00042 if (!triplets.empty()) clean(triplets,coll);
00043 }
00044
00045
00046
00047
00048
00049 void RedundantSeedCleaner::clean(const std::vector<TrajectorySeed> & seedTr, std::vector<TrajectorySeed> & seed)
00050 {
00051
00052
00053 std::vector<TrajectorySeed> result;
00054
00055 std::vector<bool> maskPairs = std::vector<bool>(seed.size(),true);
00056 int iPair = 0;
00057
00058 for(TrajectorySeedCollection::iterator s1 =seed.begin(); s1 != seed.end(); ++s1){
00059
00060
00061 TrajectorySeed::range r1 = s1->recHits();
00062
00063 for(TrajectorySeedCollection::const_iterator s2 = seedTr.begin(); s2 != seedTr.end(); ++s2){
00064
00065 if(s2->nHits()==0) continue ;
00066
00067 TrajectorySeed::range r2 = s2->recHits();
00068 TrajectorySeed::const_iterator h2 = r2.first;
00069
00070
00071 int shared = 0;
00072
00073 for(;h2 < r2.second;h2++){
00074 for(TrajectorySeed::const_iterator h1 = r1.first; h1 < r1.second;h1++){
00075 if(h2->sharesInput(&(*h1),TrackingRecHit::all)) shared++;
00076 if(s1->nHits()!=3) LogDebug(theCategory)<< shared<< " shared hits counter if 2 erease the seed.";
00077 }
00078 }
00079
00080 if(shared ==2 && s1->nHits()!=3) {
00081 maskPairs[iPair] = false;
00082 }
00083
00084 }
00085 ++iPair;
00086 }
00087
00088 iPair = 0;
00089
00090 for(TrajectorySeedCollection::iterator s1 = seed.begin(); s1 != seed.end(); ++s1){
00091 if (maskPairs[iPair]) result.push_back(*s1);
00092 ++iPair;
00093 }
00094
00095
00096 seed.swap(result);
00097 }
00098