CMS 3D CMS Logo

RedundantSeedCleaner.cc
Go to the documentation of this file.
1 
9 
10 //-------------------------------
11 // Collaborating Class Headers --
12 //-------------------------------
13 
21 
22 using namespace edm;
23 using namespace reco;
24 
25 //
26 // definition of vectors
27 //
28 
29 void RedundantSeedCleaner::define(std::vector<TrajectorySeed>& coll) {
30  std::vector<TrajectorySeed> triplets;
31 
32  //search for triplest
33  for (TrajectorySeedCollection::iterator itr = coll.begin(); itr != coll.end(); ++itr) {
34  //fill vector of triplets
35  if (itr->nHits() == 3)
36  triplets.push_back(*itr);
37  }
38 
39  // clean from shared input
40  if (!triplets.empty())
41  clean(triplets, coll);
42 }
43 
44 //
45 // the sharedHits cleaner
46 //
47 
48 void RedundantSeedCleaner::clean(const std::vector<TrajectorySeed>& seedTr, std::vector<TrajectorySeed>& seed) {
49  // loop over triplets
50  std::vector<TrajectorySeed> result;
51 
52  std::vector<bool> maskPairs = std::vector<bool>(seed.size(), true);
53  int iPair = 0;
54 
55  for (TrajectorySeedCollection::iterator s1 = seed.begin(); s1 != seed.end(); ++s1) {
56  //rechits from seed
57 
58  TrajectorySeed::range r1 = s1->recHits();
59 
60  for (TrajectorySeedCollection::const_iterator s2 = seedTr.begin(); s2 != seedTr.end(); ++s2) {
61  //empty
62  if (s2->nHits() == 0)
63  continue;
64 
65  TrajectorySeed::range r2 = s2->recHits();
66  TrajectorySeed::const_iterator h2 = r2.first;
67 
68  //number of shared hits;
69  int shared = 0;
70 
71  for (; h2 < r2.second; h2++) {
72  for (TrajectorySeed::const_iterator h1 = r1.first; h1 < r1.second; h1++) {
73  if (h2->sharesInput(&(*h1), TrackingRecHit::all))
74  shared++;
75  if (s1->nHits() != 3)
76  LogDebug(theCategory) << shared << " shared hits counter if 2 erease the seed.";
77  }
78  }
79 
80  if (shared == 2 && s1->nHits() != 3) {
81  maskPairs[iPair] = false;
82  }
83 
84  } //end triplets loop
85  ++iPair;
86  } // end pairs loop
87 
88  iPair = 0;
89  //remove pairs in triplets
90  for (TrajectorySeedCollection::iterator s1 = seed.begin(); s1 != seed.end(); ++s1) {
91  if (maskPairs[iPair])
92  result.push_back(*s1);
93  ++iPair;
94  }
95 
96  // cleaned collection
97  seed.swap(result);
98 }
#define LogDebug(id)
std::pair< const_iterator, const_iterator > range
void define(std::vector< TrajectorySeed > &)
collection definition
static void clean(char *s)
recHitContainer::const_iterator const_iterator
JetCorrectorParametersCollection coll
Definition: classes.h:10
fixed size matrix
HLT enums.
void clean(const std::vector< TrajectorySeed > &, std::vector< TrajectorySeed > &)
clean