Skip to content

Prevent unphysical events from crashing gevgen#11

Open
kjplows wants to merge 1 commit intov3_06_02_brfrom
bugfix/remove-unphysical-QEL-costh0
Open

Prevent unphysical events from crashing gevgen#11
kjplows wants to merge 1 commit intov3_06_02_brfrom
bugfix/remove-unphysical-QEL-costh0

Conversation

@kjplows
Copy link

@kjplows kjplows commented Feb 16, 2026

In INCL builds, gevgen crashes with a floating point exception. This was tracked down to unphysical QEL events yielding superluminal particles that are then boosted to the lab frame, triggering sqrt(x < 0).
This filter rejects those events.

A log of the crash:

1771267890 WARN Interaction : [n] <Kinematics.cxx::SetQ2 (260)> : Setting unphysical value for Q2 (Q2 = -2.35347e-07)

Program received signal SIGFPE, Arithmetic exception.
0x00007fffed305680 in __kernel_standard () from /lib64/libm.so.6
(gdb) bt
#0  0x00007fffed305680 in __kernel_standard () from /lib64/libm.so.6
#1  0x00007fffe2637f2c in genie::utils::CosTheta0Max (interaction=...) at QELUtils.cxx:239
#2  0x00007fffe221c4f7 in genie::QELEventGenerator::ProcessEventRecord (this=0x2c3df60, evrec=0xfcc1650) at QELEventGenerator.cxx:173
#3  0x00007fffeb066570 in genie::EventGenerator::ProcessEventRecord (this=0x2b7e310, event_rec=0xfcc1650) at EventGenerator.cxx:107
#4  0x00007fffeb04e712 in genie::GEVGDriver::GenerateEvent (this=0xed2e2a0, nu4p=...) at GEVGDriver.cxx:286
#5  0x00007fffeb078c87 in genie::GMCJDriver::GenerateEventKinematics (this=0x345fb40) at GMCJDriver.cxx:1237
#6  0x00007fffeb07670e in genie::GMCJDriver::GenerateEvent1Try (this=0x345fb40) at GMCJDriver.cxx:1007
#7  0x00007fffeb074790 in genie::GMCJDriver::GenerateEvent (this=0x345fb40) at GMCJDriver.cxx:829
#8  0x000000000040ac72 in GenerateEventsUsingFluxOrTgtMix () at gEvGen.cxx:411
#9  0x0000000000409dca in main (argc=21, argv=0x7fffffff5498) at gEvGen.cxx:260
(gdb) frame 2
#2  0x00007fffe221c4f7 in genie::QELEventGenerator::ProcessEventRecord (this=0x2c3df60, evrec=0xfcc1650) at QELEventGenerator.cxx:173
173             double cos_theta0_max = std::min(1., CosTheta0Max(*interaction));
(gdb) info locals
phi = 0.89311090222536926
cos_theta0_max = 0.98254447188026539
costheta = -0.56952145047958413
xsec = 2.8181577682794442e-11
t = 4.0919206081850089e-10
__FUNCTION__ = "ProcessEventRecord"
rnd = 0x3426610
rtinfo = 0xfc336f0
evg = 0x2b7e310
interaction = 0xfcb84c0
nucleon = 0xfcb7660
nucleus = 0xfcb75a0
have_nucleus = true
tgt = 0xfdbd9a0
hitNucPos = 2.521005602226448
xsec_max = 1.016922058761981e-09
iter = 10
accept = false
__PRETTY_FUNCTION__ = "virtual void genie::QELEventGenerator::ProcessEventRecord(genie::GHepRecord*) const"
(gdb) frame 1
#1  0x00007fffe2637f2c in genie::utils::CosTheta0Max (interaction=...) at QELUtils.cxx:239
239       double gamma = 1. / std::sqrt(1. - beta.Mag2());
(gdb) info locals
probe_E_lab = 0.50475445250688866
beta = {<TObject> = {_vptr.TObject = 0x7ffff22597f8 <vtable for TVector3+16>, fUniqueID = 0, fBits = 33554432, static fgDtorOnly = 0, static fgObjectStat = true}, fX = 0.15746779410891656,
  fY = 0.30356170908669194, fZ = 1.2295317679615774}
gamma = 6.9533558054136874e-310
sqrt_s = 1.3145423613245411e-315
mNf = 1.3094821805050867e-315
ml = 2.6868159376383668e-316
lepton_E_COM = 0.93956541299999996
lepton_p_COM = 37.215525900000003
p4Ni = @0xfdbd9a0: {<TObject> = {_vptr.TObject = 0x7fffec660bb8 <vtable for genie::Target+16>, fUniqueID = 0, fBits = 50331648, static fgDtorOnly = 0, static fgObjectStat = true}, fP = {<TObject> = {
      _vptr.TObject = 0x2800000012, fUniqueID = 1000180400, fBits = 2112, static fgDtorOnly = 0, static fgObjectStat = true}, fX = -2.3532219046382903e-185, fY = 1.3094821805050867e-315,
    fZ = 2.521005602226448}, fE = 7.9544568980440694e-322}
ENi = 2.521005602226448
mNi = 6.9533558054113159e-310
ENi_on_shell = 6.9533375886353672e-310
epsilon_B = 6.9533558054136874e-310
cos_theta0_max = 2.2364494100404868e-316

@kjplows kjplows requested a review from sjgardiner February 16, 2026 18:54
@kjplows kjplows self-assigned this Feb 16, 2026
@kjplows kjplows added the bug Something isn't working label Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant

Comments