Make the EM Q2 threshold (kMinQ2Limit) configurable via CommonParam#502
Open
LiangLiu212 wants to merge 1 commit into
Open
Make the EM Q2 threshold (kMinQ2Limit) configurable via CommonParam#502LiangLiu212 wants to merge 1 commit into
LiangLiu212 wants to merge 1 commit into
Conversation
The minimum Q2 for electromagnetic scattering events was a hardcoded constant (static const double kMinQ2Limit = 0.02 GeV^2) in KineUtils.h, so studies of the EM low-Q2 region required rebuilding GENIE. Replace the constant with an EMMinQ2LimitProxy that lazily reads "EM-MinQ2Limit" from CommonParam.xml [Lepton] on first use and caches it for the lifetime of the program. The proxy converts implicitly to double, so every existing call site compiles unchanged, and it falls back to the historical 0.02 GeV^2 if the parameter or registry is absent -- default behaviour is identical. The chosen value is logged once at pNOTICE for provenance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
I currently work on (e, e'p) analysis. I create this PR via claude code just with prompt. Although I open this PR, I do not intend to include it in the v3.8 release. |
Contributor
|
This work is already ongoing in #492 and was presented last week at the GENIE core meeting. It had a lot of discussion and feedback. Pablo is already working on it. We discussed the implementation at the GENIE meeting with specific input needs from e4nu. I would recommend avoiding duplication of efforts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The minimum Q2 for electromagnetic scattering events is a hardcoded constant in
src/Framework/Utils/KineUtils.h:Any study that needs a different EM low-Q2 boundary (e.g. electron-scattering validation work where the generation threshold must be varied) currently requires patching and rebuilding GENIE.
Change
Replace the constant with a small proxy object that reads
EM-MinQ2LimitfromCommonParam.xml[Lepton]lazily on first use and caches it for the lifetime of the program:KineUtils.h—kMinQ2Limitbecomesextern const EMMinQ2LimitProxy, a struct withoperator double(), so every existing call site compiles and behaves unchanged.KineUtils.cxx— the proxy implementation: one read ofCommonParam[Lepton]/EM-MinQ2LimitviaAlgConfigPool(lazy, so the pool is guaranteed initialised), cached in a function-local static, logged once atpNOTICEfor provenance.CommonParam.xml— addsEM-MinQ2Limitto the[Lepton]param set with the historical default0.02.Backwards compatibility
Default behaviour is identical: if the parameter (or the registry) is absent the proxy falls back to the historical
0.02 GeV^2, and the shippedCommonParam.xmlsets exactly that value. No call-site changes anywhere in the codebase.Validation
An equivalent patch has been exercised in our local electron-scattering builds: tunes overriding
EM-MinQ2Limitbetween 0.02 and ~1.2 GeV^2 via per-tuneCommonParam.xmloverlays show the expected generation-level Q2 cut in bothgmksplsplines andgevgenevent samples (e- on C12, O(10M)-event productions), while builds without an override reproduce the previous hardcoded behaviour.🤖 Generated with Claude Code