23 width_m(right.width_m) {
41 *gmsg <<
"Septum initialise" <<
endl;
60 double rbunch_max = std::hypot(xmax, ymax);
72 const double halfLength =
width_m / 2.0 * std::hypot(slope, 1);
74 const double intcept1 = intcept - halfLength;
75 const double intcept2 = intcept + halfLength;
77 for(
unsigned int i = 0; i < bunch->
getLocalNum(); ++i) {
80 double line1 =
fabs(slope *
R(0) + intcept1);
81 double line2 =
fabs(slope *
R(0) + intcept2);
83 if(
fabs(
R(1)) > line2 &&
90 bunch->
lossDs_m->addParticle(R, bunch->
P[i], bunch->
ID[i]);
ParticleAttrib< Vector_t > P
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Interface for septum magnet.
PETE_TUTree< FnFabs, typename T::PETE_Expr_t > fabs(const PETE_Expr< T > &l)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual void visitSeptum(const Septum &)=0
Apply the algorithm to a septum magnet.
double width_m
input geometry positions
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
virtual ElementBase::ElementType getType() const override
Override implementation of PluginElement.
double xstart_m
input geometry positions
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Pure virtual implementation of Component.
void setGeom(const double dist)
Sets geometry geom_m with element width dist.
size_t getLocalNum() const
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Hook for initialise.
void setWidth(double width)
Member variable access.
std::unique_ptr< LossDataSink > lossDs_m
ParticleAttrib< int > Bin
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Septum.
void get_bounds(Vector_t &rmin, Vector_t &rmax)
Inform & endl(Inform &inf)