48 endField = startField + 0.005;
54 *
gmsg <<
"Septum initialise" <<
endl;
71 double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
72 double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
73 double rbunch_max = std::hypot(xmax, ymax);
85 const double halfLength =
width_m / 2.0 * std::hypot(slope, 1);
87 const double intcept1 = intcept - halfLength;
88 const double intcept2 = intcept + halfLength;
90 for (
unsigned int i = 0; i < bunch->
getLocalNum(); ++i) {
93 double line1 = std::abs(slope * R(0) + intcept1);
94 double line2 = std::abs(slope * R(0) + intcept2);
96 if (std::abs(R(1)) > line2 &&
97 std::abs(R(1)) < line1 &&
105 t, bunch->
Q[i], bunch->
M[i]),
106 std::make_pair(turnnumber, bunch->
bunchNum[i]));
Inform & endl(Inform &inf)
ParticleAttrib< int > Bin
void get_bounds(Vector_t &rmin, Vector_t &rmax) const
size_t getLocalNum() const
ParticleAttrib< double > M
ParticleAttrib< Vector_t > P
ParticleAttrib< double > Q
ParticleAttrib< short > bunchNum
virtual void visitSeptum(const Septum &)=0
Apply the algorithm to a septum magnet.
void setGeom(const double dist)
Sets geometry geom_m with element width dist.
double xstart_m
input geometry positions
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
PluginElement(const std::string &name)
Constructor with given name.
Septum(const std::string &name)
Constructor with given name.
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Pure virtual implementation of Component.
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
virtual ElementType getType() const override
Override implementation of PluginElement.
double width_m
input geometry positions
void setWidth(double width)
Member variable access.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Septum.
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Hook for initialise.
Vektor< double, 3 > Vector_t