12 declareInterface<Muon::IMuonTrackExtrapolationTool>(
this);
28 return StatusCode::SUCCESS;
35 <<
" listing failures");
40 return StatusCode::SUCCESS;
44 std::unique_ptr<TrackCollection> extrapolateTracks = std::make_unique<TrackCollection>();
51 std::unique_ptr<Trk::Track> extrapolateTrack =
extrapolate(*trk, ctx);
52 if (!extrapolateTrack) {
59 extrapolateTracks->
push_back(std::move(extrapolateTrack));
61 return extrapolateTracks;
93 ATH_MSG_DEBUG(
" scalar product " << dirPosProduct <<
" extrapolating "
94 <<
" along momentum");
96 ATH_MSG_DEBUG(
" scalar product " << dirPosProduct <<
" extrapolating "
97 <<
" opposite momentum");
102 std::unique_ptr<const Trk::TrackParameters> ipPars{
m_extrapolator->extrapolate(ctx, *closestPars, perigeeSurface, propDir,
false)};
110 <<
" along momentum");
113 <<
" opposite momentum");
117 if (closestPars->
momentum().mag() > 5000.)
127 std::unique_ptr<const Trk::Perigee> ipPerigee_unique;
133 ipPerigee = ipPerigee_unique.get();
137 ATH_MSG_WARNING(
"Failed to create perigee for extrapolate track, skipping ");
144 auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
145 unsigned int newSize = oldTSOT->
size() + 1;
146 trackStateOnSurfaces->reserve(newSize);
158 double distanceOfPerigeeToCurrent = perDir.dot(
pars->position() - ipPerigee->position());
160 if (distanceOfPerigeeToCurrent > 0.) {
161 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
163 trackStateOnSurfaces->push_back(
169 trackStateOnSurfaces->push_back(tsit->clone());
173 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
175 trackStateOnSurfaces->push_back(
new Trk::TrackStateOnSurface(
nullptr, ipPerigee->uniqueClone(),
nullptr, typePattern));
182 std::unique_ptr<Trk::Track> extrapolateTrack =
183 std::make_unique<Trk::Track>(
info, std::move(trackStateOnSurfaces),
track.fitQuality() ?
track.fitQuality()->uniqueClone() :
nullptr);
186 return extrapolateTrack;
192 if (!
states)
return nullptr;
195 double rmin{1e9}, rminMeas{1e9};
202 double rpars =
pars->position().perp();
203 if (!closestPars || rpars < rmin) {
208 if (
pars->covariance() && (!closestParsMeas || rpars < rminMeas)) {
210 closestParsMeas =
pars;
214 if (closestParsMeas) {
215 return closestParsMeas;
217 ATH_MSG_DEBUG(
" No measured closest parameters found, using none measured parameters");
223 const EventContext& ctx)
const {
224 std::unique_ptr<const Trk::Perigee> perigee;
230 ATH_MSG_WARNING(
" Extrapolation to Perigee surface did not return a perigee!! ");