Commit 60b4de13 authored by snuverink_j's avatar snuverink_j
Browse files

implement fix of 955a6f6d for probe, stripper and septum, for #253

parent 955a6f6d
......@@ -179,10 +179,15 @@ bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, co
bool flagprobed = false;
Vector_t rmin, rmax, probepoint;
bunch->get_bounds(rmin, rmax);
double r1 = sqrt(rmax(0) * rmax(0) + rmax(1) * rmax(1));
double r2 = sqrt(rmin(0) * rmin(0) + rmin(1) * rmin(1));
if( r1 > rstart_m - 10.0 && r2 < rend_m + 10.0 ) {
// interested in absolute minimum and maximum
double xmin = std::min(std::abs(rmin(0)), std::abs(rmax(0)));
double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
double ymin = std::min(std::abs(rmin(1)), std::abs(rmax(1)));
double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
double rbunch_min = std::hypot(xmin, ymin);
double rbunch_max = std::hypot(xmax, ymax);
if( rbunch_max > rstart_m - 10.0 && rbunch_min < rend_m + 10.0 ) {
size_t tempnum = bunch->getLocalNum();
int pflag = 0;
......
......@@ -129,8 +129,12 @@ bool Septum::checkSeptum(PartBunchBase<double, 3> *bunch) {
Vector_t rmin;
Vector_t rmax;
bunch->get_bounds(rmin, rmax);
double r1 = sqrt(rmax(0) * rmax(0) + rmax(1) * rmax(1));
if(r1 > rstart_m - 100) {
// interested in absolute maximum
double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
double rbunch_max = std::hypot(xmax, ymax);
if(rbunch_max > rstart_m - 100) {
for(unsigned int i = 0; i < bunch->getLocalNum(); ++i) {
Vector_t R = bunch->R[i];
double slope = (yend_m - ystart_m) / (xend_m - xstart_m);
......
......@@ -213,10 +213,12 @@ bool Stripper::checkStripper(PartBunchBase<double, 3> *bunch, const int turnnum
bool flagNeedUpdate = false;
bool flagresetMQ = false;
Vector_t rmin, rmax, strippoint;
bunch->get_bounds(rmin, rmax);
double r1 = sqrt(rmax(0) * rmax(0) + rmax(1) * rmax(1));
// interested in absolute maximum
double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
double rbunch_max = std::hypot(xmax, ymax);
if(r1 > rstart_m - 10.0 ){
if(rbunch_max > rstart_m - 10.0 ){
size_t count = 0;
size_t tempnum = bunch->getLocalNum();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment