bmad-sim / BeamTracking.jl

Julia routines for tracking particle beams through accelerators
Other
0 stars 2 forks source link

Standardize aperture function API #21

Open DavidSagan opened 1 week ago

DavidSagan commented 1 week ago

Generally the different tracking methods will be using the same aperture function(s) so there needs to be a standardized API for this. Something like:

function aperture(ele::Ele, particle_coords::??)

Another issue is in what package the aperture funciton should live. Putting it in BeamTracking.jl would tie the aperture calculation to the element tracking which makes things less flexible.

mattsignorelli commented 1 week ago

What is aperture doing? calculating the dynamic aperture?

DavidSagan commented 1 week ago

No. This is a calculation of whether a particle has hit an aperture. This function will potentially be called for each lattice element during tracking.

mattsignorelli commented 1 week ago

Ah, ok. One idea I have is that for elements that have an aperture specified, the low-level tracking lattice that we produce inserts an aperture element after said elements and checks the particle coordinates. This is the simplest and most elegant way in my opinion, however this would of course not work in the case when an aperture is reached internally before finishing traversal of the element.

DavidSagan commented 1 week ago

The case where there are apertures that are not at an element end are a special case which I don't think we need to worry about just now.

mattsignorelli commented 1 week ago

Then I think, just as all misalignments would be patches at the lower-level, all apertures would be aperture elements placed after each element at the low-level. Then when you have a Vector{LowLevelEle} it is handled automatically by the MD

DavidSagan commented 1 week ago

Yes this sounds reasonable but an API is still needed.

DavidSagan commented 1 week ago

Note: An element will have a misalignment_moves_aperture bool that with determine the relative order of the patches with respect to the aperture checking.