@@ -156,7 +156,8 @@ Status::type track_linepass (
156
156
157
157
for (int i=0 ; i<nr_elements; ++i) {
158
158
159
- const Element& element = line[element_offset]; // syntactic-sugar for read-only access to element object parameters
159
+ // syntactic-sugar for read-only access to element object parameters
160
+ const Element& element = line[element_offset];
160
161
161
162
// stores trajectory at entrance of each element
162
163
if (indcs[i]) pos.push_back (orig_pos);
@@ -167,7 +168,6 @@ Status::type track_linepass (
167
168
const T& ry = orig_pos.ry ;
168
169
169
170
// checks if particle is lost
170
-
171
171
if (not isfinite (rx)) {
172
172
lost_plane = Plane::x;
173
173
status = Status::particle_lost;
@@ -181,7 +181,12 @@ Status::type track_linepass (
181
181
}
182
182
}
183
183
if ((status != Status::particle_lost) and accelerator.vchamber_on ) {
184
- if (element.vchamber == VChamberShape::rectangle) {
184
+ if (element.vchamber < 0 ) {
185
+ // invalid p-norm shape (negative p)
186
+ // safely signals lost particle
187
+ lost_plane = Plane::xy;
188
+ status = Status::particle_lost;
189
+ } else if (element.vchamber == VChamberShape::rectangle) {
185
190
// rectangular vacuum chamber
186
191
if (((rx < element.hmin ) or (rx > element.hmax ))) {
187
192
lost_plane = Plane::x;
@@ -195,15 +200,8 @@ Status::type track_linepass (
195
200
lost_plane = Plane::xy;
196
201
}
197
202
}
198
- } else if (
199
- (element.vchamber == VChamberShape::rhombus) or
200
- (element.vchamber == VChamberShape::ellipse)) {
201
- if (get_norm_amp_in_vchamber (element, rx, ry) > 1 ) {
202
- lost_plane = Plane::xy;
203
- status = Status::particle_lost;
204
- }
205
- } else {
206
- // any other shape not implemented safely signals lost particle
203
+ } else if (get_norm_amp_in_vchamber (element, rx, ry) > 1 ) {
204
+ // lost in rhombus, elliptic and all finite p-norm shapes
207
205
lost_plane = Plane::xy;
208
206
status = Status::particle_lost;
209
207
}
0 commit comments