99 rstart_m = std::hypot(xstart, ystart);
100 rend_m = std::hypot(xend, yend);
114 double x_close = 0.0;
131 double coeff2 = std::sqrt(1 + slope * slope);
132 double coeff1 = slope / coeff2;
133 double halfdist = dist / 2.0;
153 PartBunch_t* bunch,
int i,
const double tstep,
const double tangle) {
156 const double tmp = std::sqrt(
dot(bunch->
P(i), bunch->
P(i)));
158 double sWidth = lstep / std::sqrt(1 + 1 / tangle / tangle);
163 double k1, k2, tangle = 0.0;
164 if (
B_m == 0.0 && xp == 0.0) {
167 }
else if (
B_m == 0.0) {
172 tangle = std::abs(1 / k1);
173 }
else if (xp == 0.0) {
178 tangle = std::abs(1 / k2);
182 tangle = std::abs((k1 - k2) / (1 + k1 * k2));
204 PartBunch_t* bunch,
const int turnnumber,
const double t,
const double tstep) {
209 if (bunchClose ==
true) {
210 flag =
doCheck(bunch, turnnumber, t, tstep);
225 for (
int i = 0; i < 4; i++) {
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
ippl::Vector< T, Dim > Vector_t
constexpr double c
The velocity of light in m/s.
double getGamma(ippl::Vector< double, 3 > p)
virtual void goOnline(const double &kineticEnergy)
Component(const std::string &name)
Constructor with given name.
PartBunch_t * RefPartBunch_m
std::string getOutputFN() const
Get output filename.
int checkPoint(const double &x, const double &y) const
Checks if coordinate is within element.
void setGeom(const double dist)
Sets geometry geom_m with element width dist.
virtual void getDimensions(double &zBegin, double &zEnd) const override
virtual bool bends() const override
double C_m
Geometric lengths used in calculations.
void changeWidth(PartBunch_t *bunch, int i, const double tstep, const double tangle)
Change probe width depending on step size and angle of particle.
virtual void finalise() final
virtual void doSetGeom()
Virtual hook for setGeom.
virtual void doGoOffline()
Virtual hook for goOffline.
int numPassages_m
Number of turns (number of times save() method is called).
virtual bool apply(const size_t &i, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) override
Virtual implementation of Component.
virtual bool doCheck(PartBunch_t *bunch, const int turnnumber, const double t, const double tstep)=0
Pure virtual hook for check.
virtual void doInitialise(PartBunch_t *)
Pure virtual hook for initialise.
bool finaliseCheck(PartBunch_t *bunch, bool flagNeedUpdate)
Finalise call after check.
virtual void doFinalise()
Virtual hook for finalise.
virtual void goOffline() final
bool preCheck(PartBunch_t *bunch)
Check if bunch is close to element.
double calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
double xstart_m
input geometry positions
virtual void initialise(PartBunch_t *bunch, double &startField, double &endField) override
Pure virtual implementation of Component.
void setDimensions(double xstart, double xend, double ystart, double yend)
Set dimensions and consistency checks.
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
double getXStart() const
Member variable access.
bool check(PartBunch_t *bunch, const int turnnumber, const double t, const double tstep)
double rmin_m
radius closest to the origin
PluginElement(const std::string &name)
Constructor with given name.
virtual bool applyToReferenceParticle(const Vector_t< double, 3 > &R, const Vector_t< double, 3 > &P, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) override
OpenMode getOpenMode() const
static OpalData * getInstance()
OpenMode
Enum for writing to files.
ParticleAttrib< Vector_t< T, Dim > > P