77 (4 * (std::pow(R(0) /
width_m, 2) + std::pow(R(1) /
height_m, 2)) <= 1) ) {
97 const double recpgamma =
Physics::c * dt / std::sqrt(1.0 +
dot(P, P));
98 double frac = -R(2) / (P(2) * recpgamma);
105 time_m.push_back(t + frac * dt);
141 Inform msg(
"Degrader::goOnline ");
145 PosX_m.reserve(maximumSize);
146 PosY_m.reserve(maximumSize);
147 PosZ_m.reserve(maximumSize);
151 time_m.reserve(maximumSize);
152 id_m.reserve(maximumSize);
157 Inform msg(
"Degrader::goOffline ");
159 msg <<
" done..." <<
endl;
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.
virtual void visitDegrader(const Degrader &)=0
Apply the algorithm to a degrader.
Component(const std::string &name)
Constructor with given name.
PartBunchBase< double, 3 > * RefPartBunch_m
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Degrader.
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
std::vector< double > MomentumZ_m
std::vector< double > time_m
void setDimensions(double xsize, double ysize)
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual void finalise() override
std::vector< double > MomentumY_m
virtual ElementType getType() const override
Get element type std::string.
Degrader(const std::string &name)
Constructor with given name.
std::vector< double > PosY_m
std::vector< double > PosX_m
virtual void goOnline(const double &kineticEnergy) override
std::vector< double > PosZ_m
virtual bool bends() const override
virtual void getDimensions(double &zBegin, double &zEnd) const override
virtual void goOffline() override
std::vector< double > MomentumX_m
virtual bool isInside(const Vector_t &R) const override
virtual const std::string & getName() const
Get element name.
virtual ParticleMatterInteractionHandler * getParticleMatterInteraction() const
virtual double getElementLength() const
Get design length.
virtual bool computeEnergyLoss(PartBunchBase< double, 3 > *bunch, Vector_t &P, const double deltat, bool includeFluctuations=true) const =0
Vektor< double, 3 > Vector_t