58 opcharge_m(right.opcharge_m),
59 opmass_m(right.opmass_m),
60 opyield_m(right.opyield_m),
110 double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
111 double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
112 double rbunch_max = std::hypot(xmax, ymax);
114 if (rbunch_max >
rmin_m - 1e-2) {
122 bool flagNeedUpdate =
false;
128 for (
unsigned int i = 0; i < tempnum; ++i) {
131 if (bunch->
Bin[i] < 0)
continue;
136 if (pflag == 0)
continue;
139 double dist1 = (
A_m * bunch->
R[i](0) +
B_m * bunch->
R[i](1) +
C_m) /
R_m;
140 double dist2 = dist1 * std::sqrt(1.0 + 1.0 / tangle / tangle);
141 double dt = dist2 / (std::sqrt(1.0 - 1.0 / (1.0 +
dot(bunch->
P[i], bunch->
P[i]))) *
Physics::c);
144 strippoint(2) = bunch->
R[i](2);
146 strippoint, bunch->
P[i],
147 t+dt, bunch->
Q[i], bunch->
M[i]),
148 std::make_pair(turnnumber, bunch->
bunchNum[i]));
150 flagNeedUpdate =
true;
157 if (bunch->
ID[i] == 0)
169 size_t index = tempnum + count;
170 bunch->
R[index] = bunch->
R[i];
171 bunch->
P[index] = bunch->
P[i];
172 bunch->
Q[index] = bunch->
Q[i];
173 bunch->
M[index] = bunch->
M[i];
177 bunch->
Bin[index] = bunch->
Bin[i];
184 return flagNeedUpdate;
198 return flagNeedUpdate;
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
Inform & level4(Inform &inf)
Inform & endl(Inform &inf)
constexpr double q_e
The elementary charge in As.
constexpr double c
The velocity of light in m/s.
ParticleAttrib< int > Bin
ParticleOrigin getPOrigin() const
void get_bounds(Vector_t &rmin, Vector_t &rmax) const
size_t getLocalNum() const
ParticleAttrib< double > M
ParticleAttrib< Vector_t > P
ParticleAttrib< ParticleOrigin > POrigin
ParticleAttrib< double > Q
void setPOrigin(ParticleOrigin)
ParticleAttrib< short > bunchNum
virtual void visitStripper(const Stripper &)=0
Apply the algorithm to a particle stripper.
virtual const std::string & getName() const
Get element name.
int checkPoint(const double &x, const double &y) const
Checks if coordinate is within element.
double C_m
Geometric lengths used in calculations.
void changeWidth(PartBunchBase< double, 3 > *bunch, int i, const double tstep, const double tangle)
Change probe width depending on step size and angle of particle.
double calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
double rmin_m
radius closest to the origin
double opcharge_m
Charge number of the out-coming particle.
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
void setOPCharge(double charge)
Member variable access.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Stripper.
double getOPCharge() const
void setStop(bool stopflag)
void setOPYield(double yield)
void setOPMass(double mass)
double opmass_m
Mass of the out-coming particle.
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
double getOPYield() const
double opyield_m
Yield of the out-coming particle.
virtual void doFinalise() override
Virtual hook for finalise.
bool stop_m
Flag if particles should be stripped or stopped.
virtual ElementType getType() const override
Override implementation of PluginElement.
virtual bool doFinaliseCheck(PartBunchBase< double, 3 > *bunch, bool flagNeedUpdate) override
Virtual hook for finaliseCheck.