51 std::vector<weightedTrajectorySeed> sortweightedSeeds;
52 std::vector<weightedTrajectorySeed> tempweightedSeeds;
53 std::vector<TrackingRecHit const *> tempRecHits;
55 while (!weightedSeedsRef->empty()) {
56 cout <<
"Finding the weighted seeds group from " << weightedSeedsRef->size() <<
" seeds which share some recHits"
60 tempweightedSeeds.clear();
62 for (vector<weightedTrajectorySeed>::iterator itweightedseed = weightedSeedsRef->begin();
63 itweightedseed != weightedSeedsRef->end();
65 auto const &recHitsRange = itweightedseed->first.recHits();
67 cout <<
"Always take the 1st weighted seed to be the referrence." << endl;
68 for (
auto const &
hit : recHitsRange) {
69 cout <<
"Put its recHits to tempRecHits" << endl;
70 tempRecHits.push_back(&
hit);
72 cout <<
"Put it to tempweightedSeeds" << endl;
73 tempweightedSeeds.push_back(*itweightedseed);
74 cout <<
"Then erase from weightedSeedsRef->" << endl;
75 itweightedseed = weightedSeedsRef->erase(itweightedseed);
77 cout <<
"Come to other weighted seed for checking " << itweightedseed->first.nHits() <<
" recHits from "
78 << tempRecHits.size() <<
" temp recHits" << endl;
79 unsigned int ShareRecHitsNumber = 0;
80 for (
auto const &
hit : recHitsRange) {
85 cout <<
"This seed is found to belong to current share group" << endl;
86 for (
auto const &
hit : recHitsRange) {
88 cout <<
"Put its extra recHits to tempRecHits" << endl;
89 tempRecHits.push_back(&
hit);
92 cout <<
"Put it to tempSeeds" << endl;
93 tempweightedSeeds.push_back(*itweightedseed);
94 cout <<
"Then erase from SeedsRef" << endl;
95 itweightedseed = weightedSeedsRef->erase(itweightedseed);
103 vector<weightedTrajectorySeed>::iterator bestweightediter;
106 unsigned NumberofHits = 0;
107 cout <<
"Find " << tempweightedSeeds.size() <<
" seeds into one trajectory group" << endl;
108 for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
109 itweightedseed != tempweightedSeeds.end();
111 unsigned int nHits = itweightedseed->first.nHits();
114 double weightedQuality = itweightedseed->second;
115 cout <<
"Find a weighted seed with quality " << weightedQuality << endl;
116 if ((NumberofHits < nHits) || (NumberofHits == nHits && weightedQuality <
Quality)) {
117 NumberofHits = nHits;
119 bestweightedSeed = *itweightedseed;
120 bestweightediter = itweightedseed;
123 cout <<
"Best good temp seed's quality is " <<
Quality << endl;
124 sortweightedSeeds.push_back(bestweightedSeed);
125 tempweightedSeeds.erase(bestweightediter);
128 for (
auto const &
hit : bestweightedSeed.first.recHits()) {
129 tempRecHits.push_back(&
hit);
132 for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
133 itweightedseed != tempweightedSeeds.end();) {
134 cout <<
"Checking the temp weighted seed's " << itweightedseed->first.nHits() <<
" hits to " << tempRecHits.size()
135 <<
" temp recHits" << endl;
136 bool isShare =
false;
137 for (
auto const &
hit : itweightedseed->first.recHits()) {
142 if (isShare ==
true) {
143 cout <<
"Find one temp seed share some recHits with best weighted seed" << endl;
144 itweightedseed = tempweightedSeeds.erase(itweightedseed);
146 cout <<
"This seed has no relation with best weighted seed" << endl;
147 weightedSeedsRef->push_back(*itweightedseed);
148 itweightedseed = tempweightedSeeds.erase(itweightedseed);
153 weightedSeedsRef->clear();
154 *weightedSeedsRef = sortweightedSeeds;