Skip to content

Commit bca1596

Browse files
committed
Improve handling of vchamber shapes
1 parent c49edd3 commit bca1596

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

VERSION

-1
This file was deleted.

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./python_package/trackcpp/VERSION

include/trackcpp/tracking.h

+10-12
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ Status::type track_linepass (
156156

157157
for(int i=0; i<nr_elements; ++i) {
158158

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];
160161

161162
// stores trajectory at entrance of each element
162163
if (indcs[i]) pos.push_back(orig_pos);
@@ -167,7 +168,6 @@ Status::type track_linepass (
167168
const T& ry = orig_pos.ry;
168169

169170
// checks if particle is lost
170-
171171
if (not isfinite(rx)) {
172172
lost_plane = Plane::x;
173173
status = Status::particle_lost;
@@ -181,7 +181,12 @@ Status::type track_linepass (
181181
}
182182
}
183183
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) {
185190
// rectangular vacuum chamber
186191
if (((rx < element.hmin) or (rx > element.hmax))) {
187192
lost_plane = Plane::x;
@@ -195,15 +200,8 @@ Status::type track_linepass (
195200
lost_plane = Plane::xy;
196201
}
197202
}
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
207205
lost_plane = Plane::xy;
208206
status = Status::particle_lost;
209207
}

0 commit comments

Comments
 (0)