13 void sortHits(std::vector<MuonR4::HoughHitType>&
hits) {
14 std::ranges::sort(
hits,
19 if (std::abs(hitA.z() - hitB.z()) > layerTol) {
20 return hitA.z() < hitB.z();
22 return hitA.y() < hitB.y();
29 ISvcLocator* pSvcLocator)
37 return StatusCode::SUCCESS;
40 template <
class ContainerType>
43 const ContainerType*& contToPush)
const {
47 <<
typeid(ContainerType).
name());
48 return StatusCode::SUCCESS;
52 contToPush = readHandle.cptr();
53 return StatusCode::SUCCESS;
64 peakFinderCfg.fractionCutoff = 0.4;
65 peakFinderCfg.threshold = 2;
66 peakFinderCfg.minSpacingBetweenPeaks = {0., 30.};
67 data.houghPlane = std::make_unique<HoughPlane>(
cfg);
68 data.peakFinder = std::make_unique<ActsPeakFinderForMuon>(peakFinderCfg);
70 return StatusCode::SUCCESS;
74 const ActsPeakFinderForMuon::Maximum& phiMaximum,
76 std::unordered_map<const xAOD::UncalibratedMeasurement*, bool> foundEtas;
79 if (hit->measuresEta() && hit->measuresPhi()) {
81 foundEtas.emplace(hit->primaryMeasurement(),
false);
85 iter->second |= phiMaximum.hitIdentifiers.count(hit);
90 foundEtas.begin(), foundEtas.end(),
91 [](
const std::pair<const xAOD::UncalibratedMeasurement*, bool>&
p) {
95 std::unique_ptr<SegmentSeed>
97 const ActsPeakFinderForMuon::Maximum & phiMax)
const {
99 std::vector<HoughHitType> hitsOnMax;
102 return (hit->measuresEta() && !hit->measuresPhi());
105 hitsOnMax.insert(hitsOnMax.end(), phiMax.hitIdentifiers.begin(), phiMax.hitIdentifiers.end());
108 return std::make_unique<SegmentSeed>(
etaMax.tanTheta(),
etaMax.interceptY(), phiMax.x, phiMax.y, hitsOnMax.size(), std::move(hitsOnMax),
etaMax.parentBucket());
121 if (!hit->measuresPhi())
124 Amg::Vector3D extrapDir = (hit->positionInChamber() - hit->chamber()->globalToLocalTrans(gctx).translation()).
unit();
126 std::optional<double> dummyIntercept = Amg::intersect<3>(hit->positionInChamber(),extrapDir,Amg::Vector3D::UnitZ(),0);
127 double x0 = (hit->positionInChamber() + dummyIntercept.value_or(0) * extrapDir).
x();
129 double tanPhi = extrapDir.x()/extrapDir.z();
153 Acts::HoughTransformUtils::HoughAxisRanges{searchStartTanPhi, searchEndTanPhi, searchStart, searchEnd};
155 return StatusCode::SUCCESS;
159 std::map<int, std::vector<ActsPeakFinderForMuon::Maximum>> rankedSeeds;
160 using namespace std::placeholders;
165 if (!hit->measuresPhi())
177 auto foundMaxPhi = eventData.
peakFinder->findPeaks(
180 for (
auto solution : foundMaxPhi) {
186 auto best = rankedSeeds.begin();
193 std::unique_ptr<SegmentSeed>
200 data.searchSpaceTanAngle.first,
201 data.searchSpaceIntercept.first,
225 ATH_CHECK(writeMaxima.record(std::make_unique<SegmentSeedContainer>()));
231 bool foundSolution=
false;
233 if (eventData.phiHitsOnMax > 1){
235 for (
auto & phiSolution : rankedSeeds){
236 foundSolution =
true;
251 writeMaxima->push_back(std::make_unique<SegmentSeed>(*
max));
257 return StatusCode::SUCCESS;