90 std::vector< const Trk::Surface*> trkSurfaceTriplet;
94 ATH_MSG_INFO(
"Creating Trk::Surface at: R " << radius <<
" Z " << halfZ);
98 std::vector<std::shared_ptr<const Acts::Surface>> actsSurfaceTriplet;
100 Acts::Transform3 posTransf(Acts::Transform3::Identity()*Acts::Translation3(Acts::Vector3(0.,0., halfZ)));
101 Acts::Transform3 cTransf(Acts::Transform3::Identity()*Acts::Translation3(Acts::Vector3(0.,0., 0.)));
102 Acts::Transform3 negTransf(Acts::Transform3::Identity()*Acts::Translation3(Acts::Vector3(0.,0.,-halfZ)));
104 auto posSurface = Acts::Surface::makeShared<Acts::DiscSurface> (posTransf , 0.,radius);
105 auto cSurface = Acts::Surface::makeShared<Acts::CylinderSurface>( cTransf ,radius, halfZ);
106 auto negSurface = Acts::Surface::makeShared<Acts::DiscSurface> (negTransf , 0.,radius);
108 actsSurfaceTriplet.push_back(posSurface);
109 actsSurfaceTriplet.push_back(cSurface );
110 actsSurfaceTriplet.push_back(negSurface);
111 ATH_MSG_INFO(
"Creating Acts::Surface at: R " << radius <<
" Z " << halfZ);
118 ATH_MSG_WARNING(
"Not compatible size of ReferenceSurfaceRadius and ReferenceSurfaceHalfZ!! Returning FAILURE!");
119 return StatusCode::FAILURE;
127 return StatusCode::SUCCESS;
142 float milliseconds_to_seconds = 1000.;
147 std::vector<perigeeParameters> parameters = {};
150 double d0 = CLHEP::RandGauss::shoot(engine) *
m_sigmaD0;
151 double z0 = CLHEP::RandGauss::shoot(engine) *
m_sigmaZ0;
155 double charge = (CLHEP::RandFlat::shoot(engine) > 0.5 ) ? -1. : 1.;
160 auto start = xclock::now();
161 for (
auto& perigee : parameters) {
163 Acts::Vector3 momentum(perigee.m_pt * std::cos(perigee.m_phi), perigee.m_pt * std::sin(perigee.m_phi), perigee.m_pt * std::sinh(perigee.m_eta));
164 double theta = Acts::VectorHelpers::theta(momentum);
165 double qOverP = perigee.m_charge / momentum.norm();
168 auto atlPerigee = std::make_unique<Trk::Perigee>(perigee.m_d0, perigee.m_z0, perigee.m_phi,
theta,
qOverP, atlPerigeeSurface);
177 int refSurface =
theta < posRef ? 2 : 1;
178 refSurface =
theta > negRef ? 0 : 1;
182 ATH_MSG_VERBOSE(
"Starting extrapolation " << n_extraps <<
" from : " << *atlPerigee <<
" to : " << *destinationSurface);
184 auto start_fwd = xclock::now();
185 auto destParameters =
193 auto end_fwd = xclock::now();
194 float ms_fwd = std::chrono::duration_cast<std::chrono::milliseconds>(end_fwd-start_fwd).count();
196 if (destParameters) {
198 ATH_MSG_VERBOSE(
" [ intersection ] with surface at (x,y,z) = " << destParameters->position().x() <<
", " << destParameters->position().y() <<
", " << destParameters->position().z() );
199 ATH_MSG_VERBOSE(
" [ intersection ] parameters: " << destParameters->parameters() );
200 ATH_MSG_VERBOSE(
" [ intersection ] cov matrix: " << destParameters->covariance() );
203 auto start_bkw = xclock::now();
208 atlPerigee->associatedSurface(),
212 auto end_bkw = xclock::now();
213 float ms_bkw = std::chrono::duration_cast<std::chrono::milliseconds>(end_bkw-start_bkw).count();
217 ATH_MSG_VERBOSE(
" [extrapolation to perigee] input: " << atlPerigee->parameters() );
218 ATH_MSG_VERBOSE(
" [extrapolation to perigee] output: " << finalperigee->parameters() );
219 ATH_MSG_VERBOSE(
" [extrapolation to perigee] cov matrix: " << finalperigee->covariance() );
221 }
else if (!finalperigee) {
222 ATH_MSG_DEBUG(
" ATLAS Extrapolation to perigee failed for input parameters: " << destParameters->parameters());
226 }
else if (!destParameters) {
232 auto end = xclock::now();
233 auto secs = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() / milliseconds_to_seconds;
234 double secs_per_ex = secs / n_extraps;
236 ATH_MSG_INFO(
"ATLAS : Time for " << n_extraps <<
" iterations: " << secs <<
"s (" << secs_per_ex <<
"s per extrapolation)");
239 start = xclock::now();
240 for (
auto& perigee : parameters) {
241 Acts::Vector3 momentum(perigee.m_pt * std::cos(perigee.m_phi), perigee.m_pt * std::sin(perigee.m_phi), perigee.m_pt * std::sinh(perigee.m_eta));
242 double theta = Acts::VectorHelpers::theta(momentum);
243 double qOverP = perigee.m_charge / momentum.norm();
245 std::shared_ptr<Acts::PerigeeSurface> actsPerigeeSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0, 0, 0));
247 Acts::BoundVector pars;
249 pars << perigee.m_d0, perigee.m_z0, perigee.m_phi,
theta,
qOverP, t;
250 std::optional<Acts::BoundSquareMatrix> cov = std::nullopt;
255 const auto* startParameters =
new const Acts::GenericBoundTrackParameters(std::move(actsPerigeeSurface), pars, std::move(cov), Acts::ParticleHypothesis::pion());
264 int refSurface =
theta < posRef ? 2 : 1;
265 refSurface =
theta > negRef ? 0 : 1;
269 ATH_MSG_VERBOSE(
"Starting extrapolation " << n_extraps <<
" from : " << pars <<
" to : " << destinationSurface);
271 auto start_fwd = xclock::now();
272 auto destParameters =
m_extrapolationTool->propagate(ctx, *startParameters, *destinationSurface, Acts::Direction::Forward());
273 auto end_fwd = xclock::now();
274 float ms_fwd = std::chrono::duration_cast<std::chrono::milliseconds>(end_fwd-start_fwd).count();
276 if (destParameters) {
278 ATH_MSG_VERBOSE(
" [ intersection ] with surface at (x,y,z) = " << destParameters->position(anygctx).x() <<
", " << destParameters->position(anygctx).y() <<
", " << destParameters->position(anygctx).z() );
279 ATH_MSG_VERBOSE(
" [ intersection ] parameters: " << destParameters->parameters() );
280 ATH_MSG_VERBOSE(
" [ intersection ] cov matrix: " << *destParameters->covariance() );
283 auto start_bkw = xclock::now();
284 auto finalperigee =
m_extrapolationTool->propagate(ctx, *destParameters, startParameters->referenceSurface(), Acts::Direction::Backward());
285 auto end_bkw = xclock::now();
286 float ms_bkw = std::chrono::duration_cast<std::chrono::milliseconds>(end_bkw-start_bkw).count();
290 ATH_MSG_VERBOSE(
" [extrapolation to perigee] input: " << startParameters->parameters() );
291 ATH_MSG_VERBOSE(
" [extrapolation to perigee] output: " << finalperigee->parameters() );
292 ATH_MSG_VERBOSE(
" [extrapolation to perigee] cov matrix: " << *finalperigee->covariance() );
294 }
else if (!finalperigee) {
295 ATH_MSG_DEBUG(
" ACTS Extrapolation to perigee failed for input parameters: " << destParameters->parameters());
299 auto startWrapper = std::make_unique<ActsTrackWrapper>(startParameters, anygctx);
300 auto destWrapper = std::make_unique<ActsTrackWrapper>(&destParameters.value(), anygctx);
301 auto finalWrapper = std::make_unique<ActsTrackWrapper>(&finalperigee.value(), anygctx);
305 }
else if (!destParameters) {
307 auto startWrapper = std::make_unique<ActsTrackWrapper>(startParameters, anygctx);
311 delete startParameters;
315 secs = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() / milliseconds_to_seconds;
316 secs_per_ex = secs / n_extraps;
318 ATH_MSG_INFO(
"ACTS : Time for " << n_extraps <<
" iterations: " << secs <<
"s (" << secs_per_ex <<
"s per extrapolation)");
320 return StatusCode::SUCCESS;