16 isEventSetupset =
false;
22 isCheckgoodOverlap = iConfig.
getParameter<
bool>(
"isCheckgoodOverlap");
23 isCheckcandidateOverlap = iConfig.
getParameter<
bool>(
"isCheckcandidateOverlap");
24 ShareRecHitsNumberThreshold = iConfig.
getParameter<
unsigned int>(
"ShareRecHitsNumberThreshold");
29 std::vector<weightedTrajectorySeed> *candidateweightedRef) {
30 goodweightedSeedsRef = goodweightedRef;
31 candidateweightedSeedsRef = candidateweightedRef;
39 isEventSetupset =
true;
43 if (isConfigured ==
false || isIOset ==
false || isEventSetupset ==
false) {
44 cout <<
"Configuration or IO is not set yet" << endl;
47 if (isCheckgoodOverlap ==
true)
49 if (isCheckcandidateOverlap ==
true)
54 std::vector<weightedTrajectorySeed> *weightedSeedsRef) {
55 std::vector<weightedTrajectorySeed> sortweightedSeeds;
56 std::vector<weightedTrajectorySeed> tempweightedSeeds;
62 while (!weightedSeedsRef->empty()) {
63 cout <<
"Finding the weighted seeds group from " << weightedSeedsRef->size() <<
" seeds which share some recHits" 67 tempweightedSeeds.clear();
69 for (vector<weightedTrajectorySeed>::iterator itweightedseed = weightedSeedsRef->begin();
70 itweightedseed != weightedSeedsRef->end();
74 cout <<
"Always take the 1st weighted seed to be the referrence." << endl;
76 cout <<
"Put its recHits to tempRecHits" << endl;
79 cout <<
"Put it to tempweightedSeeds" << endl;
80 tempweightedSeeds.push_back(*itweightedseed);
81 cout <<
"Then erase from weightedSeedsRef->" << endl;
82 itweightedseed = weightedSeedsRef->erase(itweightedseed);
84 cout <<
"Come to other weighted seed for checking " << itweightedseed->first.nHits() <<
" recHits from " 85 << tempRecHits.
size() <<
" temp recHits" << endl;
86 unsigned int ShareRecHitsNumber = 0;
88 if (isShareHit(tempRecHits, *it, rpcGeometry))
91 if (ShareRecHitsNumber >= ShareRecHitsNumberThreshold) {
92 cout <<
"This seed is found to belong to current share group" << endl;
94 if (!isShareHit(tempRecHits, *it, rpcGeometry)) {
95 cout <<
"Put its extra recHits to tempRecHits" << endl;
99 cout <<
"Put it to tempSeeds" << endl;
100 tempweightedSeeds.push_back(*itweightedseed);
101 cout <<
"Then erase from SeedsRef" << endl;
102 itweightedseed = weightedSeedsRef->erase(itweightedseed);
110 vector<weightedTrajectorySeed>::iterator bestweightediter;
113 unsigned NumberofHits = 0;
114 cout <<
"Find " << tempweightedSeeds.size() <<
" seeds into one trajectory group" << endl;
115 for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
116 itweightedseed != tempweightedSeeds.end();
118 unsigned int nHits = itweightedseed->first.nHits();
121 double weightedQuality = itweightedseed->second;
122 cout <<
"Find a weighted seed with quality " << weightedQuality << endl;
123 if ((NumberofHits < nHits) || (NumberofHits == nHits && weightedQuality < Quality)) {
124 NumberofHits = nHits;
125 Quality = weightedQuality;
126 bestweightedSeed = *itweightedseed;
127 bestweightediter = itweightedseed;
130 cout <<
"Best good temp seed's quality is " << Quality << endl;
131 sortweightedSeeds.push_back(bestweightedSeed);
132 tempweightedSeeds.erase(bestweightediter);
136 it != bestweightedSeed.first.recHits().second;
140 for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
141 itweightedseed != tempweightedSeeds.end();) {
142 cout <<
"Checking the temp weighted seed's " << itweightedseed->first.nHits() <<
" hits to " << tempRecHits.
size()
143 <<
" temp recHits" << endl;
145 bool isShare =
false;
147 if (isShareHit(tempRecHits, *it, rpcGeometry))
150 if (isShare ==
true) {
151 cout <<
"Find one temp seed share some recHits with best weighted seed" << endl;
152 itweightedseed = tempweightedSeeds.erase(itweightedseed);
154 cout <<
"This seed has no relation with best weighted seed" << endl;
155 weightedSeedsRef->push_back(*itweightedseed);
156 itweightedseed = tempweightedSeeds.erase(itweightedseed);
161 weightedSeedsRef->clear();
162 *weightedSeedsRef = sortweightedSeeds;
168 bool istheSame =
false;
170 cout <<
"Checking from " << RecHits.
size() <<
" temp recHits" << endl;
176 cout <<
"The hit's position: " << gpos1.
x() <<
", " << gpos1.
y() <<
", " << gpos1.
z() << endl;
178 cout <<
"Checking the " << n <<
" th recHit from tempRecHits" << endl;
180 DetId RPCId2 = it->geographicalId();
183 cout <<
"The temp hit's position: " << gpos2.
x() <<
", " << gpos2.
y() <<
", " << gpos2.
z() << endl;
185 if ((gpos1.
x() == gpos2.
x()) && (gpos1.
y() == gpos2.
y()) && (gpos1.
z() == gpos2.
z())) {
186 cout <<
"This hit is found to be the same" << endl;
T getParameter(std::string const &) const
std::pair< const_iterator, const_iterator > range
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
RPCSeedPattern::weightedTrajectorySeed weightedTrajectorySeed
bool isShareHit(const edm::OwnVector< TrackingRecHit > &RecHits, const TrackingRecHit &hit, edm::ESHandle< RPCGeometry > rpcGeometry)
recHitContainer::const_iterator const_iterator
virtual LocalPoint localPosition() const =0
void configure(const edm::ParameterSet &iConfig)
void setEventSetup(const edm::EventSetup &iSetup)
DetId geographicalId() const
void CheckOverlap(const edm::EventSetup &iSetup, std::vector< weightedTrajectorySeed > *SeedsRef)
void setIO(std::vector< weightedTrajectorySeed > *goodweightedRef, std::vector< weightedTrajectorySeed > *candidateweightedRef)