Commit 7fddfa2
Parse multipole field parameters through getG4Number to honor units
get_field_parameter_double used bare std::stod, which silently truncates
unit expressions: stod("30*deg") returns 30.0 and drops "*deg". So
multipole/dipole parameters written the documented way (vx/vy/vz as
"10*cm", rotation_angle as "30*deg", strength as "2*tesla") were
interpreted in raw internal units, producing fields with the wrong
magnitude, position, and rotation — silently, with no error.
Route the double accessor through gutilities::getG4Number, which parses
unit expressions (minimum_step in gfield_options.cc already uses it).
get_field_parameter_int stays on stoi: its only consumer is pole_number,
a unitless count.
Fixes #107
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 48f83e5 commit 7fddfa2
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
0 commit comments