Skip to content

Setting the SecondNucleonEmitter at run-time and enabling SRC in CC-QEL interactions#18

Open
CarlosNeutrino wants to merge 2 commits into
SBNSoftware:v3_06_02_brfrom
CarlosNeutrino:cmorales/sbnsoft/SRC_fix
Open

Setting the SecondNucleonEmitter at run-time and enabling SRC in CC-QEL interactions#18
CarlosNeutrino wants to merge 2 commits into
SBNSoftware:v3_06_02_brfrom
CarlosNeutrino:cmorales/sbnsoft/SRC_fix

Conversation

@CarlosNeutrino

Copy link
Copy Markdown

Description

This Pull Request changes the way the SecondNucleonEmitter for SRC is configured. It adds the SecondNucleonEmitter in CC-QEL events (not configured before, as QELEventGenerator does not use FermiMover):

  • Before this changes, the SecondNucleonEmitter was only read from the config/ files independently from the NuclearModel.
  • The SecondNucleonEmitter depends strongly on the NuclearModel, and the code was using incompatible SecondNucleonEmitter algorithms for the specified global NuclearModel.
  • StringUtils.h → used for Split
  • Now, the SecondNucleonEmitter is configured at run-time depending on the global NuclearModel. In specific, the new code:
      - config/FermiMover.xml and config/QELEventGenerator.xml include two new strings ("NuclearModels" and "SecondNucleonEmitters") that read the NuclearModel along with the corresponding SecondNucleonEmitter
      - FermiMover.cxx and QELEventGenerator.cxx LoadConfig() reads the strings and sets the correct SecondNucleonEmitter.
      - The globally configured NuclearModel is read from the GlobalParameterList.

Development

  • A future improvement is to create a standalone module that runs SecondEmitter independently, so we do not duplicate the code in FermiMover and QELEventGenerator

Notes for reviewers

  • I tried to read the NuclearModel from EventGeneratorListAssembler but there was not any simpler way of doing it (neither did I manage to make it work) John Plows and I agreed to go ahead with GlobalParameterList
  • I have tested that the code compiles and it runs.

@CarlosNeutrino CarlosNeutrino self-assigned this Jul 7, 2026
Copilot AI review requested due to automatic review settings July 7, 2026 15:36
@CarlosNeutrino CarlosNeutrino added the bug Something isn't working label Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates SRC second-nucleon emission configuration so the SecondNucleonEmitter is selected at run time based on the globally configured nuclear model, and enables second-nucleon emission handling in CC-QEL event generation.

Changes:

  • Add runtime selection logic for SecondNucleonEmissionI based on GlobalParameterList nuclear model and new per-model mapping strings in config.
  • Invoke SecondNucleonEmitter in QELEventGenerator before building the remnant nucleus, so the remnant accounts for an emitted second nucleon.
  • Update FermiMover.xml and QELEventGenerator.xml to provide NuclearModels / SecondNucleonEmitters mapping lists.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Physics/QuasiElastic/EventGen/QELEventGenerator.h Adds SecondNucleonEmissionI pointer and per-nuclear-model emitter map.
src/Physics/QuasiElastic/EventGen/QELEventGenerator.cxx Selects emitter from global nuclear model and runs it during QEL event processing.
src/Physics/NuclearState/FermiMover.h Adds per-nuclear-model emitter map member.
src/Physics/NuclearState/FermiMover.cxx Selects emitter from global nuclear model using new config mapping.
config/QELEventGenerator.xml Adds NuclearModels / SecondNucleonEmitters mapping parameters.
config/FermiMover.xml Adds NuclearModels / SecondNucleonEmitters mapping parameters (and NuclearModel alg entry).
Comments suppressed due to low confidence (1)

src/Physics/QuasiElastic/EventGen/QELEventGenerator.h:28

  • This header now uses std::unordered_map but does not include <unordered_map>, which can cause compile failures depending on include order. Add the missing standard header explicitly.
#include "Physics/NuclearState/NuclearModelI.h"
#include "Physics/NuclearState/SecondNucleonEmissionI.h"
#include "Framework/Algorithm/AlgFactory.h"
#include "Physics/Common/KineGeneratorWithCache.h"
#include "Physics/QuasiElastic/XSection/QELUtils.h"
#include "Framework/Utils/Range1.h"
#include "Framework/Conventions/Controls.h"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Physics/NuclearState/FermiMover.h Outdated
Comment on lines +24 to +30
#include "Framework/Interaction/Target.h"
#include "Physics/NuclearState/SRCNuclearRecoil.h"
#include "Physics/NuclearState/SecondNucleonEmissionI.h"
#include "Framework/Algorithm/AlgFactory.h"
const SecondNucleonEmissionI * emitter =
dynamic_cast<const SecondNucleonEmissionI *>(alg);
if (!emitter) {
LOG("FermiMover", pWARN)
Comment on lines +372 to +384
// Now resolve fSecondEmitter for the currently configured nuclear model
fSecondEmitter = 0;
auto it = fFermiMoverMap.find(nucl_model_name);
if(it != fFermiMoverMap.end()) {
fSecondEmitter = it->second;
LOG("FermiMover", pINFO)
<< "Selected " << fSecondEmitter->Id().Name()
<< " as SecondNucleonEmitter for nuclear model " << nucl_model_name;
}else{
LOG("FermiMover", pWARN)
<< "No SecondNucleonEmitter for nuclear model "
<< nucl_model_name << " -- SRC recoil disabled";
}
@CarlosNeutrino CarlosNeutrino requested a review from Copilot July 7, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants