25 informed_m(right.informed_m) {
49 double rbunch_min = std::hypot(xmin, ymin);
50 double rbunch_max = std::hypot(xmax, ymax);
63 bool flagNeedUpdate =
false;
67 for (
unsigned int i = 0; i < tempnum; ++i) {
72 if ((pflag != 0) && (bunch->
Bin[i] != -1)) {
74 lossDs_m->addParticle(bunch->
R[i], bunch->
P[i], bunch->
ID[i]);
76 flagNeedUpdate =
true;
80 return flagNeedUpdate;
88 std::pair<Vector_t, double> boundingSphere;
89 boundingSphere.first = 0.5 * (rmax + rmin);
90 boundingSphere.second =
euclidean_norm(rmax - boundingSphere.first);
93 return flagNeedUpdate;
114 *gmsg <<
"* Finalize cyclotron collimator " <<
getName() <<
endl;
123 std::ofstream omsg(
"errormsg.txt", std::ios_base::app);
132 *gmsg <<
"* CCollimator angle start " <<
xstart_m <<
" (Deg) angle end " <<
ystart_m <<
" (Deg) "
160 for (
int i=0; i<4; i++) {
virtual void apply(PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere, size_t numParticlesInSimulation=0)=0
virtual ParticleMatterInteractionHandler * getParticleMatterInteraction() const
ParticleAttrib< Vector_t > P
virtual void accept(BeamlineVisitor &) const override
Apply visitor to CCollimator.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Point geom_m[5]
actual geometry positions with adaptive width such that each particle hits element once per turn ...
std::unique_ptr< LossDataSink > lossDs_m
Pointer to Loss instance.
virtual const std::string & getName() const
Get element name.
virtual void goOnline(const double &kineticEnergy) override
Override implementation of PluginElement.
static std::string typeset_msg(const std::string &msg, const std::string &title)
virtual bool doCheck(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep) override
Record hits when bunch particles pass.
double rmin_m
radius closest to the origin
virtual bool doPreCheck(PartBunchBase< double, 3 > *) override
Virtual hook for preCheck.
bool informed_m
Flag if error information already printed.
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
double rmax_m
maximum extend in r
virtual void doFinalise() override
Virtual hook for finalise.
ParticleAttrib< short > PType
double xstart_m
input geometry positions
ParticleMatterInteractionHandler * parmatint_m
virtual double getElementLength() const
Get design length.
virtual void doSetGeom() override
Calculate extend in r.
Interface for cyclotron collimator.
void setGeom(const double dist)
Sets geometry geom_m with element width dist.
PartBunchBase< double, 3 > * RefPartBunch_m
size_t getLocalNum() const
virtual void visitCCollimator(const CCollimator &)=0
Apply the algorithm to a collimator.
virtual void getDimensions(double &zBegin, double &zEnd) const override
void print()
unused check method
T euclidean_norm(const Vector< T > &)
Euclidean norm.
void setDimensions(double xstart, double xend, double ystart, double yend, double zstart, double zend, double width)
Set dimensions and consistency checks.
virtual ElementBase::ElementType getType() const override
Get element type std::string.
ParticleAttrib< int > Bin
virtual bool doFinaliseCheck(PartBunchBase< double, 3 > *bunch, bool flagNeedUpdate) override
Virtual hook for finaliseCheck.
double zstart_m
input geometry positions
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)
virtual void doInitialise(PartBunchBase< double, 3 > *bunch) override
Initialise particle matter interaction.
Inform & endl(Inform &inf)