Skip to content

Conversation

@kmichalikk
Copy link
Contributor

This PR reorganizes fields in Beam configuration panel to be more logical with options depending on each other from top to bottom. It adds a toggle between MeV and MeV/nucl units that change depending on particle selected, and automatically update specified energies. It also adds Heavy Ions to Geant4, but it needs converter update to work.

@kmichalikk kmichalikk self-assigned this Nov 2, 2025
@grzanka grzanka requested a review from Copilot November 2, 2025 14:26
Copy link
Contributor

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

This PR refactors the particle type handling to use a unified Particle interface instead of the separate ParticleType interface, adds mass number (a) and charge (z) properties to particle definitions, and introduces dynamic energy unit conversion functionality (MeV vs MeV/nucl) based on particle properties.

Key changes:

  • Consolidates particle type definitions into a single Particle interface with optional a and z properties
  • Adds mass and charge data to specific particle types (Neutron, Proton, Deuteron, Triton, Helium-3, Helium-4, Alpha, 12C, Heavy ions)
  • Implements dynamic energy unit conversion with a toggle between MeV and MeV/nucl based on particle mass number

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/types/Particle.ts Converts Particle from type to interface, adds optional a and z properties, populates mass/charge data for nuclear particles, removes import of deprecated ParticleType
src/ThreeEditor/components/Sidebar/properties/category/BeamConfiguration.tsx Implements energy unit state management and conversion, reorders UI components, adds toggle for energy units, updates particle selection to use full particle data
src/ThreeEditor/components/Select/ParticleSelect.tsx Removes local ParticleType interface in favor of importing Particle from central types
src/ThreeEditor/Simulation/Scoring/ParticleFilter.ts Updates to use Particle type with Omit<Particle, 'massNumber'> constraint
src/ThreeEditor/Simulation/Scoring/GeantScoringFilter.ts Updates import to use Particle instead of ParticleType
src/ThreeEditor/Simulation/Physics/Beam.ts Simplifies particle data type from inline definition to Particle interface, removes formatting issue in import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka
Copy link
Contributor

grzanka commented Nov 3, 2025

The only unit for proton, neutron, should be MeV (like for photon).

image

Default units for heavy ion should be MeV/nucl

image

Can you also prefill heavy ion input Z and A with that of 12C ? (A=12, Z=6) ? That is the most popular heavy ion.

There is also a lot of comments from copilot

@grzanka
Copy link
Contributor

grzanka commented Nov 3, 2025

image image

Am I correct that converter still needs to be fixed ?

For alpha particle when I specify energy of 4 MeV/nucl, I would expect to see 16 MeV in the input macro file.

@kmichalikk
Copy link
Contributor Author

kmichalikk commented Nov 3, 2025

I believe everything should be fixed by 9424d3e
When switching from proton (MeV) to alpha (MeV/nucl) I tried to keep total MeV constant, when switching between particles that both have MeV/nucl, I keep this unit constant which changes total MeV, which then makes going back to proton show different MeV that initially, but I don't have a better solution

And yes, converter needs to follow with separate PR

@grzanka grzanka requested a review from Copilot November 4, 2025 08:45
Copy link
Contributor

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 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka grzanka requested a review from Copilot November 9, 2025 13:29
Copy link
Contributor

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 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka grzanka requested a review from Copilot November 9, 2025 19:59
Copy link
Contributor

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 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka grzanka added this pull request to the merge queue Nov 9, 2025
Merged via the queue into master with commit 089c102 Nov 9, 2025
11 checks passed
@grzanka grzanka deleted the @kmichalikk/energy-units branch November 9, 2025 21:27
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