49 opcharge_m(right.opcharge_m),
50 opmass_m(right.opmass_m),
51 opyield_m(right.opyield_m),
103 double rbunch_max = std::hypot(xmax, ymax);
105 if (rbunch_max >
rmin_m - 1
e-2) {
113 bool flagNeedUpdate =
false;
120 for (
unsigned int i = 0; i < tempnum; ++i) {
126 if (pflag == 0)
continue;
129 double dist1 = (
A_m * bunch->
R[i](0) +
B_m * bunch->
R[i](1) +
C_m) /
R_m;
130 double dist2 = dist1 *
std::sqrt(1.0 + 1.0 / tangle / tangle);
134 strippoint(2) = bunch->
R[i](2);
136 strippoint, bunch->
P[i],
137 t+dt, bunch->
Q[i], bunch->
M[i]),
138 std::make_pair(turnnumber, bunch->
bunchNum[i]));
140 flagNeedUpdate =
true;
147 if (bunch->
ID[i] == 0)
159 size_t index = tempnum + count;
160 bunch->
R[index] = bunch->
R[i];
161 bunch->
P[index] = bunch->
P[i];
162 bunch->
Q[index] = bunch->
Q[i];
163 bunch->
M[index] = bunch->
M[i];
167 bunch->
Bin[index] = bunch->
Bin[i];
174 return flagNeedUpdate;
188 return flagNeedUpdate;
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
Tps< T > sqrt(const Tps< T > &x)
Square root.
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & level4(Inform &inf)
Inform & endl(Inform &inf)
constexpr double q_e
The elementary charge in As.
constexpr double e
The value of.
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.