7 #include "GaudiKernel/MsgStream.h"
21 ATH_MSG_INFO(
"FPGATrackSimOverlapRemovalTool::initialize()" );
35 ATH_MSG_WARNING(
"LocalMaxOR only being run per hough slice (i.e. this tool does nothing) since roadSliceOR is turned off");
44 return StatusCode::FAILURE;
48 return StatusCode::SUCCESS;
53 if (!localMaxWindowSize)
return true;
54 if (!
acc(
y,
x))
return false;
55 for (
int j = -localMaxWindowSize; j <= localMaxWindowSize; j++)
56 for (
int i = -localMaxWindowSize;
i <= localMaxWindowSize;
i++)
58 if (
i == 0 && j == 0)
continue;
59 if (
y + j <
acc.size(0) &&
x +
i <
acc.size(1))
61 if (!
acc(
y+j,
x+
i))
continue;
62 if (
acc(
y+j,
x+
i)->getNHitLayers() >
acc(
y,
x)->getNHitLayers())
return false;
63 if (
acc(
y+j,
x+
i)->getNHitLayers() ==
acc(
y,
x)->getNHitLayers())
65 if (
acc(
y+j,
x+
i)->getNHits() >
acc(
y,
x)->getNHits())
return false;
66 if (
acc(
y+j,
x+
i)->getNHits() ==
acc(
y,
x)->getNHits() && j <= 0 &&
i <= 0)
return false;
76 if (roads.empty())
return StatusCode::SUCCESS;
79 size_t in = roads.size();
89 else if (
r->getNHitLayers() >
old->getNHitLayers()) *
old = *
r.get();
90 else if (
r->getNHitLayers() ==
old->getNHitLayers() &&
r->getNHits() >
old->getNHits()) *
old = *
r.get();
98 roads.emplace_back(std::shared_ptr<const FPGATrackSimRoad>(tempPtr));
106 ATH_MSG_DEBUG(
"Input: " << in <<
" Output: " << roads.size());
107 return StatusCode::SUCCESS;
128 auto hash_a =
a->getIdentifierHash();
129 auto hash_b =
b->getIdentifierHash();
130 if ( hash_a == hash_b ) {
131 auto phi_a =
a->getPhiCoord();
132 auto phi_b =
b->getPhiCoord();
133 if ( phi_a == phi_b ) {
134 auto eta_a =
a->getEtaCoord();
135 auto eta_b =
b->getEtaCoord();
136 if ( eta_a == eta_b) {
137 auto layer_a =
a->getLayer();
138 auto layer_b =
b->getLayer();
139 return layer_a < layer_b;
141 return eta_a < eta_b;
143 return phi_a < phi_b;
145 return hash_a < hash_b;
149 std::set<const FPGATrackSimHit*, HitCompare > hitsInTrack1;
151 if (hit.isReal()) hitsInTrack1.insert(&hit);
154 std::set<const FPGATrackSimHit*, HitCompare> hitsInTrack2;
156 if (hit.isReal()) hitsInTrack2.insert(&hit);
159 std::vector<const FPGATrackSimHit*> sharedHits;
161 hitsInTrack2.begin(), hitsInTrack2.end(),
162 std::back_inserter(sharedHits),
166 int nHitsInTrack1 = hitsInTrack1.size();
167 int nHitsInTrack2 = hitsInTrack2.size();
168 int nSharedHits = sharedHits.size();
171 int nonOverlappingHits =
std::min(nHitsInTrack1 - nSharedHits, nHitsInTrack2 - nSharedHits);
185 return StatusCode::FAILURE;
193 return StatusCode::SUCCESS;
198 std::vector<const FPGATrackSimHit*> hitsInTrack1;
200 if (hit.isReal()) hitsInTrack1.push_back(&hit);
203 std::vector<const FPGATrackSimHit*> hitsInTrack2;
205 if (hit.isReal()) hitsInTrack2.push_back(&hit);
211 bool goodOrder =
true;
212 if (hitsInTrack1.size() == hitsInTrack2.size()) {
219 }
else if (hitsInTrack1.size() > hitsInTrack2.size()) {
242 for (
unsigned int i=0;
i < tracks.size();
i++) {
246 tracks.at(
i).setPassedOR(0);
251 for (
unsigned int j=
i+1; j< tracks.size(); j++) {
257 if (!tracks.at(
i).passedOR())
break;
260 if (tracks.at(j).getChi2ndof() >
m_minChi2) tracks.at(j).setPassedOR(0);
264 if (!tracks.at(j).passedOR())
continue;
273 return StatusCode::SUCCESS;