90 rstart_m = std::hypot(xstart, ystart);
91 rend_m = std::hypot(xend, yend);
105 double x_close = 0.0;
123 double coeff2 =
std::sqrt(1 + slope * slope);
124 double coeff1 = slope / coeff2;
125 double halfdist = dist / 2.0;
146 constexpr
double c_mtns =
Physics::c * 1.0e-9;
148 double sWidth = lstep /
std::sqrt( 1 + 1/tangle/tangle );
153 double k1, k2, tangle = 0.0;
154 if (
B_m == 0.0 && xp == 0.0) {
157 }
else if (
B_m == 0.0 ){
163 }
else if ( xp == 0.0 ) {
172 tangle =
std::abs(( k1-k2 ) / (1 + k1*k2));
198 if (bunchClose ==
true) {
199 flag =
doCheck(bunch, turnnumber, t, tstep);
214 for (
int i = 0; i < 4; i++) {
Tps< T > sqrt(const Tps< T > &x)
Square root.
T euclidean_norm(const Vector< T > &)
Euclidean norm.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
constexpr double c
The velocity of light in m/s.
double getGamma(Vector_t p)
ParticleAttrib< Vector_t > P
OPENMODE getOpenMode() const
OPENMODE
Enum for writing to files.
static OpalData * getInstance()
Interface for a single beam element.
virtual void goOnline(const double &kineticEnergy)
PartBunchBase< double, 3 > * RefPartBunch_m
std::string getOutputFN() const
Get output filename.
virtual void doInitialise(PartBunchBase< double, 3 > *)
Pure virtual hook for initialise.
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.
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Pure virtual implementation of Component.
virtual void finalise() final
virtual void doSetGeom()
Virtual hook for setGeom.
virtual void doGoOffline()
Virtual hook for goOffline.
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.
int numPassages_m
Number of turns (number of times save() method is called)
Point geom_m[5]
actual geometry positions with adaptive width such that each particle hits element once per turn
bool check(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep)
virtual void doFinalise()
Virtual hook for finalise.
virtual void goOffline() final
double calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
double xstart_m
input geometry positions
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 finaliseCheck(PartBunchBase< double, 3 > *bunch, bool flagNeedUpdate)
Finalise call after check.
bool preCheck(PartBunchBase< double, 3 > *bunch)
Check if bunch is close to element.
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
double rmin_m
radius closest to the origin
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep)=0
Pure virtual hook for check.
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override