Method to extrapolate to a target surface given a track The method computes which track state is closest to the surface to choose which one to use to extrapolate.
This method doesn't use a measurement, but whatever first/last track state is defined.
99 {
100 if (debug_) {
101 std::cout << "[TrackExtrapolatorTool] extrapolate START\n";
102 std::cout << "[TrackExtrapolatorTool] track.nTrackStates() = "
103 << track.nTrackStates() << std::endl;
104 std::cout << "[TrackExtrapolatorTool] target_surface = "
105 << target_surface.get() << std::endl;
106 }
107
108 if (track.nTrackStates() == 0) {
109 return std::nullopt;
110 }
111
112
113
114
115 auto state_result = Acts::findTrackStateForExtrapolation(
116 gctx_, track, *target_surface,
117 Acts::TrackExtrapolationStrategy::firstOrLast);
118
119 if (!state_result.ok()) {
120 return std::nullopt;
121 }
122
123 const auto& ts = state_result->first;
124 const auto& surface = ts.referenceSurface();
125
126 Acts::BoundVector params;
127 Acts::BoundMatrix cov;
128
129 if (ts.hasSmoothed()) {
130 if (debug_)
131 std::cout << "[TrackExtrapolatorTool] Using smoothed parameters\n";
132 params = ts.smoothed();
133 cov = ts.smoothedCovariance();
134 } else if (ts.hasFiltered()) {
135 if (debug_)
136 std::cout << "[TrackExtrapolatorTool] Using filtered parameters\n";
137 params = ts.filtered();
138 cov = ts.filteredCovariance();
139 } else {
140 return std::nullopt;
141 }
142
143 if (debug_) {
144 std::cout << "Surface::"
145 << surface.localToGlobalTransform(gctx_).translation()
146 << std::endl;
147 std::cout << "HasSmoothed::" << ts.hasSmoothed() << std::endl;
148 std::cout << "Parameters::" << params.transpose() << std::endl;
149 }
150
151 auto part_hypo{Acts::ParticleHypothesis::electron()};
152 Acts::BoundTrackParameters sp(surface.getSharedPtr(), params, cov,
153 part_hypo);
154 if (debug_)
155 std::cout << "[TrackExtrapolatorTool] calling extrapolate(BTP)...\n";
156 auto result = extrapolate(sp, target_surface);
157 if (debug_) std::cout << "[TrackExtrapolatorTool] extrapolate DONE\n";
158 return result;
159 }