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.
103 {
104 if (debug_) {
105 std::cout << "[TrackExtrapolatorTool] extrapolate START\n";
106 std::cout << "[TrackExtrapolatorTool] track.nTrackStates() = "
107 << track.nTrackStates() << std::endl;
108 std::cout << "[TrackExtrapolatorTool] target_surface = "
109 << target_surface.get() << std::endl;
110 }
111
112 if (track.nTrackStates() == 0) {
113 return std::nullopt;
114 }
115
116
117
118
119 auto state_result = Acts::findTrackStateForExtrapolation(
120 gctx_, track, *target_surface,
121 Acts::TrackExtrapolationStrategy::firstOrLast);
122
123 if (!state_result.ok()) {
124 return std::nullopt;
125 }
126
127 const auto& ts = state_result->first;
128 const auto& surface = ts.referenceSurface();
129
130 Acts::BoundVector params;
131 Acts::BoundMatrix cov;
132
133 if (ts.hasSmoothed()) {
134 if (debug_)
135 std::cout << "[TrackExtrapolatorTool] Using smoothed parameters\n";
136 params = ts.smoothed();
137 cov = ts.smoothedCovariance();
138 } else if (ts.hasFiltered()) {
139 if (debug_)
140 std::cout << "[TrackExtrapolatorTool] Using filtered parameters\n";
141 params = ts.filtered();
142 cov = ts.filteredCovariance();
143 } else {
144 return std::nullopt;
145 }
146
147 if (debug_) {
148 std::cout << "Surface::"
149 << surface.localToGlobalTransform(gctx_).translation()
150 << std::endl;
151 std::cout << "HasSmoothed::" << ts.hasSmoothed() << std::endl;
152 std::cout << "Parameters::" << params.transpose() << std::endl;
153 }
154
155 auto part_hypo{Acts::ParticleHypothesis::electron()};
156 Acts::BoundTrackParameters sp(surface.getSharedPtr(), params, cov,
157 part_hypo);
158 if (debug_)
159 std::cout << "[TrackExtrapolatorTool] calling extrapolate(BTP)...\n";
160 auto result = extrapolate(sp, target_surface);
161 if (debug_) std::cout << "[TrackExtrapolatorTool] extrapolate DONE\n";
162 return result;
163 }