42 informed_m(right.informed_m) {
66 double rbunch_min = std::hypot(xmin, ymin);
67 double rbunch_max = std::hypot(xmax, ymax);
80 bool flagNeedUpdate =
false;
84 for (
unsigned int i = 0; i < tempnum; ++i) {
89 if ((pflag != 0) && (bunch->
Bin[i] != -1)) {
92 bunch->
R[i], bunch->
P[i],
93 t, bunch->
Q[i], bunch->
M[i]),
94 std::make_pair(turnnumber, bunch->
bunchNum[i]));
97 flagNeedUpdate =
true;
101 return flagNeedUpdate;
109 std::pair<Vector_t, double> boundingSphere;
110 boundingSphere.first = 0.5 * (rmax + rmin);
111 boundingSphere.second =
euclidean_norm(rmax - boundingSphere.first);
114 return flagNeedUpdate;
136 std::ofstream omsg(
"errormsg.txt", std::ios_base::app);
170 for (
int i=0; i<4; i++) {
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)
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
ParticleAttrib< int > Bin
size_t getLocalNum() const
ParticleAttrib< double > M
ParticleAttrib< Vector_t > P
ParticleAttrib< double > Q
void get_bounds(Vector_t &rmin, Vector_t &rmax)
ParticleAttrib< short > bunchNum
virtual void visitCCollimator(const CCollimator &)=0
Apply the algorithm to a collimator.
virtual void doSetGeom() override
Calculate extend in r.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to CCollimator.
virtual void goOnline(const double &kineticEnergy) override
Override implementation of PluginElement.
virtual void getDimensions(double &zBegin, double &zEnd) const override
virtual ElementBase::ElementType getType() const override
Get element type std::string.
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
bool informed_m
Flag if error information already printed.
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Initialise particle matter interaction.
double zstart_m
input geometry positions
void print()
unused check method
virtual bool doFinaliseCheck(PartBunchBase< double, 3 > *bunch, bool flagNeedUpdate) override
Virtual hook for finaliseCheck.
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
double rmax_m
maximum extend in r
ParticleMatterInteractionHandler * parmatint_m
void setDimensions(double xstart, double xend, double ystart, double yend)
unhide PluginElement::setDimensions(double xstart, double xend, double ystart, double yend)
virtual void doFinalise() override
Virtual hook for finalise.
PartBunchBase< double, 3 > * RefPartBunch_m
virtual const std::string & getName() const
Get element name.
virtual ParticleMatterInteractionHandler * getParticleMatterInteraction() const
virtual double getElementLength() const
Get design length.
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.
Point geom_m[5]
actual geometry positions with adaptive width such that each particle hits element once per turn
double xstart_m
input geometry positions
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
double rmin_m
radius closest to the origin
static std::string typeset_msg(const std::string &msg, const std::string &title)
virtual void apply(PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere)=0