31 *gmsg <<
"* Initialize probe" <<
endl;
32 bool singlemode = (bunch->
getTotalNum() == 1) ?
true :
false;
37 *gmsg <<
"* Probe goes offline " <<
getName() <<
endl;
59 double rbunch_min = std::hypot(xmin, ymin);
60 double rbunch_max = std::hypot(xmax, ymax);
62 if( rbunch_max >
rmin_m - 10.0 && rbunch_min <
rend_m + 10.0 ) {
72 for(
unsigned int i = 0; i < tempnum; ++i) {
76 if(pflag == 0)
continue;
85 double dist1 = (
A_m * bunch->
R[i](0) +
B_m * bunch->
R[i](1) +
C_m) /
R_m * 1.0
e-3;
86 double dist2 = dist1 *
sqrt(1.0 + 1.0 / tangle / tangle);
87 double dt = dist2 / (
sqrt(1.0 - 1.0 / (1.0 +
dot(bunch->
P[i], bunch->
P[i]))) *
Physics::c) * 1.0e9;
89 probepoint = bunch->
R[i] + dist2 * 1000.0 * bunch->
P[i] /
euclidean_norm(bunch->
P[i]);
99 lossDs_m->addParticle(probepoint, bunch->
P[i], bunch->
ID[i], t+dt,
double step_m
Step size of the probe (bin width in histogram file)
ParticleAttrib< Vector_t > P
void setStep(double step)
Set probe histogram bin width.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
virtual ElementBase::ElementType getType() const override
Get element type std::string.
constexpr double e
The value of .
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Initialise peakfinder file.
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record probe hits when bunch particles pass.
double calculateIncidentAngle(double xp, double yp) const
Calculate angle of particle/bunch wrt to element.
virtual double getStep() const
Member variable access.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
double C_m
Geometric lengths used in calculations.
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
std::unique_ptr< PeakFinder > peakfinder_m
Pointer to Peakfinder instance.
virtual const std::string & getName() const
Get element name.
ParticleAttrib< short > bunchNum
double rmin_m
radius closest to the origin
size_t getTotalNum() const
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
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.
virtual void visitProbe(const Probe &)=0
Apply the algorithm to a probe.
Find peaks of radial profile.
constexpr double c
The velocity of light in m/s.
std::string getOutputFN() const
Get output filename.
size_t getLocalNum() const
Tps< T > sqrt(const Tps< T > &x)
Square root.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Probe.
T euclidean_norm(const Vector< T > &)
Euclidean norm.
virtual void doGoOffline() override
Hook for goOffline.
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
void get_bounds(Vector_t &rmin, Vector_t &rmax)
int checkPoint(const double &x, const double &y) const
Checks if coordinate is within element.
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Inform & endl(Inform &inf)