19 std::unique_ptr<Trk::Track>
track{};
20 unsigned int container_index{0};
21 bool extp_succeed{
false};
22 track_link(std::unique_ptr<Trk::Track> _trk,
unsigned int _idx,
bool _succeed) :
23 track{std::move(_trk)}, container_index{_idx}, extp_succeed{_succeed} {}
31 declareInterface<IMuonCandidateTool>(
this);
45 return StatusCode::SUCCESS;
50 unsigned int ntracks = 0;
53 if (!beamSpotHandle.isValid()) {
58 ATH_MSG_DEBUG(
"Beamspot position bs_x=" << beamSpotHandle->beamPos());
60 std::vector<track_link> trackLinks;
62 unsigned int index = -1;
64 for (
const auto*
track : tracks) {
67 if (!
track->trackLink().isValid() || !
track->track()) {
76 std::unique_ptr<Trk::Track> standaloneTrack;
78 standaloneTrack =
m_trackBuilder->standaloneFit(ctx, msTrack, beamSpotHandle->beamPos(),
nullptr);
82 if (standaloneTrack) {
85 standaloneTrack.reset();
93 standaloneTrack.reset();
94 ATH_MSG_DEBUG(
"extrapolated track has a degraded fit, don't use it");
98 if (standaloneTrack) {
102 <<
m_printer->print(*standaloneTrack) << std::endl
103 <<
m_printer->printStations(*standaloneTrack));
108 ATH_MSG_WARNING(
" Track with perigee without covariance " << (*standaloneTrack));
109 trackLinks.emplace_back(std::move(standaloneTrack),
index,
true);
114 bool skipTrack =
true;
116 std::unique_ptr<Trk::TrackSummary> msTrackSummary;
130 if (!skipTrack) { trackLinks.emplace_back(std::make_unique<Trk::Track>(msTrack),
index,
false); }
134 std::unique_ptr<TrackCollection> extrapTracks = std::make_unique<TrackCollection>(
SG::VIEW_ELEMENTS);
135 extrapTracks->
reserve(trackLinks.size());
136 for (
const track_link& link : trackLinks) extrapTracks->
push_back(link.track.get());
137 ATH_MSG_DEBUG(
"Finished back-tracking, total number of successfull fits " << ntracks);
140 std::unique_ptr<const TrackCollection> resolvedTracks(
m_ambiguityProcessor->process(extrapTracks.get()));
142 ATH_MSG_DEBUG(
"Finished ambiguity solving: " << extrapTracks->
size() <<
" track(s) in -> " << resolvedTracks->
size()
148 if (!readHandle.isValid()) {
151 segments = readHandle.cptr();
157 std::find_if(trackLinks.begin(), trackLinks.end(), [&
track](
const track_link& link) { return link.track.get() == track; });
159 if (tLink == trackLinks.end()) {
160 ATH_MSG_WARNING(
"Unable to find internal link between MS and SA tracks!");
164 std::unique_ptr<MuonCandidate> muon_candidate;
166 if (tLink->extp_succeed) {
167 outputTracks.
push_back(std::move(tLink->track));
169 muon_candidate = std::make_unique<MuonCandidate>(MS_TrkLink, saLink, outputTracks.
size() - 1);
173 muon_candidate = std::make_unique<MuonCandidate>(MS_TrkLink);
178 std::vector<const Muon::MuonSegment*> assoc_segs;
180 muon_candidate->setSegments(std::move(assoc_segs));