49 bool singlemode = (bunch->
getTotalNum() == 1) ? true :
false;
72 double xmin = std::min(std::abs(rmin(0)), std::abs(rmax(0)));
73 double xmax = std::max(std::abs(rmin(0)), std::abs(rmax(0)));
74 double ymin = std::min(std::abs(rmin(1)), std::abs(rmax(1)));
75 double ymax = std::max(std::abs(rmin(1)), std::abs(rmax(1)));
76 double rbunch_min = std::hypot(xmin, ymin);
77 double rbunch_max = std::hypot(xmax, ymax);
79 if (rbunch_max >
rmin_m - 0.01 && rbunch_min <
rend_m + 0.01 ) {
89 for (
unsigned int i = 0; i < tempnum; ++i) {
93 if (pflag == 0)
continue;
102 double dist1 = (
A_m * bunch->
R[i](0) +
B_m * bunch->
R[i](1) +
C_m) /
R_m;
103 double dist2 = dist1 * std::sqrt(1.0 + 1.0 / tangle / tangle);
104 double dt = dist2 / (std::sqrt(1.0 - 1.0 / (1.0 +
dot(bunch->
P[i], bunch->
P[i]))) *
Physics::c);
112 t+dt, bunch->
Q[i], bunch->
M[i]),
113 std::make_pair(turnnumber, bunch->
bunchNum[i]));
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
T euclidean_norm(const Vector< T > &)
Euclidean norm.
Inform & endl(Inform &inf)
constexpr double c
The velocity of light in m/s.
void get_bounds(Vector_t &rmin, Vector_t &rmax) const
size_t getLocalNum() const
ParticleAttrib< double > M
size_t getTotalNum() const
ParticleAttrib< Vector_t > P
ParticleAttrib< double > Q
ParticleAttrib< short > bunchNum
virtual void visitProbe(const Probe &)=0
Apply the algorithm to a probe.
virtual const std::string & getName() const
Get element name.
std::string getOutputFN() const
Get output filename.
int checkPoint(const double &x, const double &y) const
Checks if coordinate is within element.
double C_m
Geometric lengths used in calculations.
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 calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
double rmin_m
radius closest to the origin
PluginElement(const std::string &name)
Constructor with given name.
void setStep(double step)
Set probe histogram bin width.
std::unique_ptr< PeakFinder > peakfinder_m
Pointer to Peakfinder instance.
Probe(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 probe hits when bunch particles pass.
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Initialise peakfinder file.
double step_m
Step size of the probe (bin width in histogram file).
virtual void doGoOffline() override
Hook for goOffline.
virtual ElementType getType() const override
Get element type std::string.
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
virtual double getStep() const
Member variable access.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Probe.
Vektor< double, 3 > Vector_t