Add configurable Q2 minimum cuts and spline consistency metadata#492
Add configurable Q2 minimum cuts and spline consistency metadata#492Pabce wants to merge 8 commits into
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 ;
| 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
|
|
||
| ClassImp(KPhaseSpace) | ||
|
|
||
| namespace { |
| 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?
| 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?
| 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.
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