Repository navigation
McXtrace Mirror_curved: follow-up to #2936 (miss handling, instrument repairs, new targets) - #2941
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ROTATED needs deg The [rad] grazing angle (4.1 / 4 mrad) was passed directly to ROTATED, which takes degrees, so the KB mirrors were tilted by ~0.07 mrad and the beam landed 0.4-0.7 m off the mirror centre. The old Mirror_curved bounds check hid this by accepting hits beyond the mirror. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ABSORB wins
RESTORE_XRAY makes the runtime call particle_restore() after TRACE and
EXTEND, and that clears ABSORBED. An instrument's
EXTEND %{ if (!SCATTERED) ABSORB; %} was therefore cancelled for every
ray the mirror rejected, and those rays continued unreflected (61% of
the beam after SOLEIL_SAMBA M1). Put x, y, z, t, phi back by hand
instead; the ray state on a miss is unchanged, but absorption in EXTEND
now holds.
Results are unchanged for instruments without such an EXTEND block
(Test_Mirrors, MAXIV_Bloch, SOLEIL_DISCO identical to the digit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DCM Bragg angle in Template_DCM and the SOLEIL beamlines copied from it used a = 5.4909 AA, a typo for silicon's 5.4309 AA (the value Bragg_crystal itself uses via V=160.1826 AA^3). The monochromators were set for a d-spacing 1.1% too large, i.e. detuned by ~1.4 mrad at 15 keV, outside a 0.1 keV source band. Numerical change: DCM throughput of all these instruments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- M1/M2 radii used the angle while still in mrad as if in degrees (R=535 m instead of 9333 m), so M1 did not collimate. - The M1/M2 takeoff arms were rotated by the grazing angle; the reflected beam leaves at twice that, so the DCM axis was 3 mrad off the beam. With the Si lattice fix, the DCM now passes the collimated beam (2.8e11 vs 2.6e10) and both mirrors are centred on the beam. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l deflection mirror - M1 radius was a placeholder 1000 m; use the collimating radius 2*14 m/sin(theta) like SOLEIL_SAMBA (9333 m), as the DCM comment intends. - M1 and deflection-mirror takeoff arms were rotated by the grazing angle; the reflected beam leaves at twice that. - The deflection Mirror was given yheight, which puts it in the YZ plane, while it is tilted about x as a horizontal mirror: the beam ran parallel to it and was all absorbed. Use zdepth (same 5 cm length). Note: a 5 cm mirror at 2 mrad only accepts ~0.1 mm of beam height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g angle With the narrow source band, the kinematic angle only passed rays ~28 urad off axis, so the beam landed 0.5 mm low and off the 0.3 m flat mirrors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…B VFM - The angles are total deflections; the radii used sin(deflection), not sin(grazing angle), so all three mirrors were bent twice too much. - Mirror_curved deflects in its XZ plane, so the pitched KB VFM did not reflect at all. Roll it by -90 deg (concave side) to focus vertically. - Drop the hand-tuned sample offset that compensated for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d example - As in PX1/SWING, the [rad] grazing angle went straight into ROTATED. - With a real 4 mrad tilt the pre-focusing Mirror_toroid must be pitched the other way (it is hit from +y), and its takeoff follows the reflection. - Re-centre the sample stage on the beam after the KB. - The %Example used unknown parameters (sample=, PX2a_SPLITs=) and had no Detector: label, so it never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x and instrument repairs Inverse-variance weighted mean of 3 x n (seeds 1001, 2002, 3003) and 1 x 10n (seed 4004, capped at 3e7), using this branch's components. Only targets that moved by more than 5% are changed. The large jumps (GALAXIES, SWING, SAMBA, SIRIUS, PX1) come from the Si lattice constant and mirror alignment fixes, which put the DCMs at Bragg and the beams on the mirrors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The KB now focuses onto the 0.5 mm sample monitor, and a few high-weight rays dominate: 1e6 runs scatter by 12% (CI got 121% of the weighted target, which the lowest seed had pulled down). At 1e7 four seeds give 1.12-1.35e11; the target is their mean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #2936. This branch contains antoinepado's commit from #2936 (f9f20b0) and adds the style fixes, the instrument repairs and the new
%Exampletargets announced in the review there. Merging this PR also merges #2936.Component:
Mirror_curvedif (dl != 0)block (style only).RESTORE_XRAY. In 3.x, RESTORE only sets a flag, and the restore after TRACE+EXTEND clearsABSORBED. That makes an instrument'sEXTEND %{ if (!SCATTERED) ABSORB; %}a no-op for missed rays: about 61% of the rays went straight through the XFEL_SPB KB mirrors. The code generator is unchanged. The general problem is tracked in [BUG]: McXtrace: code written for 2.x in-place RESTORE_XRAY; EXTEND 'if (!SCATTERED) ABSORB' is a no-op for restored rays #2940 (McXtrace) and [BUG]: McStas: code written for 2.x in-place RESTORE_NEUTRON; an ABSORB after RESTORE is cancelled in 3.x #2939 (McStas).Instruments (they relied on the old, too-long mirror)
[rad]grazing angle was passed straight toROTATED, which takes degrees. In PX2a, the now really tilted pre-focusingMirror_toroidmust be pitched the other way, and its takeoff and the sample stage follow. PX2a's%Examplealso used unknown parameters (sample=,PX2a_SPLITs=) and had noDetector:, so it never ran.I checked every mirror's footprint (fraction of the beam inside the mirror, and its centring). DISCO, NANOSCOPIUM, XFEL_SPB and MAXIV_Bloch are aligned; their changes come from the component fix itself.
%Exampletargets (changes simulation results)Inverse-variance weighted mean of 3 × n (seeds 1001, 2002, 3003) and 1 × 10n (seed 4004, capped at 3e7), using this branch's components. Only targets that moved by more than 5% are changed:
-n 1e7)Test_Mirrors(all 19 examples), MAXII_711/811, FemtoMAX, JJ_SAXS, CASSIOPEE, MARS, PSICHE, LUCIA and Template_DCM still agree within 5% and are unchanged.Correction to my review on #2936: the MARS, ROCK and DISCO targets on main are not far off. My earlier runs used an installed Bending_magnet older than the flux fix in #2902.
Testing
🤖 Generated with Claude Code