Repository navigation
Conversation
Add EM-Q2-min parameter to CommonParam.xml [Kinematics] section, allowing users to configure the minimum Q^2 threshold for EM scattering events without recompiling. Default value is 0.02 GeV^2 (unchanged). CRITICAL FIX: DISKinematicsGenerator was sampling (x,y) and converting to Q^2 without checking if Q^2 >= Q2min, allowing events to leak below the threshold. Added explicit Q^2 check in event generation loop. Changes: - Add EM-Q2-min parameter to 5 config files (main + 4 GEM tunes) - Add KPhaseSpace::GetQ2MinEM() to load config value at runtime - Update KineUtils electromagnetic functions to accept Q2min parameter - Fix 8 physics modules that used hardcoded kMinQ2Limit constant: * DISKinematicsGenerator: Add Q^2 threshold check (critical bug fix) * RESKinematicsGenerator: Use config value in max xsec calculation * MECGenerator, MECUtils, SuSAv2MECPXSec, EmpiricalMECPXSec2015 * QELEventGeneratorSuSA, SuSAv2QELPXSec Users must regenerate cross-section splines after changing EM-Q2-min. 17 files modified. See IMPLEMENTATION_REPORT.md for details. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The explicit Q² threshold check in DISKinematicsGenerator.cxx has been removed after testing confirmed that the implicit enforcement mechanism works correctly. The Q²min threshold is properly enforced through the existing kinematic validation chain: ValidKinematics() → IsAllowed() → Q2Lim_W() → InelQ2Lim_W() This approach is cleaner and more consistent with how other kinematic constraints are handled in GENIE. Updated IMPLEMENTATION_REPORT.md to reflect this change: - Removed the "Critical Issue" section about DISKinematicsGenerator - Updated file count from 17 to 16 modified files - Added note about the implicit enforcement mechanism Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add the ability to override the EM-Q2-min parameter (minimum Q^2 threshold for electromagnetic scattering events) from the command line, without requiring modification of CommonParam.xml. Changes to both gevgen (gEvGen.cxx) and gmkspl (gMakeSplines.cxx): - Parse new --em-q2-min <value> argument (value in GeV^2) - Override the Registry value after BuildTune() loads XML configs - Add documentation in help text and header comments - Log the override value in job configuration output This allows users to easily test different Q^2 thresholds without editing XML configuration files or regenerating builds. Usage examples: gevgen ... --em-q2-min 0.5 gmkspl ... --em-q2-min 0.5
|
The "enable pi0 decays by default" was a local change that got into the branch by accident - but it is now reverted. |
|
Example spline generated with The relevant Q2 cut information is placed as: |
| // Q2 minimum override | ||
| gOptQ2MinSet = false; | ||
| if(parser.OptionExists("q2-min")) { | ||
| LOG("gmkspl", pINFO) << "Reading Q2 minimum cut override"; |
There was a problem hiding this comment.
I would add a more descriptive message like
LOG("gmkspl", pINFO) << "Overiding minimum Q2 phase-space minimum by "<< gOptQ2Min ;
There was a problem hiding this comment.
Also agreed, added more descriptive wording + value.
| cross-section calculation for nuclear targets. | ||
| --q2-min | ||
| Override the minimum Q^2 phase-space cut (in GeV^2). For weak | ||
| interactions, this explicitly opts the run into the Q2 cut. |
There was a problem hiding this comment.
As this is a new feature, I would specify where this is by default setup for EM interactions.
Quote the CommonPhaseSpaceCuts.xml file
There was a problem hiding this comment.
Agreed. Updated the help text here and in gEvGen.cxx to say that the default EM cut is configured in CommonPhaseSpaceCuts.xml as EM-Q2-min.
|
|
||
| ClassImp(KPhaseSpace) | ||
|
|
||
| namespace { |
There was a problem hiding this comment.
The namespace here is just making ApplyQ2MinCut local to this .cxx file, like a static helper function. If this is not to GENIE-code I can remove it with no change to functionality.
| Q2l = kinematics::DarkQ2Lim_W(Ev,M,ml,W); | ||
| } else { | ||
| Q2l = is_em ? kinematics::electromagnetic::InelQ2Lim_W(Ev,ml,M,W) : kinematics::InelQ2Lim_W(Ev,M,ml,W); | ||
| Q2l = is_em ? kinematics::electromagnetic::InelQ2Lim_W(Ev,ml,M,W,0.) : kinematics::InelQ2Lim_W(Ev,M,ml,W); |
There was a problem hiding this comment.
Is this enforcing 0 for everything but em?
Doesn't it need to still be configurable?
There was a problem hiding this comment.
No, this does not enforce 0 (it is actually setting 0 for EM in this cut, not for non-EM). The purpose is to pass a default floor for EM so that the actual EM floor comes only from KPhaseSpaceCuts - and not from genie::utils::kinematics::electromagnetic::kMinQ2Limit . Weak interactions still use controls::kMinQ2Limit unless --q2-min or Weak-Q2-min opts them into the configurable cut. I added a comment to make it clearer.
There was a problem hiding this comment.
It is worth discussing if we want to get rid of the legacy Q2 floor-setting from KPhaseSpace.cxx altogether (i.e., also for weak interactions).
| Range1D_t Q2Lim_W_SPP_iso (void) const; ///< Q2 limits @ fixed W for resonance single pion production on isoscalar nucleon | ||
|
|
||
| static double GetTMaxDFR(); | ||
| static double GetQ2MinEM(); ///< Deprecated; use KPhaseSpaceCuts instead. |
There was a problem hiding this comment.
Shouldn't we remove the function?
There was a problem hiding this comment.
Yes, function was removed and also corresponding unused KPhaseSpaceCuts::EMQ2MinCut().
| bool fHasQ2MinOverride; | ||
| double fQ2MinOverride; | ||
|
|
||
| struct Cleaner { |
There was a problem hiding this comment.
I think this is also not the standard way to do this in GENIE. To discuss later.
There was a problem hiding this comment.
Discussed, this is a common pattern in GENIE singleton classes and so is left as-is.
|
Example before-after splines for neutrino and electron --q2-min limits, showcasing identity except for new kinematics metadata. after_em_q2_0p02.xml |
|
Whew. This is a big and complex set of changes (and the commit of a number of irrelevant files) some of which seem somewhat unrelated -- it's not clear to me that there aren't two sets of concepts in this PR, but it's drowned in the noise. I'd suggest that Pablo start one or more clean branches (starting from the current I have the vague recollection about some of this was previously discussed in this talk: https://genie-docdb.pp.rl.ac.uk/DocDB/0005/000544/001/q2-min-implementation-genie.pdf. I don't recall the details of what the disposition was for that meeting though. Possibly we should have an update at more general meeting about this proposal. |
bef7393 to
e5a6e4b
Compare
|
@nusense @jtenavidal Apologies for the confusion and the extra review work. While migrating my development environment between machines, I accidentally pushed unrelated local commits to the branch backing this PR, including generated outputs and temporary files. I’ve now removed those commits and restored the PR to its state before the migration ( |
Summary
Adds a configurable phase-space Q2 minimum cut, initially used for EM/electron interactions, with optional weak-interaction support through XML configuration or
--q2-min.Main Changes
KPhaseSpaceCutsas the central service for configurable Q2 cuts.CommonPhaseSpaceCuts.xmlconfiguration XML as the single source of truth for Q2 cuts, and potential future kinematic cuts in other variables.--q2-mintogevgenandgmkspl.gevgenreject spline files whose recorded Q2 cut is missing or inconsistent when an effective cut is active.Validation
gtestKPhaseSpacecoverage for EM defaults, weak defaults, command-line overrides, probe-aware spline metadata, and XML round-tripping.IMPLEMENTATION_REPORT.md