23 opcharge_m(right.opcharge_m),
24 opmass_m(right.opmass_m),
25 opyield_m(right.opyield_m),
36 *gmsg <<
"* Finalize stripper " <<
getName() <<
endl;
77 double rbunch_max = std::hypot(xmax, ymax);
79 if(rbunch_max >
rmin_m - 10.0) {
87 bool flagNeedUpdate =
false;
94 for(
unsigned int i = 0; i < tempnum; ++i) {
100 if(pflag == 0)
continue;
103 double dist1 = (
A_m * bunch->
R[i](0) +
B_m * bunch->
R[i](1) +
C_m) /
R_m * 1.0
e-3;
104 double dist2 = dist1 *
sqrt(1.0 + 1.0 / tangle / tangle);
105 double dt = dist2 / (
sqrt(1.0 - 1.0 / (1.0 +
dot(bunch->
P[i], bunch->
P[i]))) *
Physics::c) * 1.0e9;
107 strippoint(1) = (
A_m *
A_m * bunch->
R[i](1) -
A_m *
B_m* bunch->
R[i](0) -
B_m *
C_m) / (R_m * R_m);
108 strippoint(2) = bunch->
R[i](2);
109 strippoint = strippoint*0.001;
110 lossDs_m->addParticle(strippoint, bunch->
P[i], bunch->
ID[i], t+dt,
113 flagNeedUpdate =
true;
120 if(bunch->
ID[i] == 0)
132 size_t index = tempnum + count;
133 bunch->
R[index] = bunch->
R[i];
134 bunch->
P[index] = bunch->
P[i];
135 bunch->
Q[index] = bunch->
Q[i];
136 bunch->
M[index] = bunch->
M[i];
140 bunch->
Bin[index] = bunch->
Bin[i];
147 return flagNeedUpdate;
161 return flagNeedUpdate;
ParticleAttrib< Vector_t > P
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
double opyield_m
Yield of the out-coming particle.
void setOPCharge(double charge)
Member variable access.
constexpr double e
The value of .
void setPType(ParticleType::type)
double calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
ParticleType::type getPType() const
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
ParticleAttrib< double > Q
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
double C_m
Geometric lengths used in calculations.
virtual bool doFinaliseCheck(PartBunchBase< double, 3 > *bunch, bool flagNeedUpdate) override
Virtual hook for finaliseCheck.
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
virtual const std::string & getName() const
Get element name.
ParticleAttrib< short > bunchNum
void setOPYield(double yield)
Inform & level4(Inform &inf)
double rmin_m
radius closest to the origin
void setStop(bool stopflag)
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
double opmass_m
Mass of the out-coming particle.
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 opcharge_m
Charge number of the out-coming particle.
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
void setOPMass(double mass)
ParticleAttrib< short > PType
virtual void visitStripper(const Stripper &)=0
Apply the algorithm to a particle stripper.
virtual void doFinalise() override
Virtual hook for finalise.
constexpr double c
The velocity of light in m/s.
double getOPYield() const
virtual ElementBase::ElementType getType() const override
Override implementation of PluginElement.
size_t getLocalNum() const
Tps< T > sqrt(const Tps< T > &x)
Square root.
bool stop_m
Flag if particles should be stripped or stopped.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Stripper.
constexpr double q_e
The elementary charge in As.
ParticleAttrib< int > Bin
ParticleAttrib< double > M
void get_bounds(Vector_t &rmin, Vector_t &rmax)
int checkPoint(const double &x, const double &y) const
Checks if coordinate is within element.
double getOPCharge() const
Inform & endl(Inform &inf)