Commit f3d1060a authored by ext-calvo_p's avatar ext-calvo_p
Browse files

Merge branch '643-remove-unnecessary-condition-in-ccollimators' into 'master'

Resolve "Remove unnecessary condition in CCollimators"

Closes #643

See merge request !483
parents 7943d7e0 8cd63ddd
...@@ -82,16 +82,17 @@ bool CCollimator::doCheck(PartBunchBase<double, 3> *bunch, const int turnnumber, ...@@ -82,16 +82,17 @@ bool CCollimator::doCheck(PartBunchBase<double, 3> *bunch, const int turnnumber,
int pflag = 0; int pflag = 0;
// now check each particle in bunch // now check each particle in bunch
for (unsigned int i = 0; i < tempnum; ++i) { for (unsigned int i = 0; i < tempnum; ++i) {
if (bunch->POrigin[i] == ParticleOrigin::REGULAR && bunch->R[i](2) < zend_m && bunch->R[i](2) > zstart_m ) { if (bunch->R[i](2) < zend_m && bunch->R[i](2) > zstart_m ) {
// only now careful check in r // only now careful check in r
pflag = checkPoint(bunch->R[i](0), bunch->R[i](1)); pflag = checkPoint(bunch->R[i](0), bunch->R[i](1));
/// bunch->Bin[i] != -1 makes sure the particle is not stored in more than one collimator /// bunch->Bin[i] != -1 makes sure the particle is not stored in more than one collimator
if ((pflag != 0) && (bunch->Bin[i] != -1)) { if ((pflag != 0) && (bunch->Bin[i] != -1)) {
if (!parmatint_m) if (!parmatint_m) {
lossDs_m->addParticle(OpalParticle(bunch->ID[i], lossDs_m->addParticle(OpalParticle(bunch->ID[i],
bunch->R[i], bunch->P[i], bunch->R[i], bunch->P[i],
t, bunch->Q[i], bunch->M[i]), t, bunch->Q[i], bunch->M[i]),
std::make_pair(turnnumber, bunch->bunchNum[i])); std::make_pair(turnnumber, bunch->bunchNum[i]));
}
bunch->Bin[i] = -1; bunch->Bin[i] = -1;
flagNeedUpdate = true; flagNeedUpdate = true;
} }
...@@ -148,7 +149,7 @@ void CCollimator::setDimensions(double xstart, double xend, double ystart, doubl ...@@ -148,7 +149,7 @@ void CCollimator::setDimensions(double xstart, double xend, double ystart, doubl
zend_m = zend; zend_m = zend;
width_m = width; width_m = width;
// zstart and zend are independent from x, y // zstart and zend are independent from x, y
if (zstart_m > zend_m){ if (zstart_m > zend_m) {
std::swap(zstart_m, zend_m); std::swap(zstart_m, zend_m);
} }
setGeom(width_m); setGeom(width_m);
......
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