From 53e166959cf6f57f91911bfa05b79e522d8f0a52 Mon Sep 17 00:00:00 2001 From: Robert Hatcher Date: Wed, 13 May 2026 14:38:08 -0500 Subject: [PATCH 1/3] when cloning a particle set LastMother to -1 in case source had two mothers --- src/Physics/HadronTransport/HAIntranuke.cxx | 1 - src/Physics/HadronTransport/HAIntranuke2018.cxx | 1 - src/Physics/HadronTransport/HAIntranuke2025.cxx | 1 - src/Physics/HadronTransport/HNIntranuke2018.cxx | 1 + src/Physics/HadronTransport/HNIntranuke2025.cxx | 2 ++ src/Physics/HadronTransport/HadronTransporter.cxx | 1 + src/Physics/HadronTransport/INukeDeltaPropg.cxx | 1 + src/Physics/HadronTransport/INukeException.cxx | 1 - src/Physics/HadronTransport/INukeHadroData.cxx | 1 - src/Physics/HadronTransport/INukeHadroData2018.cxx | 1 - src/Physics/HadronTransport/INukeHadroData2025.cxx | 1 - src/Physics/HadronTransport/INukeNucleonCorr.cxx | 1 - src/Physics/HadronTransport/INukeUtils.cxx | 1 + src/Physics/HadronTransport/INukeUtils2018.cxx | 1 + src/Physics/HadronTransport/INukeUtils2025.cxx | 1 + src/Physics/HadronTransport/Intranuke.cxx | 3 ++- src/Physics/HadronTransport/Intranuke2018.cxx | 2 ++ src/Physics/HadronTransport/Intranuke2025.cxx | 2 ++ src/Physics/HadronTransport/NucBindEnergyAggregator.cxx | 2 +- 19 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Physics/HadronTransport/HAIntranuke.cxx b/src/Physics/HadronTransport/HAIntranuke.cxx index 258d0c3cbe..d81441564b 100644 --- a/src/Physics/HadronTransport/HAIntranuke.cxx +++ b/src/Physics/HadronTransport/HAIntranuke.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Author: Steve Dytman , Pittsburgh Univ. Aaron Meyer , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/HAIntranuke2018.cxx b/src/Physics/HadronTransport/HAIntranuke2018.cxx index 682470dde1..2a52ed6e42 100644 --- a/src/Physics/HadronTransport/HAIntranuke2018.cxx +++ b/src/Physics/HadronTransport/HAIntranuke2018.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Author: Steve Dytman , Pittsburgh Univ. Aaron Meyer , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/HAIntranuke2025.cxx b/src/Physics/HadronTransport/HAIntranuke2025.cxx index cb5027f69f..f21631faae 100644 --- a/src/Physics/HadronTransport/HAIntranuke2025.cxx +++ b/src/Physics/HadronTransport/HAIntranuke2025.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Author: Steve Dytman , Pittsburgh Univ. Aaron Meyer , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/HNIntranuke2018.cxx b/src/Physics/HadronTransport/HNIntranuke2018.cxx index 3a1b6d796a..fa296d7e69 100644 --- a/src/Physics/HadronTransport/HNIntranuke2018.cxx +++ b/src/Physics/HadronTransport/HNIntranuke2018.cxx @@ -920,6 +920,7 @@ int HNIntranuke2018::HandleCompoundNucleus(GHepRecord* ev, GHepParticle* p, int { GHepParticle * sp = new GHepParticle(*p); sp->SetFirstMother(mom); + sp->SetLastMother(-1); // in case mother had 2 mothers // this was PreEquilibrium - now just used for hN //same arguement lists for PreEq and Eq utils::intranuke2018::Equilibrium(ev,sp,fRemnA,fRemnZ,fRemnP4, diff --git a/src/Physics/HadronTransport/HNIntranuke2025.cxx b/src/Physics/HadronTransport/HNIntranuke2025.cxx index b00ffbcc67..ee9f292397 100644 --- a/src/Physics/HadronTransport/HNIntranuke2025.cxx +++ b/src/Physics/HadronTransport/HNIntranuke2025.cxx @@ -917,6 +917,7 @@ int HNIntranuke2025::HandleCompoundNucleus(GHepRecord* ev, GHepParticle* p, int { GHepParticle * sp = new GHepParticle(*p); sp->SetFirstMother(mom); + sp->SetLastMother(-1); // in case mother had 2 mothers // this was PreEquilibrium - now just used for hN //same arguement lists for PreEq and Eq utils::intranuke2025::Equilibrium(ev,sp,fRemnA,fRemnZ,fRemnP4, @@ -932,6 +933,7 @@ int HNIntranuke2025::HandleCompoundNucleus(GHepRecord* ev, GHepParticle* p, int << "*** Nothing left to interact with, escaping."; GHepParticle * sp = new GHepParticle(*p); sp->SetFirstMother(mom); + sp->SetLastMother(-1); // in case mother had 2 mothers sp->SetStatus(kIStStableFinalState); ev->AddParticle(*sp); delete sp; diff --git a/src/Physics/HadronTransport/HadronTransporter.cxx b/src/Physics/HadronTransport/HadronTransporter.cxx index 4bd12cf879..9b6ed4054e 100644 --- a/src/Physics/HadronTransport/HadronTransporter.cxx +++ b/src/Physics/HadronTransport/HadronTransporter.cxx @@ -116,6 +116,7 @@ void HadronTransporter::TransportInTransparentNuc(GHepRecord * evrec) const GHepParticle * cp = new GHepParticle(*p); // create a clone cp->SetFirstMother(icurr); // clone's mother + cp->SetLastMother(-1); // in case mother had 2 mothers cp->SetStatus(kIStStableFinalState); // mark it & done with it evrec->AddParticle(*cp); // add it at the event record diff --git a/src/Physics/HadronTransport/INukeDeltaPropg.cxx b/src/Physics/HadronTransport/INukeDeltaPropg.cxx index 881e8fd601..9474728f25 100644 --- a/src/Physics/HadronTransport/INukeDeltaPropg.cxx +++ b/src/Physics/HadronTransport/INukeDeltaPropg.cxx @@ -94,6 +94,7 @@ void INukeDeltaPropg::ProcessEventRecord(GHepRecord * event) const // Set clone's mom to be the hadron that was cloned sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers // Start stepping particle out of the nucleus bool has_interacted = false; diff --git a/src/Physics/HadronTransport/INukeException.cxx b/src/Physics/HadronTransport/INukeException.cxx index 7f1004fc74..e670c6889c 100644 --- a/src/Physics/HadronTransport/INukeException.cxx +++ b/src/Physics/HadronTransport/INukeException.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Costas Andreopoulos University of Liverpool diff --git a/src/Physics/HadronTransport/INukeHadroData.cxx b/src/Physics/HadronTransport/INukeHadroData.cxx index 7629071e4c..8687afe0fa 100644 --- a/src/Physics/HadronTransport/INukeHadroData.cxx +++ b/src/Physics/HadronTransport/INukeHadroData.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Costas Andreopoulos , Rutherford Lab. Steve Dytman , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/INukeHadroData2018.cxx b/src/Physics/HadronTransport/INukeHadroData2018.cxx index 1892243fa0..a055f46ac1 100644 --- a/src/Physics/HadronTransport/INukeHadroData2018.cxx +++ b/src/Physics/HadronTransport/INukeHadroData2018.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Costas Andreopoulos , Rutherford Lab. Steve Dytman , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/INukeHadroData2025.cxx b/src/Physics/HadronTransport/INukeHadroData2025.cxx index 2ad7a4c760..b92e120601 100644 --- a/src/Physics/HadronTransport/INukeHadroData2025.cxx +++ b/src/Physics/HadronTransport/INukeHadroData2025.cxx @@ -2,7 +2,6 @@ /* Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Costas Andreopoulos , Rutherford Lab. Steve Dytman , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/INukeNucleonCorr.cxx b/src/Physics/HadronTransport/INukeNucleonCorr.cxx index 8c20a3e2b2..e1b7a7686c 100644 --- a/src/Physics/HadronTransport/INukeNucleonCorr.cxx +++ b/src/Physics/HadronTransport/INukeNucleonCorr.cxx @@ -3,7 +3,6 @@ Copyright (c) 2003-2025, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org - Author: Tomek Golan , FNAL/Rochester Steve Dytman , Pittsburgh Univ. Josh Kleckner , Pittsburgh Univ. diff --git a/src/Physics/HadronTransport/INukeUtils.cxx b/src/Physics/HadronTransport/INukeUtils.cxx index 2f8c4a04a0..719cf8ce16 100644 --- a/src/Physics/HadronTransport/INukeUtils.cxx +++ b/src/Physics/HadronTransport/INukeUtils.cxx @@ -532,6 +532,7 @@ void genie::utils::intranuke::PreEquilibrium( // decay a clone particle GHepParticle * t = new GHepParticle(*(ev->Particle(f_loc))); t->SetFirstMother(f_loc); + t->SetLastMother(-1); // in case mother had 2 mothers genie::utils::intranuke::Equilibrium(ev,t,RemnA,RemnZ,RemnP4,DoFermi,FermiFac,Nuclmodel,NucRmvE,mode); delete t; diff --git a/src/Physics/HadronTransport/INukeUtils2018.cxx b/src/Physics/HadronTransport/INukeUtils2018.cxx index 773e1c7224..d53bb5d794 100644 --- a/src/Physics/HadronTransport/INukeUtils2018.cxx +++ b/src/Physics/HadronTransport/INukeUtils2018.cxx @@ -631,6 +631,7 @@ void genie::utils::intranuke2018::PreEquilibrium( // decay a clone particle GHepParticle * t = new GHepParticle(*(ev->Particle(f_loc))); t->SetFirstMother(f_loc); + t->SetLastMother(-1); // in case mother had 2 mothers //next statement was in Alex Bell's original code - PreEq, then Equilibrium using particle with highest energy. Note it gets IST=kIStIntermediateState. //genie::utils::intranuke2018::Equilibrium(ev,t,RemnA,RemnZ,RemnP4,DoFermi,FermiFac,Nuclmodel,NucRmvE,mode); diff --git a/src/Physics/HadronTransport/INukeUtils2025.cxx b/src/Physics/HadronTransport/INukeUtils2025.cxx index b1951bbbf8..25968bbd65 100644 --- a/src/Physics/HadronTransport/INukeUtils2025.cxx +++ b/src/Physics/HadronTransport/INukeUtils2025.cxx @@ -616,6 +616,7 @@ void genie::utils::intranuke2025::PreEquilibrium( // decay a clone particle GHepParticle * t = new GHepParticle(*(ev->Particle(f_loc))); t->SetFirstMother(f_loc); + t->SetLastMother(-1); // in case mother had 2 mothers //next statement was in Alex Bell's original code - PreEq, then Equilibrium using particle with highest energy. Note it gets IST=kIStIntermediateState. //genie::utils::intranuke2025::Equilibrium(ev,t,RemnA,RemnZ,RemnP4,DoFermi,FermiFac,Nuclmodel,NucRmvE,mode); diff --git a/src/Physics/HadronTransport/Intranuke.cxx b/src/Physics/HadronTransport/Intranuke.cxx index 1cec4e2894..64f1fbcc6c 100644 --- a/src/Physics/HadronTransport/Intranuke.cxx +++ b/src/Physics/HadronTransport/Intranuke.cxx @@ -319,7 +319,8 @@ void Intranuke::TransportHadrons(GHepRecord * evrec) const GHepParticle * sp = new GHepParticle(*p); // Set clone's mom to be the hadron that was cloned - sp->SetFirstMother(icurr); + sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers // Check whether the particle can be rescattered if(!this->CanRescatter(sp)) { diff --git a/src/Physics/HadronTransport/Intranuke2018.cxx b/src/Physics/HadronTransport/Intranuke2018.cxx index 84d563c403..4f7b8c225b 100644 --- a/src/Physics/HadronTransport/Intranuke2018.cxx +++ b/src/Physics/HadronTransport/Intranuke2018.cxx @@ -320,6 +320,7 @@ void Intranuke2018::TransportHadrons(GHepRecord * evrec) const // Set clone's mom to be the hadron that was cloned sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers // Check whether the particle can be rescattered if(!this->CanRescatter(sp)) { @@ -328,6 +329,7 @@ void Intranuke2018::TransportHadrons(GHepRecord * evrec) const LOG("Intranuke2018", pNOTICE) << "... Current version can't rescatter a " << sp->Name(); sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers sp->SetStatus(kIStStableFinalState); evrec->AddParticle(*sp); delete sp; diff --git a/src/Physics/HadronTransport/Intranuke2025.cxx b/src/Physics/HadronTransport/Intranuke2025.cxx index c071352da9..4634dd2f62 100644 --- a/src/Physics/HadronTransport/Intranuke2025.cxx +++ b/src/Physics/HadronTransport/Intranuke2025.cxx @@ -284,6 +284,7 @@ void Intranuke2025::TransportHadrons(GHepRecord * evrec) const // Set clone's mom to be the hadron that was cloned sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers // Check whether the particle can be rescattered if(!this->CanRescatter(sp)) { @@ -292,6 +293,7 @@ void Intranuke2025::TransportHadrons(GHepRecord * evrec) const LOG("Intranuke2025", pNOTICE) << "... Current version can't rescatter a " << sp->Name(); sp->SetFirstMother(icurr); + sp->SetLastMother(-1); // in case mother had 2 mothers sp->SetStatus(kIStStableFinalState); evrec->AddParticle(*sp); delete sp; diff --git a/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx b/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx index 3446b11677..6b561349d3 100644 --- a/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx +++ b/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx @@ -185,7 +185,7 @@ GHepParticle * NucBindEnergyAggregator::FindMotherNucleus( //-- get its mothet int mother_pos = p->FirstMother(); - //-- if mother is set + //-- in case mother is set if(mother_pos != -1) { GHepParticle * mother = evrec->Particle(mother_pos); From 62c80774123e6a32509571bfa7ca6dfbf831d549 Mon Sep 17 00:00:00 2001 From: Robert Hatcher Date: Wed, 13 May 2026 14:43:44 -0500 Subject: [PATCH 2/3] undo erroneous change --- src/Physics/HadronTransport/NucBindEnergyAggregator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx b/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx index 6b561349d3..3446b11677 100644 --- a/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx +++ b/src/Physics/HadronTransport/NucBindEnergyAggregator.cxx @@ -185,7 +185,7 @@ GHepParticle * NucBindEnergyAggregator::FindMotherNucleus( //-- get its mothet int mother_pos = p->FirstMother(); - //-- in case mother is set + //-- if mother is set if(mother_pos != -1) { GHepParticle * mother = evrec->Particle(mother_pos); From 59951d09f60849317341b44200e5e35588651f66 Mon Sep 17 00:00:00 2001 From: Robert Hatcher Date: Wed, 13 May 2026 15:44:32 -0500 Subject: [PATCH 3/3] overlooked one instance --- src/Physics/HadronTransport/HNIntranuke2018.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Physics/HadronTransport/HNIntranuke2018.cxx b/src/Physics/HadronTransport/HNIntranuke2018.cxx index fa296d7e69..7c6126d65b 100644 --- a/src/Physics/HadronTransport/HNIntranuke2018.cxx +++ b/src/Physics/HadronTransport/HNIntranuke2018.cxx @@ -936,6 +936,7 @@ int HNIntranuke2018::HandleCompoundNucleus(GHepRecord* ev, GHepParticle* p, int << "*** Nothing left to interact with, escaping."; GHepParticle * sp = new GHepParticle(*p); sp->SetFirstMother(mom); + sp->SetLastMother(-1); sp->SetStatus(kIStStableFinalState); ev->AddParticle(*sp); delete sp;