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  for (TrajectorySeedCollection::const_iterator s2 = seedTr.begin(); s2 != seedTr.end(); ++s2) {
59  //empty
60  if (s2->nHits() == 0)
61  continue;
62 
63  //number of shared hits;
64  int shared = 0;
65 
66  for (auto const& h2 : s2->recHits()) {
67  for (auto const& h1 : s1->recHits()) {
68  if (h2.sharesInput(&h1, TrackingRecHit::all))
69  shared++;
70  if (s1->nHits() != 3)
71  LogDebug(theCategory) << shared << " shared hits counter if 2 erease the seed.";
72  }
73  }
74 
75  if (shared == 2 && s1->nHits() != 3) {
76  maskPairs[iPair] = false;
77  }
78 
79  } //end triplets loop
80  ++iPair;
81  } // end pairs loop
82 
83  iPair = 0;
84  //remove pairs in triplets
85  for (TrajectorySeedCollection::iterator s1 = seed.begin(); s1 != seed.end(); ++s1) {
86  if (maskPairs[iPair])
87  result.push_back(*s1);
88  ++iPair;
89  }
90 
91  // cleaned collection
92  seed.swap(result);
93 }
MessageLogger.h
L3MuonTrajectorySeedCollection.h
edm
HLT enums.
Definition: AlignableModifier.h:19
RedundantSeedCleaner::clean
void clean(const std::vector< TrajectorySeed > &, std::vector< TrajectorySeed > &)
clean
Definition: RedundantSeedCleaner.cc:48
TransientTrackingRecHit.h
indexGen.s2
s2
Definition: indexGen.py:107
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
fileCollector.seed
seed
Definition: fileCollector.py:127
RedundantSeedCleaner.h
RedundantSeedCleaner::define
void define(std::vector< TrajectorySeed > &)
collection definition
Definition: RedundantSeedCleaner.cc:29
TrackingRecHit.h
SiPixelRecHit.h
L3MuonTrajectorySeed.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
TrackingRecHit::all
Definition: TrackingRecHit.h:59
TrajectorySeedCollection.h
clean
static void clean(char *s)
Definition: ConnectionManager.cc:13
mps_fire.result
result
Definition: mps_fire.py:311