Skip to content

Comments

Add CutGaussian distribution type#1312

Open
cemitch99 wants to merge 11 commits intoBLAST-ImpactX:developmentfrom
cemitch99:add_gaussian_cut
Open

Add CutGaussian distribution type#1312
cemitch99 wants to merge 11 commits intoBLAST-ImpactX:developmentfrom
cemitch99:add_gaussian_cut

Conversation

@cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Feb 20, 2026

This PR adds a new initial particle distribution type, CutGaussian, that is similar to a 6D Gaussian, but it allows the user to specify an independent cutoff in each phase plane (x,px), (y,py), and (t,pt). The cut is performed in normalized Courant-Snyder variables corresponding to the user-supplied second moments or Twiss functions. As a result, this is equivalent to a cut corresponding to the (linearized) action in each plane.

  • implement distribution type and sampling algorithm
  • add initialization of parameters from user input
  • update Python bindings
  • add benchmark example
  • update documentation

If the user would like to apply a circular or elliptical cut in the (x,y) plane, this is more appropriately done using the Aperture element, which represents the effect of a transverse mask.

The PR addresses Issue #1253

Comment on lines +124 to +129
// factors determined by the first cutoff value:
f = m_cutX*m_cutX/2.0_prt;
ef = std::exp(-f);
r2scale = 1_prt - f*ef/(1_prt - ef);
r2 = -2_prt * std::log(1_prt - u1*(1_prt - ef));
ln1 = std::sqrt(r2 / r2scale);
Copy link
Member Author

Choose a reason for hiding this comment

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

These lines (and the corresponding lines in the code blocks below) define the effect of the cutoff. As cutX -> infinity, this reduces to the Box-Mueller transformation defining the parameter ln1 that appears in Gaussian.H.

@cemitch99 cemitch99 requested a review from ax3l February 20, 2026 23:14
@cemitch99 cemitch99 added enhancement New feature or request component: distributions beam distributions labels Feb 20, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 21, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing cemitch99:add_gaussian_cut (82e3119) with development (dbca50d)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: distributions beam distributions enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant