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.
106 {
107 if (debug_) {
108 std::cout << "[TrackExtrapolatorTool] extrapolate START\n";
109 std::cout << "[TrackExtrapolatorTool] track.nTrackStates() = "
110 << track.nTrackStates() << std::endl;
111 std::cout << "[TrackExtrapolatorTool] target_surface = "
112 << target_surface.get() << std::endl;
113 }
114
115
116 if (debug_)
117 std::cout
118 << "[TrackExtrapolatorTool] Getting outermost track state...\n";
119 auto outermost = *(track.trackStatesReversed().begin());
120 if (debug_)
121 std::cout
122 << "[TrackExtrapolatorTool] Getting innermost track state...\n";
123 auto begin = track.trackStatesReversed().begin();
124 std::advance(begin, track.nTrackStates() - 1);
125 auto innermost = *begin;
126 if (debug_)
127 std::cout << "[TrackExtrapolatorTool] Got innermost and outermost "
128 "track states\n";
129
130
131
132
133 if (debug_)
134 std::cout << "[TrackExtrapolatorTool] Calculating distances...\n";
135 double first_dis = std::abs(
136 innermost.referenceSurface().transform(gctx_).translation()(0) -
137 target_surface->transform(gctx_).translation()(0));
138
139 double last_dis = std::abs(
140 outermost.referenceSurface().transform(gctx_).translation()(0) -
141 target_surface->transform(gctx_).translation()(0));
142 if (debug_)
143 std::cout << "[TrackExtrapolatorTool] first_dis = " << first_dis
144 << ", last_dis = " << last_dis << std::endl;
145
146
147
148 const auto& ts = first_dis < last_dis ? innermost : outermost;
149 if (debug_) std::cout << "[TrackExtrapolatorTool] Selected track state\n";
150
151
152
153 if (debug_)
154 std::cout << "[TrackExtrapolatorTool] Getting reference surface...\n";
155 const auto& surface = ts.referenceSurface();
156 if (debug_)
157 std::cout << "[TrackExtrapolatorTool] Checking hasSmoothed...\n";
158 bool has_smoothed = ts.hasSmoothed();
159 if (debug_)
160 std::cout << "[TrackExtrapolatorTool] has_smoothed = " << has_smoothed
161 << std::endl;
162
163
164 Acts::BoundVector params;
165 Acts::BoundMatrix cov;
166
167 if (has_smoothed) {
168 if (debug_)
169 std::cout << "[TrackExtrapolatorTool] Using smoothed parameters...\n";
170 params = ts.smoothed();
171 cov = ts.smoothedCovariance();
172 } else {
173 if (debug_)
174 std::cout << "[TrackExtrapolatorTool] Using filtered parameters...\n";
175 params = ts.filtered();
176 cov = ts.filteredCovariance();
177 }
178 if (debug_)
179 std::cout << "[TrackExtrapolatorTool] Got all track state components\n";
180
181 if (debug_) {
182 std::cout << "Surface::" << surface.transform(gctx_).translation()
183 << std::endl;
184 std::cout << "HasSmoothed::" << has_smoothed << std::endl;
185 std::cout << "Parameters::" << params.transpose() << std::endl;
186 }
187
188 if (debug_)
189 std::cout
190 << "[TrackExtrapolatorTool] Creating BoundTrackParameters...\n";
191 auto part_hypo{Acts::SinglyChargedParticleHypothesis::electron()};
192 Acts::BoundTrackParameters sp(surface.getSharedPtr(), params, cov,
193 part_hypo);
194 if (debug_)
195 std::cout << "[TrackExtrapolatorTool] BoundTrackParameters created, "
196 "calling extrapolate(BTP)...\n";
197 auto result = extrapolate(sp, target_surface);
198 if (debug_) std::cout << "[TrackExtrapolatorTool] extrapolate DONE\n";
199 return result;
200 }