ATLAS Offline Software
Loading...
Searching...
No Matches
MsTrackFindingAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MsTrackFindingAlg.h"
6
7#include "Acts/Surfaces/PerigeeSurface.hpp"
8#include "Acts/Surfaces/PlaneSurface.hpp"
9#include "Acts/Surfaces/RectangleBounds.hpp"
10#include "Acts/Surfaces/detail/PlanarHelper.hpp"
11#include "Acts/Utilities/detail/CombinatoricIndices.hpp"
12
16
20
22
24#include "GaudiKernel/PhysicalConstants.h"
27
28#include <limits>
29#include <system_error>
30
31using namespace Acts::UnitLiterals;
32using namespace Acts::PlanarHelper;
33using namespace Muon::MuonStationIndex;
34
35namespace MuonR4{
37 ATH_CHECK(m_idHelperSvc.retrieve());
38 ATH_CHECK(detStore()->retrieve(m_detMgr));
40
41 ATH_CHECK(m_visualizationTool.retrieve(EnableTool{!m_visualizationTool.empty()}));
42 ATH_CHECK(m_trackFitTool.retrieve());
43 ATH_CHECK(m_calibTool.retrieve());
44 ATH_CHECK(m_writeKey.initialize());
45 ATH_CHECK(m_summaryTool.retrieve());
46 ATH_CHECK(m_seedingTool.retrieve());
47 ATH_CHECK(m_extrapolationTool.retrieve(EnableTool{m_expressAtMsEntrance}));
49 ATH_CHECK(m_pseudoMeasuremntCreator.initialize(m_writeKey.key(), !m_writeKey.empty()));
50 ATH_CHECK(m_ctxProvider.initialize());
51 return StatusCode::SUCCESS;
52 }
53
55
56 StatusCode MsTrackFindingAlg::execute(const EventContext& ctx) const {
57 ATH_MSG_VERBOSE("Run track finding in event "<<ctx.eventID().event_number());
58
59
60 auto seedContainer = std::make_unique<MsTrackSeedContainer>();
61
62 ATH_CHECK(m_seedingTool->findTrackSeeds(ctx, *seedContainer));
63
64 if (!m_visualizationTool.empty()) {
65 m_visualizationTool->displaySeeds(ctx, *seedContainer);
66 }
67 const Acts::GeometryContext tgContext{m_ctxProvider.getGeometryContext(ctx)};
68 const Acts::MagneticFieldContext mfContext{m_ctxProvider.getMagneticFieldContext(ctx)};
69 const Acts::CalibrationContext calContext{m_ctxProvider.getCalibrationContext(ctx)};
70
71 ActsTrk::MutableTrackContainer cacheTrkContainer{Acts::VectorTrackContainer{},
72 Acts::VectorMultiTrajectory{}};
73
74 auto auxMeasHandler = m_pseudoMeasuremntCreator.makeHandle(ctx, tgContext);
75 ATH_CHECK(auxMeasHandler.ok());
77 cacheTrkContainer.addColumn<std::size_t>("parentSeed");
78 unsigned seedIdx{0};
79 for (MsTrackSeed& seed : *seedContainer) {
80 if (seed.hasOverlap()) {
81 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Overlap marker from a previous fit is triggered.");
82 continue;
83 }
84 if (fitSeedCandidate(tgContext, mfContext, calContext, seed,
85 cacheTrkContainer, *auxMeasHandler)) {
86 auto lastTrack = cacheTrkContainer.getTrack(cacheTrkContainer.size() -1);
87 lastTrack.component<std::size_t, Acts::hashString("parentSeed")>() = seedIdx;
88 seed.triggerOverlapMarker();
89 ++seedIdx;
90 }
91 }
92 auto [rBegin, rEnd] = std::ranges::remove_if(*seedContainer, &MsTrackSeed::hasOverlap);
93 seedContainer->erase(rBegin, rEnd);
94 if (!m_msTrkSeedKey.empty()) {
95 SG::WriteHandle writeHandleSeed{m_msTrkSeedKey, ctx};
96 ATH_CHECK(writeHandleSeed.record(std::move(seedContainer)));
97 }
98
99 // Constant declination
100 auto ctc = std::make_unique<ActsTrk::TrackContainer>(Acts::ConstVectorTrackContainer{std::move(cacheTrkContainer.container())},
101 Acts::ConstVectorMultiTrajectory{std::move(cacheTrkContainer.trackStateContainer())});
102
103 SG::WriteHandle writeHandle{m_writeKey, ctx};
104 ATH_CHECK(writeHandle.record(std::move(ctc)));
105 return StatusCode::SUCCESS;
106 }
107
109 MsTrackFindingAlg::collectMeasurements(const Acts::GeometryContext& tgContext,
110 const Acts::BoundTrackParameters& startPars,
111 const MsTrackSeed& seed,
112 PseudoMeasHandle_t& auxMeasContainer) const {
113 MeasVec_t pickedMeas{};
114 pickedMeas.reserve(seed.nMeasurements());
115
116 std::uint8_t nPhiMeasurements{0};
117 AmgSymMatrix(1) phiCov{Acts::square(1._cm)};
119 for (const xAOD::MuonSegment* segment : seed.segments()) {
120 m_calibTool->stampSignsOnMeasurements(tgContext, *segment);
123 for (std::size_t m = 0; m < nMeasurements(*segment); ++m) {
124 const xAOD::UncalibratedMeasurement* meas = getMeasurement(*segment, m);
125 if (meas->type() == xAOD::UncalibMeasType::Other ||
126 isOutlierMeasurement(*segment, m)) {
127 continue;
128 }
129 pickedMeas.push_back(meas);
131 switch (meas->numDimensions()) {
132 case 1: {
133 const auto* muonMeas{dynamic_cast<const xAOD::MuonMeasurement*>(meas)};
134 assert(muonMeas != nullptr);
135 if (muonMeas->measuresPhi() || (muonMeas->type() == xAOD::UncalibMeasType::MMClusterType &&
136 m_idHelperSvc->mmIdHelper().isStereo(muonMeas->identify()))) {
137 ++nPhiMeasurements;
138 phiCov(0,0) = std::max(phiCov(0,0), 1.* meas->localCovariance<1>()(0, 0));
139 }
140 break;
141 }
143 case 0:
144 case 2:
145 ++nPhiMeasurements;
146 phiCov(0,0) = std::max(phiCov(0,0), 1.*meas->localCovariance<2>()(Acts::eBoundLoc1, Acts::eBoundLoc1));
147 break;
148 default:
149 break;
150 }
151 }
152 }
153
154 if (nPhiMeasurements < 2) {
156 const Amg::Vector3D startPos = startPars.position(tgContext);
157 const Amg::Vector3D startDir = startPars.direction();
158
160 const Acts::Transform3& startTrf{startPars.referenceSurface().
161 localToGlobalTransform(tgContext)};
163 const Amg::Vector3D locDir = startTrf.inverse().linear() * startDir;
164 const Amg::Vector3D locPos = startTrf.inverse()* startPos;
166 const Amg::Vector3D firstM = xAOD::muonSurface(pickedMeas.front()).
167 intersect(tgContext, startPos, startDir).closest().position();
168 const Amg::Vector3D lastM = xAOD::muonSurface(pickedMeas.back()).
169 intersect(tgContext, startPos, startDir).closest().position();
170
171 auto bounds = std::make_shared<Acts::RectangleBounds>(10._m, 10. * std::sqrt(phiCov(0,0)));
172 /* Place the first one between the first measurement and the start*/
173 auto firstSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(startTrf *
174 Amg::getTranslate3D(locPos + 0.5*(firstM - startPos).dot(startDir) * locDir), bounds);
175 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Create new auxilliary surface @ "
176 <<Amg::toString(firstSurface->localToGlobalTransform(tgContext)));
177 auto lastSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(startTrf *
178 Amg::getTranslate3D(locPos + (8._mm + (lastM - startPos).dot(startDir))* locDir), bounds);
179 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Create new auxilliary surface @ "
180 <<Amg::toString(lastSurface->localToGlobalTransform(tgContext)));
182 pickedMeas.push_back(auxMeasContainer.newMeasurement<1>(firstSurface, calibIdx, phiCov));
183 pickedMeas.push_back(auxMeasContainer.newMeasurement<1>(lastSurface, calibIdx, phiCov));
184 }
185 if (msgLvl(MSG::VERBOSE)) {
186 std::stringstream sstr{};
187 for (const xAOD::UncalibratedMeasurement* m : pickedMeas) {
189 if (!xAOD::isMuon(m->type())) {
190 sstr<<" --- auxiliary measurement, nDim: "<<m->numDimensions()<<std::endl;
191 continue;
192 }
193 sstr<<" --- "<<m_idHelperSvc->toString(xAOD::identify(m))<<", nDim: "<<m->numDimensions()<<", "
194 <<xAOD::muonSurface(m).geometryId()<<std::endl;
195 }
196 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Collected measurements.\n"<<sstr.str());
197 }
198 return pickedMeas;
199 }
200
201 template <std::size_t N>
202 std::unique_ptr<ActsTrk::MutableTrackContainer>
203 MsTrackFindingAlg::fitBestCombination(const Acts::GeometryContext& tgContext,
204 const Acts::MagneticFieldContext& mfContext,
205 const Acts::CalibrationContext& calContext,
206 const MsTrackSeed& seed,
207 std::optional<Acts::BoundTrackParameters> startPars,
208 PseudoMeasHandle_t& auxMeasContainer) const {
209 std::unique_ptr<ActsTrk::MutableTrackContainer> bestFit{};
210 const EventContext& ctx{*calContext.get<const EventContext*>()};
211 const auto stations = seed.stations();
212 std::array<StIndex, N> pickedStations{};
213
214 double bestRedChi2{std::numeric_limits<double>::max()};
215 Acts::detail::CombinatoricIndices<N> stationPicker{stations.size()};
216 for (const auto& combo : stationPicker) {
217 for (std::size_t i =0 ; i < N; ++i){
218 pickedStations[i] = stations[combo[i]];
219 }
220 if constexpr(N == 2) {
221 if (Acts::rangeContainsValue(pickedStations, StIndex::BE) ||
222 Acts::rangeContainsValue(pickedStations, StIndex::EE) ||
223 toLayerIndex(pickedStations.front()) == toLayerIndex(pickedStations.back()) ||
224 (Acts::rangeContainsValue(pickedStations, StIndex::EM) &&
225 Acts::rangeContainsValue(pickedStations, StIndex::EO))){
226 continue;
227 }
228 }
229
230 MsTrackSeed partialSeed{seed.location(), seed.sector()};
231 for (const xAOD::MuonSegment* segment : seed.segments()) {
232 const StIndex stIdx = toStationIndex(segment->chamberIndex());
233 if (!Acts::rangeContainsValue(pickedStations, stIdx)) {
234 continue;
235 }
236 partialSeed.addSegment(segment);
237 }
238 ATH_MSG_DEBUG(__func__<<"<"<<N<<">() "<<__LINE__<<" - Try station combination "<<pickedStations);
239
240 if (startPars) {
241 const Amg::Vector3D startPos = startPars->position(tgContext);
242 const Acts::GeometryIdentifier volId = volumeId(xAOD::muonSurface(getMeasurement(*partialSeed.segments()[0], 0)));
243 const Acts::TrackingVolume* volume{MuonGMR4::highestAlignable(m_trackingGeometrySvc->trackingGeometry()->findVolume(volId))};
244 auto boundSurf = MuonGMR4::bottomBoundary(*volume);
245 if (!boundSurf) {
246 ATH_MSG_WARNING(__func__<<"<"<<N<<">() "<<__LINE__<<" - Failed to find boundary surface for tracking volume");
247 continue;
248 }
249
250 ATH_MSG_VERBOSE(__func__<<"<"<<N<<">() "<<__LINE__<<" - Start position: "<<Amg::toString(startPos)
251 <<", perp: "<<startPos.perp()<<", "<<startPars->referenceSurface().center(tgContext).perp()
252 <<", surf center: "<<Amg::toString(boundSurf->center(tgContext))
253 <<", perp: "<<boundSurf->center(tgContext).perp()
254 <<", "<<(boundSurf->center(tgContext)-startPos).dot(startPars->direction()));
256 if (boundSurf->geometryId() != startPars->referenceSurface().geometryId() &&
257 (boundSurf->center(tgContext)-startPos).dot(startPars->direction()) < 0.) {
258
259 auto firstSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(boundSurf->localToGlobalTransform(tgContext) *
260 Amg::getTranslateZ3D(-10._cm));
261 ATH_MSG_DEBUG(__func__<<"<"<<N<<">() "<<__LINE__<<" - Extrapolate back onto surface "
262 <<firstSurface->center(tgContext).perp()
263 <<", "<<boundSurf->center(tgContext).perp());
264
265 auto extpPars = m_extrapolationTool->propagate(ctx, *startPars, *firstSurface,
266 Acts::Direction::Backward());
267 if(extpPars.ok()) {
268 startPars = std::move(*extpPars);
269 }
270 }
271 } else {
272 auto seedPars = m_seedingTool->estimateStartParameters(ctx, partialSeed);
273 if (seedPars.ok()) {
274 startPars = std::move(*seedPars);
275 }
276 }
277 if (!startPars) {
278 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Start parameter estimation failed.");
279 continue;
280 }
281 const MeasVec_t measurements = collectMeasurements(tgContext, *startPars, partialSeed, auxMeasContainer);
282 auto fit = m_trackFitTool->fit(measurements, *startPars, tgContext, mfContext, calContext, nullptr);
283 if (!fit) {
284 ATH_MSG_DEBUG(__func__<<"<"<<N<<">() "<<__LINE__<<" - Fit failed.");
285 continue;
286 }
287 ActsTrk::MutableTrackContainer::TrackProxy track = fit->getTrack(0);
288 const std::size_t nFitStations = m_summaryTool->countMuonStations(ctx, track);
289 const double redChi2 = track.chi2() / std::max<double>(1., track.nDoF());
290 ATH_MSG_DEBUG(__func__<<"<"<<N<<">() "<<__LINE__<<" - Combination "<<pickedStations
291 <<" gives chi2/nDoF: "<<redChi2<<", nStations: "<<nFitStations);
292 if (nFitStations >= N && redChi2 < bestRedChi2) {
293 bestRedChi2 = redChi2;
294 bestFit = std::move(fit);
295 }
296 }
297 return bestFit;
298 }
299
300
301 bool MsTrackFindingAlg::fitSeedCandidate(const Acts::GeometryContext& tgContext,
302 const Acts::MagneticFieldContext& mfContext,
303 const Acts::CalibrationContext& calContext,
304 const MsTrackSeed& seed,
305 ActsTrk::MutableTrackContainer& outContainer,
306 PseudoMeasHandle_t& auxMeasContainer) const {
307 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Attempt to fit a new track seed \n"<<seed);
308 const EventContext& ctx{*calContext.get<const EventContext*>()};
309 const auto initialPars = m_seedingTool->estimateStartParameters(ctx, seed);
310 if (!initialPars.ok()) {
311 ATH_MSG_WARNING(__func__<<"() "<<__LINE__
312 <<" - Start parameter creation failed. ");
313 if (m_visualizationTool.isEnabled()) {
314 m_visualizationTool->displayTrackSeedObj(ctx, seed, initialPars, "FailedStartPars");
315 }
316 return false;
317 }
318 MeasVec_t measurements = collectMeasurements(tgContext, *initialPars, seed, auxMeasContainer);
319
320 ActsTrk::MutableTrackContainer fitAttempts{Acts::VectorTrackContainer{},
321 Acts::VectorMultiTrajectory{}};
322
323 auto copyFit = [&] (std::unique_ptr<ActsTrk::MutableTrackContainer> && result,
324 const std::size_t reqStations) {
325 if (!result || result->size() == 0ul) {
326 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Track fit failed");
327 if (m_visualizationTool.isEnabled()) {
328 auto fitStartPars = fitAttempts.size() > 0 ? fitAttempts.getTrack(
329 fitAttempts.size() -1ul).createParametersAtReference() :
330 *initialPars;
331 m_visualizationTool->displayTrackSeedObj(ctx, seed, fitStartPars,
332 "FailedFit");
333 }
334 return false;
335 }
336 fitAttempts.ensureDynamicColumns(*result);
337 ActsTrk::MutableTrackContainer::TrackProxy track = result->getTrack(0);
338
339 auto destProxy = fitAttempts.getTrack(fitAttempts.addTrack());
340 destProxy.copyFrom(track);
341
342 const std::size_t nStations = m_summaryTool->countMuonStations(ctx, track);
343 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Created new track "<<Amg::toString(track.parameters())<<
344 " with chi2: "<<(track.chi2() / track.nDoF())<<", nDoF: "<<track.nDoF()<<", nStations: "<<nStations
345 <<", requested: "<<reqStations);
346 if (m_visualizationTool.isEnabled() && nStations < reqStations) {
347 m_visualizationTool->displayTrackSeedObj(ctx, seed, track.createParametersAtReference(),
348 std::format("InsufficentStations_{:}_vs_{:}", nStations, reqStations));
349 }
350 return nStations >= reqStations;
351 };
353 const Acts::Surface* target = initialPars->referenceSurface().getSharedPtr().get();
354 if (!copyFit(m_trackFitTool->fit(measurements, *initialPars,
355 tgContext, mfContext, calContext, target), seed.nStations()) && seed.nStations() > 2) {
356 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - First shot failed. Attempt iteratively over the stations. ");
357 for (std::size_t nStation = 2ul; nStation <= seed.nStations(); ++nStation) {
358 auto startPars = fitAttempts.size() > 0ul ?
359 std::make_optional<Acts::BoundTrackParameters>(fitAttempts.getTrack(fitAttempts.size() - 1ul).createParametersAtReference())
360 : std::nullopt;
361 std::unique_ptr<ActsTrk::MutableTrackContainer> fitTraject{};
362 switch (nStation) {
363 case 2ul:
364 fitTraject = fitBestCombination<2>(tgContext, mfContext, calContext, seed, startPars, auxMeasContainer);
365 break;
366 case 3ul:
367 fitTraject = fitBestCombination<3>(tgContext, mfContext, calContext, seed, startPars, auxMeasContainer);
368 break;
369 case 4ul:
370 fitTraject = fitBestCombination<4>(tgContext, mfContext, calContext, seed, startPars, auxMeasContainer);
371 break;
372 case 5ul:
373 fitTraject = fitBestCombination<5>(tgContext, mfContext, calContext, seed, startPars, auxMeasContainer);
374 break;
375 case 6ul:
376 fitTraject = fitBestCombination<6>(tgContext, mfContext, calContext, seed, startPars, auxMeasContainer);
377 break;
378 default:
379 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - A seven station track is extraordinary\n"<<seed);
380 }
381 if (!copyFit(std::move(fitTraject), nStation)) {
382 break;
383 }
384 if (m_visualizationTool.isEnabled()) {
385 m_visualizationTool->displayTrackSeedObj(ctx, seed,
386 fitAttempts.getTrack(fitAttempts.size() - 1ul).createParametersAtReference(),
387 std::format("IntermediateGooFit_{:}", nStation));
388 }
389 }
390 }
391
393 if (fitAttempts.size() == 0ul) {
394 return false;
395 }
396 ActsTrk::MutableTrackContainer::TrackProxy track = fitAttempts.getTrack(fitAttempts.size() - 1);
397 // Check the hit counts on track post fit and if we only have one station on track discard track
398 // Eventually we should implement some recovery mechanism for track where we loose too many stations
399 const std::uint32_t nStations = m_summaryTool->countMuonStations(ctx, track);
400 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Track has " << nStations << " precision layers.\n"
401 <<m_summaryTool->makeSummary(ctx, track));
402 if(nStations<2ul) {
403 ATH_MSG_DEBUG("rejecting single station track");
404 return false;
405 }
406 if (!expressAtCaloExit(ctx, track)) {
407 return false;
408 }
409
414 {
415 fitAttempts.addColumn<std::vector<const xAOD::MuonSegment*>>("muonSegLinks");
416 auto& toAppend = track.component<std::vector<const xAOD::MuonSegment*>>("muonSegLinks");
417 toAppend.insert_range(toAppend.end(), seed.segments());
418 }
419 outContainer.ensureDynamicColumns(fitAttempts);
420 auto destProxy = outContainer.getTrack(outContainer.addTrack());
421 destProxy.copyFrom(track);
422 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Good track fit...");
423 if (m_visualizationTool.isEnabled()) {
424 m_visualizationTool->displayTrackSeedObj(ctx, seed,
425 destProxy.createParametersAtReference(), "GoodFit");
426 }
427 return true;
428 }
429 bool MsTrackFindingAlg::expressAtCaloExit(const EventContext& ctx,
430 ActsTrk::MutableTrackContainer::TrackProxy track) const {
432 return true;
433 }
434 const Acts::BoundTrackParameters startPars = track.createParametersAtReference();
435 const Acts::TrackingVolume* msEntrance = m_trackingGeometrySvc->getEnvelope(ActsTrk::SystemEnvelope::CaloExit);
436 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
437 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Extrapolate "<<startPars<<", "
438 <<startPars.referenceSurface().toString(tgContext)<<" to MS entrance: "<<msEntrance->volumeBounds());
439
440 auto parsAtEntrance = m_extrapolationTool->propagate(ctx, startPars, *msEntrance,
442 Acts::Direction::Backward());
443
444 if (!parsAtEntrance.ok()) {
445 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - Failed to extrapolate "<<startPars<<" to MS entrance");
447 }
448 if (parsAtEntrance->referenceSurface().geometryId().withBoundary(0) != msEntrance->geometryId()) {
449 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - Parameter extrapolation to "<<(*parsAtEntrance)<<", @"
450 << Amg::toString(parsAtEntrance->referenceSurface().localToGlobalTransform(tgContext))
451 <<" did not end up at "<<msEntrance->geometryId()<<".");
453 }
454 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Extrapolated start parameters to "<<(*parsAtEntrance)
455 <<", "<<parsAtEntrance->referenceSurface().toString(tgContext));
456 track.setReferenceSurface(parsAtEntrance->referenceSurface().getSharedPtr());
457 track.parameters() = parsAtEntrance->parameters();
458 track.covariance() = (*parsAtEntrance->covariance());
459 return true;
460 }
461
462}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define AmgSymMatrix(dim)
ATLAS-specific HepMC functions.
xAOD::AuxiliaryMeasurement * newMeasurement(const SurfacePtr_t &surface, const ProjectorType projector, const AmgSymMatrix(N)&locCov, const AmgVector(N) locPos=AmgVector(N)::Zero())
Create a new auxiliary measurement.
@ e1DimRotNoTime
Project out solely the locX (Applies to Itk strips, Rpc, Tgc, sTgc, Mm).
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Service handle to the tracking geometry service.
bool expressAtCaloExit(const EventContext &ctx, ActsTrk::MutableTrackContainer::TrackProxy track) const
Extrapolate the tracks back to the calo exit and update the track parameters accoringly.
MeasVec_t collectMeasurements(const Acts::GeometryContext &tgContext, const Acts::BoundTrackParameters &startPars, const MsTrackSeed &seed, PseudoMeasHandle_t &auxMeasContainer) const
Collect all measurements from the segments associated with the seed If there are less than 2 phi meas...
ToolHandle< ITrackSeedingTool > m_seedingTool
The track seeding tool to construct the seed candidates and to estimate the initial parameters.
std::vector< const xAOD::UncalibratedMeasurement * > MeasVec_t
Abrivation for a vector of measurements.
std::unique_ptr< ActsTrk::MutableTrackContainer > fitBestCombination(const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const MsTrackSeed &seed, std::optional< Acts::BoundTrackParameters > startPars, PseudoMeasHandle_t &auxMeasContainer) const
ActsTrk::AuxiliaryMeasurementHandler m_pseudoMeasuremntCreator
Utility to impose external constraints in the fit.
SG::WriteHandleKey< ActsTrk::TrackContainer > m_writeKey
Key to the output track container.
SG::WriteHandleKey< MsTrackSeedContainer > m_msTrkSeedKey
Temporary container write handle to push the seeds to store gate for later efficiency analysis.
virtual StatusCode execute(const EventContext &ctx) const override final
Standard algorithm execution hook.
bool fitSeedCandidate(const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const MsTrackSeed &seed, ActsTrk::MutableTrackContainer &outContainer, PseudoMeasHandle_t &auxMeasContainer) const
Attempts to fit the track seed candidate to a full track and returns whether the fit succeeded.
ToolHandle< ISpacePointCalibrator > m_calibTool
Calibration tool to fill the track states.
ToolHandle< MuonValR4::ITrackVisualizationTool > m_visualizationTool
Visualization tool to debug the track finding.
const MuonGMR4::MuonDetectorManager * m_detMgr
Pointer to the MuonDetectorManager.
ToolHandle< ActsTrk::IFitterTool > m_trackFitTool
Track fitting tool.
virtual StatusCode initialize() override final
Standard algorithm hook to setup the extrapolator, retrieve the tools and declare algorithm's data de...
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
Gaudi::Property< bool > m_expressAtMsEntrance
Propagate the track at the MS entry and express its parameters.
ActsTrk::ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
Gaudi::Property< bool > m_ignoreFailedMsEntrance
Ignore failed track extrapolations to the entrance.
ActsTrk::AuxiliaryMeasurementHandler::MeasurementProvider PseudoMeasHandle_t
Auxiliary object to create the pseudo measurements.
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool
Handle to the muon summary tool.
bool hasOverlap() const
Returns whether the seed has been marked for overlap.
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
std::span< const xAOD::MuonSegment *const > segments() const
Returns the vector of associated segments.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
virtual unsigned int numDimensions() const =0
Returns the number of dimensions of the measurement.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Amg::Isometry3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Isometry3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
const Acts::Surface * bottomBoundary(const Acts::TrackingVolume &volume)
Returns the boundary surface parallel to the x-y plane at negative local z.
const Acts::TrackingVolume * highestAlignable(const Acts::TrackingVolume *volume)
Returns the highest parent volume that is alignable.
constexpr std::size_t N
This header ties the generic definitions in this package.
const xAOD::UncalibratedMeasurement * getMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns the n-th uncalibrated measurement.
std::size_t nMeasurements(const xAOD::MuonSegment &segment)
Returns the number of associated Uncalibrated measurements.
Acts::GeometryIdentifier volumeId(const Acts::Surface &surface)
Returns the identifier of the volume in which the surface is embedded.
bool isOutlierMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns whether the n-the uncalibrated measurement is an outlier.
StIndex
enum to classify the different station layers in the muon spectrometer
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
Definition dot.py:1
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
MuonMeasurement_v1 MuonMeasurement
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
bool isMuon(const xAOD::UncalibratedMeasurement *meas)
Returns whether the measurement is from a muon detector.