29#ifndef CLASSIC_ABSBEAMLINE_Offset_HH
30#define CLASSIC_ABSBEAMLINE_Offset_HH
71 explicit Offset(
const std::string &name);
105 double displacement);
158 bool bends()
const override;
161 double &endField)
override;
bool operator!=(const Offset &off1, const Offset &off2)
Return not of operator ==.
std::ostream & operator<<(std::ostream &out, const Offset &off1)
Print Offset off1 to the ostream.
bool operator==(const Offset &off1, const Offset &off2)
Return true if off1 is equal to off2 within static floating point tolerance.
Interface for a single beam element.
Vector_t< double, 3 > getEndDirection() const
Euclid3DGeometry & getGeometry() override
Get geometry.
void setEndDirection(Vector_t< double, 3 > direction)
Offset & operator=(const Offset &)
Assignment operator deep copies geometry and wrappedGeometry; all other stuff is copied as well.
static Offset localCylindricalOffset(std::string name, double theta_in, double theta_out, double displacement)
Factory method to make an offset in Cylindrical coordinates local to the end of the previous element.
bool isGeometryAllocated() const
static Vector_t< double, 3 > rotate(Vector_t< double, 3 > vec, double theta)
Rotate vec anticlockwise by angle theta about z axis; return the rotated vector.
Vector_t< double, 3 > _end_position
static Offset globalCartesianOffset(std::string name, Vector_t< double, 3 > end_position, Vector_t< double, 3 > end_direction)
Factory method to make an offset in global cartesian coordinates.
~Offset()
deletes geometry and wrappedGeometry
void getDimensions(double &, double &) const override
Vector_t< double, 3 > _end_direction
static const double lengthUnits_m
EMField & getField() override
Not implemented - throws GeneralClassicException.
Offset()
Default constructor sets everything to 0., makes a default geometry with everything set to 0.
static double getTheta(Vector_t< double, 3 > vec1, Vector_t< double, 3 > vec2)
Calculate the angle between vectors on the midplane.
static double float_tolerance
void initialise(PartBunch_t *bunch, double &startField, double &endField) override
static Offset localCartesianOffset(std::string name, Vector_t< double, 3 > end_position, Vector_t< double, 3 > end_direction)
Factory method to make an offset in cartesian coordinates local to the end of the previous element.
void setEndPosition(Vector_t< double, 3 > position)
ElementBase * clone() const override
Just calls the copy constructor on *this.
void accept(BeamlineVisitor &) const override
Apply visitor to Offset.
static Offset globalCylindricalOffset(std::string name, double radius_out, double phi_out, double theta_out)
Factory method to make an offset in global cylindrical polar coordinates.
Vector_t< double, 3 > getEndPosition() const
Euclid3DGeometry * geometry_m
bool getIsLocal() const
Returns true if stored coordinates are in the local coordinate system of the last placed object.
void setIsLocal(bool isLocal)
Set to true if stored coordinates are in the local coordinate system of the last placed object.
bool bends() const override
Returns true if either input angle or output angle are greater than float_tolerance.
Abstract base class for electromagnetic fields.