19 #include <type_traits> 24 inline float operator*(
const Vec3D left,
const Vec3D right);
35 friend inline std::ostream &
operator<<(std::ostream &os,
const Vec3D &vec);
43 :
CooArray<float>(
std::numeric_limits<float>::max(),
std::numeric_limits<float>::max(),
44 std::numeric_limits<float>::max()) {}
87 (*this) /= this->
Mag();
92 (*this) /= this->
Mag();
97 (*this) /= this->
Mag();
102 (*this) /= this->
Mag();
111 void Dump()
const { std::cout << *
this << std::endl; }
118 float Mag()
const {
return std::sqrt((*
this) * (*
this)); }
132 Vec3D product(a, b, c);
158 if (
PolarAngle() == 0.0f || std::fabs(
PolarAngle() - M_PI) < std::numeric_limits<float>::epsilon())
159 throw UndefinedAngle(
"Vec3D::AzimuthAngle is undefined when polar == 0 or pi");
220 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
229 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
244 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
253 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
286 return std::move(right);
295 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
302 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
313 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
320 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * =
nullptr>
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
Vec3D & operator-=(Vec3D &&right)
Definition: Vec3D.h:206
An array that accepts coordinates as subscripts.
Definition: CooArray.h:22
friend std::ostream & operator<<(std::ostream &os, const Vec3D &vec)
Write coordinates to stream.
Definition: Vec3D.h:336
Exception(std::string msg="")
Definition: Exception.h:30
float operator*(const Vec3D left, const Vec3D right)
Compute the dot-product between two vectors.
Definition: Vec3D.h:329
Vec3D & operator*=(T &&right)
Definition: Vec3D.h:230
Vec3D & operator*=(T const &right)
Multiply a vector by a number.
Definition: Vec3D.h:221
Vec3D & operator+=(Vec3D &&right)
Definition: Vec3D.h:174
Vec3D & operator+=(Vec3D const &right)
Add a vector to this one.
Definition: Vec3D.h:167
Vec3D & operator/=(T &&right)
Definition: Vec3D.h:254
float PolarAngle() const
Compute the polar angle.
Definition: Vec3D.h:147
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Vec3D(float x, float y, float z)
Constructor.
Definition: Vec3D.h:51
Vec3D()
Default constructor.
Definition: Vec3D.h:42
Vec3D CrossProduct(const Vec3D &rhs)
Compute the cross product of two vectors.
Definition: Vec3D.h:128
Vec3D(RefFrame::Direction direction)
Constructs a 3D vector from a given direction.
Definition: Vec3D.h:64
float AzimuthAngle() const
Compute the azimuth angle.
Definition: Vec3D.h:157
Vec3D operator/(Vec3D left, T const &right)
Divide a vector by a number.
Definition: Vec3D.h:314
Vec3D operator-(Vec3D const &right) const
Subtract two vectors.
Definition: Vec3D.h:186
float Mag() const
Compute the vector magnitude.
Definition: Vec3D.h:118
Vec3D(std::array< float, 3 > arr)
Constructor.
Definition: Vec3D.h:58
Definition: Exception.h:24
Vec3D & operator-=(Vec3D const &right)
Subtract a vector from this one.
Definition: Vec3D.h:199
void Dump() const
Dumps the vector components.
Definition: Vec3D.h:111
Vec3D & operator/=(T const &right)
Divide a vector by a number.
Definition: Vec3D.h:245
bool operator==(const Vec3D &right) const
Comparison operator.
Definition: Vec3D.h:267
Exception class for invalid operations on a undefined angle.
Definition: Vec3D.h:137
Vec3D operator+(Vec3D left, Vec3D const &right)
Add two vectors.
Definition: Vec3D.h:280
Direction
Aliases for the six axis directions. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:57