From 791df71009f9af17c4288bbaad2259a88b83f9b7 Mon Sep 17 00:00:00 2001 From: Rob Mina Date: Fri, 16 Oct 2026 13:46:10 -0500 Subject: [PATCH 1/4] Use new KinKal reference piece strategy. --- Mu2eKinKal/fcl/prolog.fcl | 22 ++++++++++++++++++---- Mu2eKinKal/inc/KKCaloHit.hh | 5 +++-- Mu2eKinKal/inc/KKFitSettings.hh | 2 ++ Mu2eKinKal/inc/KKShellXing.hh | 4 ++-- Mu2eKinKal/inc/KKStrawHit.hh | 9 +++++---- Mu2eKinKal/inc/KKStrawHitCluster.hh | 2 +- Mu2eKinKal/inc/KKStrawXing.hh | 7 ++++--- Mu2eKinKal/src/KKFitSettings.cc | 18 ++++++++++++++++++ 8 files changed, 53 insertions(+), 16 deletions(-) diff --git a/Mu2eKinKal/fcl/prolog.fcl b/Mu2eKinKal/fcl/prolog.fcl index 65307a19bd..de0de63607 100644 --- a/Mu2eKinKal/fcl/prolog.fcl +++ b/Mu2eKinKal/fcl/prolog.fcl @@ -559,8 +559,15 @@ Mu2eKinKal : { SaveTrajectory : T0 SaveDomains : false } - FitSettings : @local::Mu2eKinKal.CHSEEDFIT - ExtensionSettings : @local::Mu2eKinKal.CHSEEDEXT + # straw hits keep the piece holding their hint time (TOCA); material crossings follow the closest approach (DOCA) + FitSettings : { + @table::Mu2eKinKal.CHSEEDFIT + HitReferencePiece : [ "TOCA", "TOCA", "TOCA", "TOCA" ] + } + ExtensionSettings : { + @table::Mu2eKinKal.CHSEEDEXT + HitReferencePiece : [ "TOCA", "TOCA", "TOCA", "TOCA" ] + } ModuleSettings : { @table::Mu2eKinKal.CENTRALHELIX @table::Mu2eKinKal.KKPrecursors @@ -574,8 +581,15 @@ Mu2eKinKal : { SaveTrajectory : Detector SaveDomains : true } - FitSettings : @local::Mu2eKinKal.CHSEEDFIT - ExtensionSettings : @local::Mu2eKinKal.CHDRIFTEXT + # straw hits keep the piece holding their hint time (TOCA); material crossings follow the closest approach (DOCA) + FitSettings : { + @table::Mu2eKinKal.CHSEEDFIT + HitReferencePiece : [ "TOCA", "TOCA", "TOCA", "TOCA" ] + } + ExtensionSettings : { + @table::Mu2eKinKal.CHDRIFTEXT + HitReferencePiece : [ "TOCA", "TOCA", "TOCA", "TOCA", "TOCA", "TOCA", "TOCA", "TOCA", "TOCA" ] + } ModuleSettings : { @table::Mu2eKinKal.CENTRALHELIX @table::Mu2eKinKal.KKPrecursors diff --git a/Mu2eKinKal/inc/KKCaloHit.hh b/Mu2eKinKal/inc/KKCaloHit.hh index 9dc2cb123d..5122cf0608 100644 --- a/Mu2eKinKal/inc/KKCaloHit.hh +++ b/Mu2eKinKal/inc/KKCaloHit.hh @@ -18,6 +18,7 @@ namespace mu2e { using KinKal::MetaIterConfig; using KinKal::Residual; using KinKal::CAHint; + using KinKal::RefPieceStrategy; using KinKal::ClosestApproachData; using CCPtr = art::Ptr; template class KKCaloHit : public KinKal::ResidualHit { @@ -48,7 +49,7 @@ namespace mu2e { unsigned nResid() const override { return 1; } // 1 time residual Residual const& refResidual(unsigned ires=0) const override; double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj) override; + void updateReference(PTRAJ const& ptraj, RefPieceStrategy) override; // the hint is the measurement time, so the strategy does not apply void updateState(MetaIterConfig const& config,bool first) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; @@ -84,7 +85,7 @@ namespace mu2e { return rresid_; } - template void KKCaloHit::updateReference(PTRAJ const& ptraj) { + template void KKCaloHit::updateReference(PTRAJ const& ptraj, RefPieceStrategy) { // compute PCA auto mtime = sensorAxis().measurementTime(); CAHint tphint(mtime,mtime); diff --git a/Mu2eKinKal/inc/KKFitSettings.hh b/Mu2eKinKal/inc/KKFitSettings.hh index 36a7d989ee..849234a5ab 100644 --- a/Mu2eKinKal/inc/KKFitSettings.hh +++ b/Mu2eKinKal/inc/KKFitSettings.hh @@ -41,6 +41,8 @@ namespace mu2e { // Updater settings using MetaIterationSettings = fhicl::Sequence>; MetaIterationSettings miConfig { Name("MetaIterationSettings"), Comment("Temperature (dimensionless), StrawHitUpdater algorithm") }; + fhicl::OptionalSequence hitRefPiece { Name("HitReferencePiece"), Comment("Per meta-iteration reference piece strategy for hits, DOCA or TOCA; one entry per MetaIterationSettings entry, absent = all DOCA") }; + fhicl::OptionalSequence xingRefPiece { Name("XingReferencePiece"), Comment("Per meta-iteration reference piece strategy for material crossings, DOCA or TOCA; one entry per MetaIterationSettings entry, absent = all DOCA") }; using CADSHUSettings = fhicl::OptionalSequence>; CADSHUSettings cadshuConfig{ Name("CADSHUSettings"), Comment(CADSHU::configDescription()) }; using DriftANNSHUSettings = fhicl::OptionalSequence>; diff --git a/Mu2eKinKal/inc/KKShellXing.hh b/Mu2eKinKal/inc/KKShellXing.hh index 135c88c9e1..2f92693b40 100644 --- a/Mu2eKinKal/inc/KKShellXing.hh +++ b/Mu2eKinKal/inc/KKShellXing.hh @@ -36,7 +36,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj) override; + void updateReference(PTRAJ const& ptraj, KinKal::RefPieceStrategy) override; // the intersection time sets the piece, so the strategy does not apply void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; double time() const override { return inter_.time_; } @@ -77,7 +77,7 @@ namespace mu2e { } } - template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj) { + template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj, KinKal::RefPieceStrategy) { auto const& neartrajptr = ptraj.nearestTraj(inter_.time_); if(neartrajptr != reftrajptr_){ // traj has changed; try intersecting with this piece diff --git a/Mu2eKinKal/inc/KKStrawHit.hh b/Mu2eKinKal/inc/KKStrawHit.hh index 4b8bc415a0..e7ab50b104 100644 --- a/Mu2eKinKal/inc/KKStrawHit.hh +++ b/Mu2eKinKal/inc/KKStrawHit.hh @@ -39,6 +39,7 @@ namespace mu2e { using KinKal::VEC3; using KinKal::DVEC; using KinKal::CAHint; + using KinKal::RefPieceStrategy; using RESIDCOL = std::array; // should be a struct FIXME template class KKStrawHit : public KinKal::ResidualHit { @@ -83,7 +84,7 @@ namespace mu2e { auto const& timeResidual() const { return resids_[Mu2eKinKal::tresid];} auto const& distResidual() const { return resids_[Mu2eKinKal::dresid];} double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj) override; + void updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; // re-override; even though this is implemented in the base class @@ -157,18 +158,18 @@ namespace mu2e { return CA(utraj,wirePtr(),ca.hint(),ca.precision()); } - template void KKStrawHit::updateReference(PTRAJ const& ptraj) { + template void KKStrawHit::updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) { // if we already computed PCA in the previous iteration, use that to set the hint. This speeds convergence // otherwise use the time at the center of the wire, corrected for drift auto mtime =wire().timeAtMidpoint(); CAHint tphint = ca_.usable() ? ca_.hint() : CAHint(mtime-chit_.driftTime(),mtime); - PCA pca(ptraj,wirePtr(),tphint,precision()); + PCA pca(ptraj,wirePtr(),tphint,precision(),strategy); // check that we're on the right branch: we can move off if t0 changes a lot between iterations double dz = straw().origin().z() - pca.particlePoca().Z(); double maxdz(100.0);// need a better absolute scale; should come from KTRAJ FIXME if((!pca.usable()) || fabs(dz) > maxdz) { tphint = CAHint(Mu2eKinKal::zTime(ptraj,straw().origin().z(),mtime-chit_.driftTime()),mtime); - pca = PCA(ptraj,wirePtr(),tphint,precision()); + pca = PCA(ptraj,wirePtr(),tphint,precision(),strategy); dz = straw().origin().z() - pca.particlePoca().Z(); if((!pca.usable()) || fabs(dz) > maxdz) whstate_.state_ = WireHitState::unusable;// give up on 2nd try } diff --git a/Mu2eKinKal/inc/KKStrawHitCluster.hh b/Mu2eKinKal/inc/KKStrawHitCluster.hh index 342c0bbe4c..b0b7bfa728 100644 --- a/Mu2eKinKal/inc/KKStrawHitCluster.hh +++ b/Mu2eKinKal/inc/KKStrawHitCluster.hh @@ -76,7 +76,7 @@ namespace mu2e { unsigned nDOF() const override { return 0; } KinKal::Weights const& weight() const override { return (*hits_.begin())->weight(); } double time() const override; - void updateReference(PTRAJ const& ptraj) override {} // nothing to do here, ref comes from individual hits + void updateReference(PTRAJ const& ptraj, KinKal::RefPieceStrategy) override {} // nothing to do here, ref comes from individual hits KTRAJPTR refTrajPtr() const override { return (*hits_.begin())->refTrajPtr(); } // update the internals of the hit, specific to this meta-iteraion. This will affect the next fit iteration void updateState(KinKal::MetaIterConfig const& config,bool first) override; diff --git a/Mu2eKinKal/inc/KKStrawXing.hh b/Mu2eKinKal/inc/KKStrawXing.hh index 1cc2136616..98e9eb09dc 100644 --- a/Mu2eKinKal/inc/KKStrawXing.hh +++ b/Mu2eKinKal/inc/KKStrawXing.hh @@ -17,6 +17,7 @@ namespace mu2e { using KinKal::SVEC3; using KinKal::DVEC; using KinKal::CAHint; + using KinKal::RefPieceStrategy; using KinKal::DPDV; using KinKal::MomBasis; using KinKal::NParams; @@ -67,7 +68,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj) override; + void updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) override; void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; std::vectorconst& matXings() const override { return mxings_; } @@ -131,14 +132,14 @@ namespace mu2e { return active_ || (shptr_ && shptr_->hitState().active()); } - template void KKStrawXing::updateReference(PTRAJ const& ptraj) { + template void KKStrawXing::updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) { CAHint tphint(strawAxis()->timeAtMidpoint(),strawAxis()->timeAtMidpoint()); if(ca_.usable()){ tphint = ca_.hint(); }else if(shptr_ && shptr_->closestApproach().usable()){ tphint = shptr_->closestApproach().hint(); } - PCA pca(ptraj,strawAxis(),tphint,precision()); + PCA pca(ptraj,strawAxis(),tphint,precision(),strategy); ca_ = static_cast(pca); } diff --git a/Mu2eKinKal/src/KKFitSettings.cc b/Mu2eKinKal/src/KKFitSettings.cc index a8d78bce14..733c56ebe8 100644 --- a/Mu2eKinKal/src/KKFitSettings.cc +++ b/Mu2eKinKal/src/KKFitSettings.cc @@ -43,10 +43,28 @@ namespace mu2e { chi2shusettings = fitconfig.combishuConfig().value_or(chi2shusettings); // straw material updater must always be here auto const& sxusettings = fitconfig.sxuConfig(); + // reference piece strategies, one per meta-iteration; absent keeps every meta-iteration on DOCA + auto refpieces = [&fitconfig](std::vector const& names, const char* key) { + std::vector retval(fitconfig.miConfig().size(),KinKal::RefPieceStrategy::DOCA); + if(names.empty()) return retval; + if(names.size() != retval.size()) + throw cet::exception("RECO")<<"mu2e::KKFitSettings: " << key << " has " << names.size() << " entries but MetaIterationSettings has " << retval.size() << std::endl; + for(size_t imeta=0; imeta < names.size(); ++imeta) { + if(names[imeta] != "DOCA" && names[imeta] != "TOCA") + throw cet::exception("RECO")<<"mu2e::KKFitSettings: unknown " << key << " value " << names[imeta] << ", must be DOCA or TOCA" << std::endl; + retval[imeta] = KinKal::refPieceStrategy(names[imeta]); + } + return retval; + }; + std::vector hitrefnames, xingrefnames; + auto hitrefs = refpieces(fitconfig.hitRefPiece().value_or(hitrefnames),"HitReferencePiece"); + auto xingrefs = refpieces(fitconfig.xingRefPiece().value_or(xingrefnames),"XingReferencePiece"); // set the schedule for the meta-iterations unsigned ncadshu(0), nann(0), nbkg(0), ncomb(0), nnone(0), nsxu(0), npdiag(0); for(auto const& misetting : fitconfig.miConfig()) { MetaIterConfig miconfig(std::get<0>(misetting)); + miconfig.setHitRefPiece(hitrefs.at(config.schedule_.size())); + miconfig.setXingRefPiece(xingrefs.at(config.schedule_.size())); // parse StrawHit updaters, and add to the config of this meta-iteraion std::vector anames; splitLine( std::get<1>(misetting), ":", anames); From ff96b111590c6824d223ccf6163a85625cd581c5 Mon Sep 17 00:00:00 2001 From: Rob Mina Date: Thu, 22 Oct 2026 06:43:13 -0500 Subject: [PATCH 2/4] Match new KinKal maxiter signature. --- Mu2eKinKal/inc/KKCaloHit.hh | 5 ++--- Mu2eKinKal/inc/KKShellXing.hh | 4 ++-- Mu2eKinKal/inc/KKStrawHit.hh | 9 ++++----- Mu2eKinKal/inc/KKStrawHitCluster.hh | 2 +- Mu2eKinKal/inc/KKStrawXing.hh | 7 +++---- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Mu2eKinKal/inc/KKCaloHit.hh b/Mu2eKinKal/inc/KKCaloHit.hh index 5122cf0608..697abc9385 100644 --- a/Mu2eKinKal/inc/KKCaloHit.hh +++ b/Mu2eKinKal/inc/KKCaloHit.hh @@ -18,7 +18,6 @@ namespace mu2e { using KinKal::MetaIterConfig; using KinKal::Residual; using KinKal::CAHint; - using KinKal::RefPieceStrategy; using KinKal::ClosestApproachData; using CCPtr = art::Ptr; template class KKCaloHit : public KinKal::ResidualHit { @@ -49,7 +48,7 @@ namespace mu2e { unsigned nResid() const override { return 1; } // 1 time residual Residual const& refResidual(unsigned ires=0) const override; double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj, RefPieceStrategy) override; // the hint is the measurement time, so the strategy does not apply + void updateReference(PTRAJ const& ptraj, unsigned) override; // the hint is the measurement time, so the piece-move limit does not apply void updateState(MetaIterConfig const& config,bool first) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; @@ -85,7 +84,7 @@ namespace mu2e { return rresid_; } - template void KKCaloHit::updateReference(PTRAJ const& ptraj, RefPieceStrategy) { + template void KKCaloHit::updateReference(PTRAJ const& ptraj, unsigned) { // compute PCA auto mtime = sensorAxis().measurementTime(); CAHint tphint(mtime,mtime); diff --git a/Mu2eKinKal/inc/KKShellXing.hh b/Mu2eKinKal/inc/KKShellXing.hh index 2f92693b40..31477cb430 100644 --- a/Mu2eKinKal/inc/KKShellXing.hh +++ b/Mu2eKinKal/inc/KKShellXing.hh @@ -36,7 +36,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj, KinKal::RefPieceStrategy) override; // the intersection time sets the piece, so the strategy does not apply + void updateReference(PTRAJ const& ptraj, unsigned) override; // the intersection time sets the piece, so the piece-move limit does not apply void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; double time() const override { return inter_.time_; } @@ -77,7 +77,7 @@ namespace mu2e { } } - template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj, KinKal::RefPieceStrategy) { + template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj, unsigned) { auto const& neartrajptr = ptraj.nearestTraj(inter_.time_); if(neartrajptr != reftrajptr_){ // traj has changed; try intersecting with this piece diff --git a/Mu2eKinKal/inc/KKStrawHit.hh b/Mu2eKinKal/inc/KKStrawHit.hh index e7ab50b104..9eff8e6ec7 100644 --- a/Mu2eKinKal/inc/KKStrawHit.hh +++ b/Mu2eKinKal/inc/KKStrawHit.hh @@ -39,7 +39,6 @@ namespace mu2e { using KinKal::VEC3; using KinKal::DVEC; using KinKal::CAHint; - using KinKal::RefPieceStrategy; using RESIDCOL = std::array; // should be a struct FIXME template class KKStrawHit : public KinKal::ResidualHit { @@ -84,7 +83,7 @@ namespace mu2e { auto const& timeResidual() const { return resids_[Mu2eKinKal::tresid];} auto const& distResidual() const { return resids_[Mu2eKinKal::dresid];} double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) override; + void updateReference(PTRAJ const& ptraj, unsigned maxiter) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; // re-override; even though this is implemented in the base class @@ -158,18 +157,18 @@ namespace mu2e { return CA(utraj,wirePtr(),ca.hint(),ca.precision()); } - template void KKStrawHit::updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) { + template void KKStrawHit::updateReference(PTRAJ const& ptraj, unsigned maxiter) { // if we already computed PCA in the previous iteration, use that to set the hint. This speeds convergence // otherwise use the time at the center of the wire, corrected for drift auto mtime =wire().timeAtMidpoint(); CAHint tphint = ca_.usable() ? ca_.hint() : CAHint(mtime-chit_.driftTime(),mtime); - PCA pca(ptraj,wirePtr(),tphint,precision(),strategy); + PCA pca(ptraj,wirePtr(),tphint,precision(),maxiter); // check that we're on the right branch: we can move off if t0 changes a lot between iterations double dz = straw().origin().z() - pca.particlePoca().Z(); double maxdz(100.0);// need a better absolute scale; should come from KTRAJ FIXME if((!pca.usable()) || fabs(dz) > maxdz) { tphint = CAHint(Mu2eKinKal::zTime(ptraj,straw().origin().z(),mtime-chit_.driftTime()),mtime); - pca = PCA(ptraj,wirePtr(),tphint,precision(),strategy); + pca = PCA(ptraj,wirePtr(),tphint,precision(),maxiter); dz = straw().origin().z() - pca.particlePoca().Z(); if((!pca.usable()) || fabs(dz) > maxdz) whstate_.state_ = WireHitState::unusable;// give up on 2nd try } diff --git a/Mu2eKinKal/inc/KKStrawHitCluster.hh b/Mu2eKinKal/inc/KKStrawHitCluster.hh index b0b7bfa728..cd5dee7863 100644 --- a/Mu2eKinKal/inc/KKStrawHitCluster.hh +++ b/Mu2eKinKal/inc/KKStrawHitCluster.hh @@ -76,7 +76,7 @@ namespace mu2e { unsigned nDOF() const override { return 0; } KinKal::Weights const& weight() const override { return (*hits_.begin())->weight(); } double time() const override; - void updateReference(PTRAJ const& ptraj, KinKal::RefPieceStrategy) override {} // nothing to do here, ref comes from individual hits + void updateReference(PTRAJ const& ptraj, unsigned) override {} // nothing to do here, ref comes from individual hits KTRAJPTR refTrajPtr() const override { return (*hits_.begin())->refTrajPtr(); } // update the internals of the hit, specific to this meta-iteraion. This will affect the next fit iteration void updateState(KinKal::MetaIterConfig const& config,bool first) override; diff --git a/Mu2eKinKal/inc/KKStrawXing.hh b/Mu2eKinKal/inc/KKStrawXing.hh index 98e9eb09dc..595835c73a 100644 --- a/Mu2eKinKal/inc/KKStrawXing.hh +++ b/Mu2eKinKal/inc/KKStrawXing.hh @@ -17,7 +17,6 @@ namespace mu2e { using KinKal::SVEC3; using KinKal::DVEC; using KinKal::CAHint; - using KinKal::RefPieceStrategy; using KinKal::DPDV; using KinKal::MomBasis; using KinKal::NParams; @@ -68,7 +67,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) override; + void updateReference(PTRAJ const& ptraj, unsigned maxiter) override; void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; std::vectorconst& matXings() const override { return mxings_; } @@ -132,14 +131,14 @@ namespace mu2e { return active_ || (shptr_ && shptr_->hitState().active()); } - template void KKStrawXing::updateReference(PTRAJ const& ptraj, RefPieceStrategy strategy) { + template void KKStrawXing::updateReference(PTRAJ const& ptraj, unsigned maxiter) { CAHint tphint(strawAxis()->timeAtMidpoint(),strawAxis()->timeAtMidpoint()); if(ca_.usable()){ tphint = ca_.hint(); }else if(shptr_ && shptr_->closestApproach().usable()){ tphint = shptr_->closestApproach().hint(); } - PCA pca(ptraj,strawAxis(),tphint,precision(),strategy); + PCA pca(ptraj,strawAxis(),tphint,precision(),maxiter); ca_ = static_cast(pca); } From 22bdf03aec1f1de21ba3ce0c5b81022939f804c3 Mon Sep 17 00:00:00 2001 From: Rob Mina Date: Thu, 22 Oct 2026 12:30:46 -0500 Subject: [PATCH 3/4] Match KinKal updateReference(PTRAJ, MetaIterConfig) signature --- Mu2eKinKal/inc/KKCaloHit.hh | 4 ++-- Mu2eKinKal/inc/KKShellXing.hh | 4 ++-- Mu2eKinKal/inc/KKStrawHit.hh | 5 +++-- Mu2eKinKal/inc/KKStrawHitCluster.hh | 2 +- Mu2eKinKal/inc/KKStrawXing.hh | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Mu2eKinKal/inc/KKCaloHit.hh b/Mu2eKinKal/inc/KKCaloHit.hh index 697abc9385..9d45fe2b4e 100644 --- a/Mu2eKinKal/inc/KKCaloHit.hh +++ b/Mu2eKinKal/inc/KKCaloHit.hh @@ -48,7 +48,7 @@ namespace mu2e { unsigned nResid() const override { return 1; } // 1 time residual Residual const& refResidual(unsigned ires=0) const override; double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj, unsigned) override; // the hint is the measurement time, so the piece-move limit does not apply + void updateReference(PTRAJ const& ptraj, MetaIterConfig const&) override; // the hint is the measurement time, so the piece-move limit does not apply void updateState(MetaIterConfig const& config,bool first) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; @@ -84,7 +84,7 @@ namespace mu2e { return rresid_; } - template void KKCaloHit::updateReference(PTRAJ const& ptraj, unsigned) { + template void KKCaloHit::updateReference(PTRAJ const& ptraj, MetaIterConfig const&) { // compute PCA auto mtime = sensorAxis().measurementTime(); CAHint tphint(mtime,mtime); diff --git a/Mu2eKinKal/inc/KKShellXing.hh b/Mu2eKinKal/inc/KKShellXing.hh index 31477cb430..c895bbe14f 100644 --- a/Mu2eKinKal/inc/KKShellXing.hh +++ b/Mu2eKinKal/inc/KKShellXing.hh @@ -36,7 +36,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj, unsigned) override; // the intersection time sets the piece, so the piece-move limit does not apply + void updateReference(PTRAJ const& ptraj, MetaIterConfig const&) override; // the intersection time sets the piece, so the piece-move limit does not apply void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; double time() const override { return inter_.time_; } @@ -77,7 +77,7 @@ namespace mu2e { } } - template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj, unsigned) { + template void KKShellXing::updateReference(KinKal::ParticleTrajectory const& ptraj, KinKal::MetaIterConfig const&) { auto const& neartrajptr = ptraj.nearestTraj(inter_.time_); if(neartrajptr != reftrajptr_){ // traj has changed; try intersecting with this piece diff --git a/Mu2eKinKal/inc/KKStrawHit.hh b/Mu2eKinKal/inc/KKStrawHit.hh index 9eff8e6ec7..0a8ec619ba 100644 --- a/Mu2eKinKal/inc/KKStrawHit.hh +++ b/Mu2eKinKal/inc/KKStrawHit.hh @@ -83,7 +83,7 @@ namespace mu2e { auto const& timeResidual() const { return resids_[Mu2eKinKal::tresid];} auto const& distResidual() const { return resids_[Mu2eKinKal::dresid];} double time() const override { return ca_.particleToca(); } - void updateReference(PTRAJ const& ptraj, unsigned maxiter) override; + void updateReference(PTRAJ const& ptraj, MetaIterConfig const& miconfig) override; KTRAJPTR refTrajPtr() const override { return ca_.particleTrajPtr(); } void print(std::ostream& ost=std::cout,int detail=0) const override; // re-override; even though this is implemented in the base class @@ -157,10 +157,11 @@ namespace mu2e { return CA(utraj,wirePtr(),ca.hint(),ca.precision()); } - template void KKStrawHit::updateReference(PTRAJ const& ptraj, unsigned maxiter) { + template void KKStrawHit::updateReference(PTRAJ const& ptraj, MetaIterConfig const& miconfig) { // if we already computed PCA in the previous iteration, use that to set the hint. This speeds convergence // otherwise use the time at the center of the wire, corrected for drift auto mtime =wire().timeAtMidpoint(); + unsigned maxiter = miconfig.hitPieceIter(); CAHint tphint = ca_.usable() ? ca_.hint() : CAHint(mtime-chit_.driftTime(),mtime); PCA pca(ptraj,wirePtr(),tphint,precision(),maxiter); // check that we're on the right branch: we can move off if t0 changes a lot between iterations diff --git a/Mu2eKinKal/inc/KKStrawHitCluster.hh b/Mu2eKinKal/inc/KKStrawHitCluster.hh index cd5dee7863..7598587c2d 100644 --- a/Mu2eKinKal/inc/KKStrawHitCluster.hh +++ b/Mu2eKinKal/inc/KKStrawHitCluster.hh @@ -76,7 +76,7 @@ namespace mu2e { unsigned nDOF() const override { return 0; } KinKal::Weights const& weight() const override { return (*hits_.begin())->weight(); } double time() const override; - void updateReference(PTRAJ const& ptraj, unsigned) override {} // nothing to do here, ref comes from individual hits + void updateReference(PTRAJ const& ptraj, KinKal::MetaIterConfig const&) override {} // nothing to do here, ref comes from individual hits KTRAJPTR refTrajPtr() const override { return (*hits_.begin())->refTrajPtr(); } // update the internals of the hit, specific to this meta-iteraion. This will affect the next fit iteration void updateState(KinKal::MetaIterConfig const& config,bool first) override; diff --git a/Mu2eKinKal/inc/KKStrawXing.hh b/Mu2eKinKal/inc/KKStrawXing.hh index 595835c73a..fa65dd9e6e 100644 --- a/Mu2eKinKal/inc/KKStrawXing.hh +++ b/Mu2eKinKal/inc/KKStrawXing.hh @@ -67,7 +67,7 @@ namespace mu2e { return rv; }; // ElementXing interface - void updateReference(PTRAJ const& ptraj, unsigned maxiter) override; + void updateReference(PTRAJ const& ptraj, MetaIterConfig const& miconfig) override; void updateState(MetaIterConfig const& config,bool first) override; Parameters params() const override; std::vectorconst& matXings() const override { return mxings_; } @@ -131,14 +131,14 @@ namespace mu2e { return active_ || (shptr_ && shptr_->hitState().active()); } - template void KKStrawXing::updateReference(PTRAJ const& ptraj, unsigned maxiter) { + template void KKStrawXing::updateReference(PTRAJ const& ptraj, MetaIterConfig const& miconfig) { CAHint tphint(strawAxis()->timeAtMidpoint(),strawAxis()->timeAtMidpoint()); if(ca_.usable()){ tphint = ca_.hint(); }else if(shptr_ && shptr_->closestApproach().usable()){ tphint = shptr_->closestApproach().hint(); } - PCA pca(ptraj,strawAxis(),tphint,precision(),maxiter); + PCA pca(ptraj,strawAxis(),tphint,precision(),miconfig.xingPieceIter()); ca_ = static_cast(pca); } From 6712fa480c40ff46117920ec4652bdc79dd38306 Mon Sep 17 00:00:00 2001 From: Rob Mina Date: Fri, 23 Oct 2026 15:10:14 -0500 Subject: [PATCH 4/4] Bump envset to 109. --- .muse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.muse b/.muse index 983fc57704..595d8cfca7 100644 --- a/.muse +++ b/.muse @@ -1,5 +1,5 @@ # prefer to build with this environment -ENVSET p108 +ENVSET p109 # add Offline/bin to path PATH bin # recent commits can take enforce these flags