Skip to content

Luis Branch Geometrical nHits and OpenMP Parallelization - #178

Closed
LRG-1 wants to merge 4 commits into
PyORBIT-Collaboration:mainfrom
LRG-1:luis_new_branch
Closed

LRG-1 wants to merge 4 commits into
PyORBIT-Collaboration:mainfrom
LRG-1:luis_new_branch

Conversation

@LRG-1

@LRG-1 LRG-1 commented Nov 16, 2026

Copy link
Copy Markdown

Ive added changes to the Foil.cc, Foil.hh, warp_foil.hh files according to last python meeting, and I've also reorganized scatter choice conditional statements in the TeapotFoilNode.py track method. 0 Full Scatter, 1 Simple Scatter, 2 or anything else is geometrical scatter.
I rebased changes from the main onto my fork first then add my changes, Please check if those changes where incorporate correctly.

Thanks

@austin-hoover

Copy link
Copy Markdown
Contributor

@LRG-1 is this separate from #164? If so, could you explain what changes you made to /src?

@LRG-1

LRG-1 commented Nov 17, 2026 •

Copy link
Copy Markdown
Author

@LRG-1 is this separate from #164? If so, could you explain what changes you made to /src?

so I based on the python meetings comments Ive made a few changes to the previous request:

first I added parallelization to the geometrical foils scatter method:
int hitsThisPass = 0;

#pragma omp parallel for reduction(+:hitsThisPass) schedule(static)
for (int ip =0; ip < nParts; ++ip){
    //coordinate order: x, xp, y, yp, z, dE
    if (checkFoilFlag(coords[ip][0], coords[ip][2]) == 1){
        ++hitsThisPass;
        }
    }

nHits += hitsThisPass;

Then I made the wrapper just take in one argument the bunch and made the corresponding wrapper changes. in wrap_foil.cc

Then in TeapotFoilNode.py In the Track.py class method I added the conditional statement if scatterchoice = 1 then select simple scatter else choose geometrical scatter. This was not the case before, it would default to simple scatter if the scatterchoice was anything else but 0, and I had a scatter choice = 2 for geometrical scatter, but now that's the else statement if the scatter choice isn't 0 or 1.

Basically it's the same as the other pull request just small changes from the suggestions from Tony and others. Im not sure if I should close the other request or what's the workflow here.

@austin-hoover

Copy link
Copy Markdown
Contributor

I would just do one PR then. You can push new changes to that branch and they will show up on GitHub. You can also update the title or description.

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.

2 participants