@@ -24,7 +24,6 @@ CompositeSpacePointLineSeeder::TwoCircleTangentPars
2424CompositeSpacePointLineSeeder::constructTangentLine (const Sp_t& topHit,
2525 const Sp_t& bottomHit,
2626 const TangentAmbi ambi) {
27- using ResidualIdx = detail::CompSpacePointAuxiliaries::ResidualIdx;
2827 using namespace Acts ::UnitLiterals;
2928 using namespace Acts ::detail;
3029 TwoCircleTangentPars result{};
@@ -46,9 +45,9 @@ CompositeSpacePointLineSeeder::constructTangentLine(const Sp_t& topHit,
4645 const double dZ = D.dot (eZ);
4746
4847 const double thetaTubes = std::atan2 (dY, dZ);
49- const double distTubes = Acts:: fastHypot (dY, dZ);
48+ const double distTubes = fastHypot (dY, dZ);
5049 assert (distTubes > 1 ._mm );
51- constexpr auto covIdx = Acts:: toUnderlying (ResidualIdx ::bending);
50+ constexpr auto covIdx = toUnderlying (CovIdx ::bending);
5251 const double combDriftUncert{topHit.covariance ()[covIdx] +
5352 bottomHit.covariance ()[covIdx]};
5453 const double R =
@@ -170,8 +169,8 @@ void CompositeSpacePointLineSeeder::SeedingState<
170169 << toString (encodeAmbiguity (s_signCombo[m_signComboIndex][0 ],
171170 s_signCombo[m_signComboIndex][1 ]))
172171 << " \n " ;
173- ostr << " start with pattern " << startWithPattern << " nGenSeeds "
174- << nGenSeeds () << " nStrawCut " << m_nStrawCut << " \n " ;
172+ ostr << " Number of seeds " << nGenSeeds () << " nStrawCut " << m_nStrawCut
173+ << " \n " ;
175174 if (nGenSeeds () > 0ul ) {
176175 for (const auto & seen : m_seenSolutions) {
177176 ostr << " ################################################" << std::endl;
@@ -288,17 +287,18 @@ CompositeSpacePointLineSeeder::nextSeed(
288287 state.m_nStrawCut = m_cfg.nStrawHitCut ;
289288 // / Check whether the seeding can start with the external pattern
290289 // / parameters
291- if (state.startWithPattern &&
292- std::ranges::any_of (strawLayers, [&](const UncalibCont_t& layerHits) {
293- return countHits (layerHits, selector) > m_cfg.busyLayerLimit ;
294- })) {
295- state.startWithPattern = false ;
290+ if (!state.m_patternSeedProduced &&
291+ (!m_cfg.startWithPattern ||
292+ std::ranges::any_of (strawLayers, [&](const UncalibCont_t& layerHits) {
293+ return countHits (layerHits, selector) > m_cfg.busyLayerLimit ;
294+ }))) {
295+ state.m_patternSeedProduced = true ;
296296 }
297- if (state.startWithPattern ) {
298- SegmentSeed<CalibCont_t> patternSeed{state.patternParams ,
297+ if (! state.m_patternSeedProduced ) {
298+ SegmentSeed<CalibCont_t> patternSeed{state.initialParameters () ,
299299 state.newContainer (cctx)};
300300
301- const auto [pos, dir] = makeLine (state.patternParams );
301+ const auto [pos, dir] = makeLine (state.initialParameters () );
302302 const double t0 = patternSeed.parameters [toUnderlying (ParIdx::t0)];
303303
304304 auto append = [&](const StrawLayers_t<UncalibCont_t>& hitLayers) {
@@ -310,7 +310,7 @@ CompositeSpacePointLineSeeder::nextSeed(
310310 };
311311 append (strawLayers);
312312 append (state.stripHits ());
313- state.startWithPattern = false ;
313+ state.m_patternSeedProduced = true ;
314314 return patternSeed;
315315 }
316316 ACTS_DEBUG (__func__ << " () " << __LINE__ << " - Instantiate layers. " );
@@ -450,10 +450,6 @@ CompositeSpacePointLineSeeder::buildSeed(
450450
451451 ACTS_DEBUG (__func__ << " () " << __LINE__ << " - Try to draw new seed from \n "
452452 << state << " ." );
453- if (state.strawRadius <= Acts::s_epsilon) {
454- throw std::invalid_argument (
455- " buildSeed() - Please configure the state's strawRadius" );
456- }
457453 const auto & upperHit =
458454 *strawLayers.at (state.m_upperLayer .value ()).at (state.m_upperHitIndex );
459455 const auto & lowerHit =
@@ -484,7 +480,7 @@ CompositeSpacePointLineSeeder::buildSeed(
484480 return std::nullopt ;
485481 }
486482 // / Continue to construct a new solution
487- const double t0 = state.patternParams [toUnderlying (ParIdx::t0)];
483+ const double t0 = state.initialParameters () [toUnderlying (ParIdx::t0)];
488484 SeedSolution<UncalibCont_t, Delegate_t> newSolution{seedPars, state};
489485
490486 ACTS_DEBUG (__func__ << " () " << __LINE__
@@ -493,6 +489,9 @@ CompositeSpacePointLineSeeder::buildSeed(
493489 const Line_t tangentSeed{seedPars.y0 * Vector3::UnitY (),
494490 makeDirection (lowerHit, seedPars.theta )};
495491 const auto & [seedPos, seedDir] = tangentSeed;
492+ const double maxPullSq{Acts::square (m_cfg.hitPullCut )};
493+ constexpr auto covIdx = Acts::toUnderlying (CovIdx::bending);
494+
496495 for (const auto & [layerNr, hitsInLayer] :
497496 Acts::enumerate (state.strawHits ())) {
498497 bool hadGoodHit{false };
@@ -504,17 +503,28 @@ CompositeSpacePointLineSeeder::buildSeed(
504503 // the hits are ordered in the layer so we assume that once we found good
505504 // hits we are moving away from the seed line so we can abort the hit
506505 // association
507- if (distance < state.strawRadius &&
508- state.candidatePull (cctx, seedPos, seedDir, t0, *testMe) <
509- Acts::pow (m_cfg.hitPullCut , 2u )) {
510- ACTS_VERBOSE (__func__ << " () " << __LINE__ << " - layer,hit = ("
511- << layerNr << " ," << hitNr
512- << " ) -> spacePoint: " << Acts::toString (*testMe)
513- << " is close enough: " << distance);
514- hadGoodHit = true ;
515- newSolution.append (layerNr, hitNr);
516- newSolution.nStrawHits += selector (*testMe);
517- continue ;
506+ const double rMax = state.strawRadius (*testMe);
507+ assert (rMax > Acts::s_epsilon);
508+ assert (testMe->covariance ()[covIdx] > Acts::s_epsilon);
509+ if (distance < rMax) {
510+ const double pullSq =
511+ m_cfg.useSimpleStrawPull
512+ ? Acts::square (distance - Acts::abs (testMe->driftRadius ())) /
513+ testMe->covariance ()[covIdx]
514+ : state.candidateChi2 (cctx, seedPos, seedDir, t0, *testMe);
515+
516+ if (pullSq < maxPullSq) {
517+ ACTS_VERBOSE (__func__
518+ << " () " << __LINE__ << " - layer,hit = (" << layerNr
519+ << " ," << hitNr
520+ << " ) -> spacePoint: " << Acts::toString (*testMe)
521+ << " is close enough: " << distance
522+ << " , pull: " << std::sqrt (pullSq));
523+ hadGoodHit = true ;
524+ newSolution.append (layerNr, hitNr);
525+ newSolution.nStrawHits += selector (*testMe);
526+ continue ;
527+ }
518528 }
519529 if (hadGoodHit) {
520530 break ;
@@ -539,7 +549,7 @@ CompositeSpacePointLineSeeder::consructSegmentSeed(
539549 ACTS_DEBUG (__func__ << " () " << __LINE__ << " Construct new seed from \n "
540550 << newSolution);
541551 SegmentSeed<CalibCont_t> finalSeed{
542- combineWithPattern (tangentSeed, state.patternParams ),
552+ combineWithPattern (tangentSeed, state.initialParameters () ),
543553 state.newContainer (cctx)};
544554 const auto [seedPos, seedDir] = makeLine (finalSeed.parameters );
545555 // / Append the collected straws to the seed
@@ -561,7 +571,7 @@ CompositeSpacePointLineSeeder::consructSegmentSeed(
561571 // / Find the hit with the lowest pull
562572 for (const auto & [hitIdx, testMe] : Acts::enumerate (stripLayerHits)) {
563573 const double chi2 =
564- state.candidatePull (cctx, seedPos, seedDir, t0, *testMe);
574+ state.candidateChi2 (cctx, seedPos, seedDir, t0, *testMe);
565575 if (testMe->measuresLoc0 () && chi2 < bestChi2Loc0) {
566576 bestChi2Loc0 = chi2;
567577 bestIdxLoc0 = hitIdx;
0 commit comments