18 isEventSetupset =
false;
27 isCheckgoodOverlap = iConfig.
getParameter<
bool>(
"isCheckgoodOverlap");
28 isCheckcandidateOverlap = iConfig.
getParameter<
bool>(
"isCheckcandidateOverlap");
29 ShareRecHitsNumberThreshold = iConfig.
getParameter<
unsigned int>(
"ShareRecHitsNumberThreshold");
33 void RPCSeedOverlapper::setIO(std::vector<weightedTrajectorySeed> *goodweightedRef, std::vector<weightedTrajectorySeed> *candidateweightedRef) {
35 goodweightedSeedsRef = goodweightedRef;
36 candidateweightedSeedsRef = candidateweightedRef;
48 isEventSetupset =
true;
53 if(isConfigured ==
false || isIOset ==
false || isEventSetupset ==
false) {
54 cout <<
"Configuration or IO is not set yet" << endl;
57 if(isCheckgoodOverlap ==
true)
59 if(isCheckcandidateOverlap ==
true)
65 std::vector<weightedTrajectorySeed> sortweightedSeeds;
66 std::vector<weightedTrajectorySeed> tempweightedSeeds;
72 while(weightedSeedsRef->size() != 0) {
73 cout <<
"Finding the weighted seeds group from " << weightedSeedsRef->size() <<
" seeds which share some recHits" << endl;
76 tempweightedSeeds.clear();
78 for(vector<weightedTrajectorySeed>::iterator itweightedseed = weightedSeedsRef->begin(); itweightedseed != weightedSeedsRef->end(); N++) {
81 cout <<
"Always take the 1st weighted seed to be the referrence." << endl;
83 cout <<
"Put its recHits to tempRecHits" << endl;
86 cout <<
"Put it to tempweightedSeeds" << endl;
87 tempweightedSeeds.push_back(*itweightedseed);
88 cout <<
"Then erase from weightedSeedsRef->" << endl;
89 itweightedseed = weightedSeedsRef->erase(itweightedseed);
92 cout <<
"Come to other weighted seed for checking " << itweightedseed->first.nHits() <<
" recHits from " << tempRecHits.
size() <<
" temp recHits" << endl;
93 unsigned int ShareRecHitsNumber = 0;
95 if(isShareHit(tempRecHits, *it, rpcGeometry))
98 if(ShareRecHitsNumber >= ShareRecHitsNumberThreshold) {
99 cout <<
"This seed is found to belong to current share group" << endl;
101 if(!isShareHit(tempRecHits, *it, rpcGeometry)) {
102 cout <<
"Put its extra recHits to tempRecHits" << endl;
106 cout <<
"Put it to tempSeeds" << endl;
107 tempweightedSeeds.push_back(*itweightedseed);
108 cout <<
"Then erase from SeedsRef" << endl;
109 itweightedseed = weightedSeedsRef->erase(itweightedseed);
118 vector<weightedTrajectorySeed>::iterator bestweightediter;
121 unsigned NumberofHits = 0;
122 cout <<
"Find " << tempweightedSeeds.size() <<
" seeds into one trajectory group" << endl;
123 for(vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin(); itweightedseed != tempweightedSeeds.end(); itweightedseed++) {
124 unsigned int nHits = itweightedseed->first.nHits();
127 double weightedQuality = itweightedseed->second;
128 cout <<
"Find a weighted seed with quality " << weightedQuality << endl;
129 if((NumberofHits < nHits) || (NumberofHits == nHits && weightedQuality < Quality)) {
130 NumberofHits = nHits;
131 Quality = weightedQuality;
132 bestweightedSeed = *itweightedseed;
133 bestweightediter = itweightedseed;
136 cout <<
"Best good temp seed's quality is " << Quality <<endl;
137 sortweightedSeeds.push_back(bestweightedSeed);
138 tempweightedSeeds.erase(bestweightediter);
144 for(vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin(); itweightedseed != tempweightedSeeds.end(); ) {
145 cout <<
"Checking the temp weighted seed's " << itweightedseed->first.nHits() <<
" hits to " << tempRecHits.
size() <<
" temp recHits" << endl;
147 bool isShare =
false;
149 if(isShareHit(tempRecHits, *it, rpcGeometry))
152 if(isShare ==
true) {
153 cout <<
"Find one temp seed share some recHits with best weighted seed" << endl;
154 itweightedseed = tempweightedSeeds.erase(itweightedseed);
157 cout <<
"This seed has no relation with best weighted seed" << endl;
158 weightedSeedsRef->push_back(*itweightedseed);
159 itweightedseed = tempweightedSeeds.erase(itweightedseed);
164 weightedSeedsRef->clear();
165 *weightedSeedsRef = sortweightedSeeds;
170 bool istheSame =
false;
172 cout <<
"Checking from " << RecHits.
size() <<
" temp recHits" << endl;
176 const GeomDetUnit *rpcroll1 = rpcGeometry->idToDetUnit(RPCId1);
178 cout <<
"The hit's position: " << gpos1.
x() <<
", " << gpos1.
y() <<
", " << gpos1.
z() << endl;
180 cout <<
"Checking the " << n <<
" th recHit from tempRecHits" << endl;
182 DetId RPCId2 = it->geographicalId();
183 const GeomDetUnit *rpcroll2 = rpcGeometry->idToDetUnit(RPCId2);
185 cout <<
"The temp hit's position: " << gpos2.
x() <<
", " << gpos2.
y() <<
", " << gpos2.
z() << endl;
187 if((gpos1.
x() == gpos2.
x()) && (gpos1.
y() == gpos2.
y()) && (gpos1.
z() == gpos2.
z())) {
188 cout <<
"This hit is found to be the same" << endl;
T getParameter(std::string const &) const
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
std::pair< const_iterator, const_iterator > range
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)
virtual LocalPoint localPosition() const =0
void setIO(std::vector< weightedTrajectorySeed > *goodweightedRef, std::vector< weightedTrajectorySeed > *candidateweightedRef)