Setting the SecondNucleonEmitter at run-time and enabling SRC in CC-QEL interactions#506
Setting the SecondNucleonEmitter at run-time and enabling SRC in CC-QEL interactions#506CarlosNeutrino wants to merge 10 commits into
Conversation
…rithm is decided at run time instead of directly from the FermiMover.xml file. This avoids that the SecondNucleonEjection and NuclearModel could be incompatible
There was a problem hiding this comment.
Pull request overview
This pull request makes the SRC SecondNucleonEmitter selection depend on the globally configured NuclearModel at runtime (instead of being fixed purely by per-algorithm XML), and enables SecondNucleonEmitter handling in CC-QEL event generation.
Changes:
- Add runtime mapping logic in
FermiMoverandQELEventGeneratorto choose aSecondNucleonEmissionIimplementation based on the globalNuclearModel. - Extend
config/FermiMover.xmlandconfig/QELEventGenerator.xmlwithNuclearModels/SecondNucleonEmittersstring lists to define the mapping. - Invoke
SecondNucleonEmissionI::ProcessEventRecord()inQELEventGeneratorbefore creating the remnant nucleus so the remnant accounts for a possible second nucleon.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Physics/QuasiElastic/EventGen/QELEventGenerator.h | Adds SecondNucleonEmitter state and mapping container. |
| src/Physics/QuasiElastic/EventGen/QELEventGenerator.cxx | Selects SecondNucleonEmitter at runtime from global NuclearModel and applies it during event record processing. |
| src/Physics/NuclearState/FermiMover.h | Adds mapping container for NuclearModel → SecondNucleonEmitter. |
| src/Physics/NuclearState/FermiMover.cxx | Selects SecondNucleonEmitter at runtime from global NuclearModel (replacing fixed sub-alg selection). |
| config/QELEventGenerator.xml | Adds NuclearModel/SecondNucleonEmitter mapping strings for QEL generator config. |
| config/FermiMover.xml | Adds NuclearModel/SecondNucleonEmitter mapping strings for FermiMover config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8028184 to
b760f0d
Compare
| <param_set name="Default"> | ||
| <param type="bool" name="KeepHitNuclOnMassShell"> false </param> | ||
| <param type="alg" name="SecondNucleonEmitter"> genie::SpectralFunction2p2h/Default </param> | ||
| <param type="bool" name="KeepHitNuclOnMassShell"> false </param> |
There was a problem hiding this comment.
Extra indentation... Not the end of the world but worth pointing out.
|
|
||
| <!-- Possible SecondNucleonEmitters for every different NuclearModel --> | ||
| <param type="string" name="NuclearModels">genie::LocalFGM;genie::FGMBodekRitchie;genie::EffectiveSF</param> | ||
| <param type="string" name="SecondNucleonEmitters">genie::SRCNuclearRecoil/Default;genie::SRCNuclearRecoil/Default;genie::SpectralFunction2p2h/Default</param> |
There was a problem hiding this comment.
Just to point out some GENIE functionality here: you can use <param type="vec-string" name="SecondNuclearEmitters" delim=";"> and access the values as a std::vector using Algorithm::GetParamVect - see config/QELEventGeneratorSM.xml and src/Physics/QuasiElastic/EventGen/QELEventGeneratorSM.cxx::LoadConfig()
kjplows
left a comment
There was a problem hiding this comment.
Overall looks good, thank you @CarlosNeutrino ! Requesting changes for the following:
GetParamVectandvec-stringwhere possible- We should discuss making the silent
continuestatement on second-nucleon-emission load a proper Exception.
| assert(fSecondEmitter); | ||
| // Build nuclear-model algorithm name -> SecondNucleonEmitter algorithm, | ||
| std::string nucl_model_names_str, fermi_mover_algids_str; | ||
| this->GetParam("NuclearModels", nucl_model_names_str); |
There was a problem hiding this comment.
See comment on the config about loading these directly into std::vector<std::string> 🙂
(also saves you from including StringUtils.h)
| const SecondNucleonEmissionI * emitter = | ||
| dynamic_cast<const SecondNucleonEmissionI *>(alg); | ||
| if (!emitter) { | ||
| LOG("FermiMover", pWARN) |
There was a problem hiding this comment.
I would argue making this an exception, rather than a silent continue. If this statement triggers it's either a misconfiguration or a bad runtime load, both should trigger warnings and interrupt execution. Happy to defer to @sjgardiner or @nusense on this.
| this->GetParam("NuclearModels", nucl_model_names_str); | ||
| this->GetParam("SecondNucleonEmitters", fermi_mover_algids_str); | ||
|
|
||
| std::vector<std::string> nucl_model_names = genie::utils::str::Split(nucl_model_names_str, ";"); |
There was a problem hiding this comment.
Same comment as above, you can avoid this with GetParamVect
| LOG("QELEvent", pWARN) | ||
| << "No SecondNucleonEmitter for nuclear model " | ||
| << nucl_model_name << " -- SRC recoil disabled"; | ||
| } |
There was a problem hiding this comment.
(This is not so much directed at this PR but applies anyway) - not a huge fan of duplicating code, but given QELEventGenerator contains duplicate code anyway, this is at least consistent. Maintenance caveat: any PRs targeting SecondNucleonEmitter have to be done in two locations in code.
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):
Development
Notes for reviewers