Skip to content

Add ability to change particle type when regrowing#1877

Open
brownd1978 wants to merge 3 commits into
Mu2e:mainfrom
brownd1978:refreco
Open

Add ability to change particle type when regrowing#1877
brownd1978 wants to merge 3 commits into
Mu2e:mainfrom
brownd1978:refreco

Conversation

@brownd1978

Copy link
Copy Markdown
Collaborator

This PR provides an option to force regrown tracks to have a different particle type (mass) than what the KalSeed stores. The default is for regrown tracks to have the same particle type as the KalSeed.

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

  • Mu2eKinKal
  • 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 934d561: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild

Copy link
Copy Markdown
Collaborator

‼️ It was not possible to prepare the workspace for this test. This is often caused by merge conflicts - please check and try again.

> git diff --check | grep -i conflict
Mu2eKinKal/src/RegrowLoopHelix_module.cc:280: leftover conflict marker
Mu2eKinKal/src/RegrowLoopHelix_module.cc:283: leftover conflict marker
Mu2eKinKal/src/RegrowLoopHelix_module.cc:287: leftover conflict marker
Test Result Details
test with Command did not list any other PRs to include
merge 934d561 into 20895af merge failed

@brownd1978

Copy link
Copy Markdown
Collaborator Author

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at a384c3d.

Test Result Details
test with Command did not list any other PRs to include
merge Merged a384c3d at 20895af
build (prof) Log file. Build time: 04 min 26 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.
FIXME, TODO ➡️ TODO (0) FIXME (2) in 5 files
clang-tidy ➡️ 4 errors 38 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at a384c3d after being merged into the base branch at 20895af.

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

Copy link
Copy Markdown
Collaborator

PR Summary

Purpose: Adds an option to force regrown tracks to have a different particle type (mass) than what the KalSeed stores. Default behavior is unchanged (same particle type as the KalSeed).

  • Scope: 7 files changed (+84, −27), no reviews yet, label build finished
  • Risk: Low–medium — touches a shared reco data product (KalSeed/KalSegment) but changes are additive/backward-compatible via default arguments
  • Mergeable: Likely; no blocking reviews present

Core Changes

  1. KalSegment – trajectory converters (loopHelix, centralHelix, kinematicLine) now take an optional double mass = -1.0. Moved from inline header to .cc. When mass >= 0, they rebuild the ParticleStateEstimate with the overridden mass.
  2. KalSeed – the three *FitTrajectory() methods now accept an optional PDGCode::type ptype = PDGCode::unknown; when set (and different from _tpart), they look up the mass via GlobalConstantsHandle<ParticleDataList> and pass it down.
  3. RegrowLoopHelix_module – new optional fhicl parameter FitParticle (PDG code). Overrides the particle when building KKTRK, preserving the sign of the original kseed.particle().
  4. Build files – add GlobalConstantsService dependency to RecoDataProducts (CMake + SConscript).

Issues Found

1. Behavior change unrelated to the PR's stated purpose (potential regression)RecoDataProducts/src/KalSegment.cc

The t0 fallback was changed from a legacy computation to now throwing:

-    //      throw cet::exception(...)
-    // for now, revert to the legacy implementation...
-    auto vel = _pstate.velocity();
-    return _pstate.time() - _pstate.position3().Z()/vel.Z();
+    throw cet::exception("RECO")<<"mu2e::KalSegment: no trajectory specified in flag" << std::endl;

This converts a silent-fallback path into a hard exception. Any caller relying on the legacy behavior (e.g. segments without a trajectory flag set) will now throw. This is out of scope for "change particle type when regrowing" and deserves explicit callout / confirmation that no production path hits it.

2. Suspicious cast in the moduleMu2eKinKal/src/RegrowLoopHelix_module.cc

auto tpart = tpart_ != PDGCode::unknown ? static_cast<PDGCode>(std::copysign(...)) : kseed.particle();

static_cast<PDGCode> casts to the class/enum name PDGCode, whereas elsewhere the code uses PDGCode::type. If PDGCode is a struct wrapping an enum type, this may not compile or may be relying on an implicit conversion. Worth verifying it should be PDGCode::type.

3. Duplicate includeMu2eKinKal/src/RegrowLoopHelix_module.cc

+#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
+#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"

ParticleDataList.hh is already included at the top of the file (line 21 in the context shown). The second include is redundant.

4. Mass-lookup duplicationRecoDataProducts/src/KalSeed.cc

The identical 4-line mass-lookup block is copy-pasted into all three *FitTrajectory methods. Minor — a small private helper would reduce duplication and the risk of them diverging.

@FNALbuild

Copy link
Copy Markdown
Collaborator

📝 The HEAD of main has changed to eb6c796. Tests are now out of date.

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