feat(r3bgen): Add method to select only p2p and ppn reactions in the …#1331
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds additional event-selection modes to the INCL ROOT generator so simulations can be restricted to specific spallation reaction topologies (p2p and ppn), complementing existing “only fission/spallation/p2p-fission/fragments” filters.
Changes:
- Add public setters to enable “only p2p-spallation” and “only ppn-spallation” filtering.
- Implement corresponding event-selection logic in
ReadEventbased onoriginand outgoing nucleon PDG codes. - Extend generator state with new boolean flags to support the new modes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| r3bgen/R3BINCLRootGenerator.h | Adds two new public setter methods and two new internal flags for p2p-/ppn-spallation filtering. |
| r3bgen/R3BINCLRootGenerator.cxx | Adds two new ReadEvent filter branches implementing the p2p-/ppn-spallation event selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…INCL generator. fix(r3bgen): Allow for non-QF p2p selection. fix(r3bgen): Add copilot suggestions.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
r3bgen/R3BINCLRootGenerator.cxx:193
- The end-of-file guard
if (fEvt >= fEvtRoot)is evaluated afterTree->GetEntry(fEvt)and can also be skipped entirely due to the newcontinue;paths afterfEvt++. This can result in callingGetEntry()with an out-of-range index (e.g., whenfEvtbecomesfEvtRoot) and potentially looping forever / using stale branch data. Consider moving the bounds check to the top of thewhileloop (beforeGetEntry) and/or checking immediately after eachfEvt++beforecontinue.
if (fEvt >= fEvtRoot)
{
LOG(error)
<< "\033[5m\033[31m R3BINCLRootGenerator: Number of simulated events larger than the ones contained "
"in the Root file \033[0m ";
LOG(warn)
<< "\033[5m\033[33m R3BINCLRootGenerator: Please, provide a new Root file with more events \033[0m ";
return kTRUE;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bool fOnlyPpnSpallation = false; // True if we want to simulate only ppn-spallation events | ||
| bool fOnlySpallation = false; // True if we want to simulate only spallation events | ||
| bool fOnlyFragments = false; // True if we want to simulate only fragments | ||
| int fPdgCodeMin = 1000050070; // Limit in Boro-7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…INCL generator.
Checklist:
devbranch