Skip to content

feat(r3bgen): Add method to select only p2p and ppn reactions in the …#1331

Merged
jose-luis-rs merged 1 commit into
R3BRootGroup:devfrom
pgrusell:p2p_incl_sel
Mar 18, 2026
Merged

feat(r3bgen): Add method to select only p2p and ppn reactions in the …#1331
jose-luis-rs merged 1 commit into
R3BRootGroup:devfrom
pgrusell:p2p_incl_sel

Conversation

@pgrusell
Copy link
Copy Markdown
Contributor

@pgrusell pgrusell commented Mar 5, 2026

…INCL generator.


Checklist:

Copilot AI review requested due to automatic review settings March 5, 2026 11:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ReadEvent based on origin and 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.

Comment thread r3bgen/R3BINCLRootGenerator.cxx
Comment thread r3bgen/R3BINCLRootGenerator.cxx
Comment thread r3bgen/R3BINCLRootGenerator.cxx
Comment thread r3bgen/R3BINCLRootGenerator.cxx
…INCL generator.

fix(r3bgen): Allow for non-QF p2p selection.

fix(r3bgen): Add copilot suggestions.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 after Tree->GetEntry(fEvt) and can also be skipped entirely due to the new continue; paths after fEvt++. This can result in calling GetEntry() with an out-of-range index (e.g., when fEvt becomes fEvtRoot) and potentially looping forever / using stale branch data. Consider moving the bounds check to the top of the while loop (before GetEntry) and/or checking immediately after each fEvt++ before continue.
        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.

Comment thread r3bgen/R3BINCLRootGenerator.cxx
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
@jose-luis-rs jose-luis-rs merged commit 4b2ebd7 into R3BRootGroup:dev Mar 18, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants