Skip to content

Add dt_hit / dt_ptoca linear fit information for hits on a track#1873

Open
michaelmackenzie wants to merge 3 commits into
Mu2e:mainfrom
michaelmackenzie:TrkDtDt
Open

Add dt_hit / dt_ptoca linear fit information for hits on a track#1873
michaelmackenzie wants to merge 3 commits into
Mu2e:mainfrom
michaelmackenzie:TrkDtDt

Conversation

@michaelmackenzie

Copy link
Copy Markdown
Contributor

The straw hit time vs. track expected time at the hit position has a non-unit slope when the wrong mass hypothesis is assumed. This slope information can be used in PID, as is relevant to PR Mu2e/MLTrain#9. This adds a reco data product with this information and a producer module to create a collection of these products for input KalSeed or KalSeedPtr collections.

@FNALbuild

Copy link
Copy Markdown
Collaborator

Hi @michaelmackenzie,
You have proposed changes to files in these packages:

  • ParticleID
  • RecoDataProducts

which require these tests: build.

@Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main.

⌛ The following tests have been triggered for e7ca770: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☔ The build tests failed for e7ca770.

Test Result Details
test with Command did not list any other PRs to include
merge Merged e7ca770 at 3d84f93
build (prof) Log file. Build time: 04 min 18 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file.
check_cmake Log file. Return Code 1.
FIXME, TODO TODO (0) FIXME (0) in 2 files
clang-tidy ➡️ 2 errors 9 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at e7ca770 after being merged into the base branch at 3d84f93.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@oksuzian

oksuzian commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Possible Improvements

The following are concrete, diff-anchored points worth addressing before merge:

  1. Weight formula looks physically wrong / risks division-by-zero.
    ParticleID/src/TrackDtDt_module.cc:60-62

    const double t_unc  = hit._udresid / hit._dvel;
    const double weight = 1./t_unc;

    _udresid is the unbiased distance residual value (see TrkStrawHitSeed.hh:186), not an uncertainty — so residual/velocity is not a time uncertainty. A time error would more plausibly come from a variance term (e.g. sqrt(_udresidmvar)/_dvel, or _utocavar). As written, weight can be negative (residuals are signed) and 1/t_unc blows up when _udresid == 0 or _dvel == 0 (the legacy BTrk constructor sets _dvel = 0). Please confirm the intended uncertainty and guard against zero/negative weights.

  2. LsqSums2 accessors are non-const, but you pass seed by const-ref. This compiles only because fitter is a local non-const. Still, consider that dof_ = fitter.qn() - 2 can go negative for tracks with <2 hits, and chisq_ = chi2Dof()*dof_ will then be meaningless. Add a guard for qn() < 3 (skip or set sentinel values).

  3. Struct members are uninitialized when set from the fit. KalSeedDtDt's default ctor zero-inits, but fitTrackDtDt creates a result and sets 5 fields — fine today, but if any LsqSums2 accessor returns NaN (e.g. det()==0 for degenerate input), it propagates silently. A quick isnan check before emplace would harden the product.

  4. Minor: #include <iostream> guarded diagnostics use std::cout; consider mf::LogInfo/MessageLogger for consistency with framework conventions, though many Mu2e modules do use std::cout under diagLevel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants