Go to the documentation of this file. 1 #ifndef GeometryVector_newBasic3DVector_h
2 #define GeometryVector_newBasic3DVector_h
23 eta(
long double x,
long double y,
long double z) {
63 template <
class OtherPo
int>
94 T x()
const {
return v[0]; }
97 T y()
const {
return v[1]; }
100 T z()
const {
return v[2]; }
102 T w()
const {
return v[3]; }
108 auto res =
v == rh.
v;
153 return (0 != my_mag) ? (*this) * (
T(1) /
std::sqrt(my_mag)) : *
this;
221 std::ostream&
print3D(std::ostream&
s,
double x,
double y,
double z);
240 template <
class T,
class U>
244 return RT(
a).
v + RT(
b).v;
247 template <
class T,
class U>
261 template <
class T,
class U>
280 template <
class T,
typename S>
282 return static_cast<T>(
t) *
v;
285 template <
class T,
typename S>
287 return static_cast<T>(
t) *
v;
298 template <
class T,
typename S>
311 #endif // GeometryVector_Basic3DVector_h
Geom::Theta< T > theta() const
Basic3DVector(const OtherPoint &p)
T transverse() const
Another name for perp()
Basic2DVector< T > xy() const
Basic3DVector(const Geom::Theta< U > &theta, const Geom::Phi< U > &phi, const T &r)
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
Basic3DVector< typename PreciseFloatType< T, U >::Type > cross(const Basic3DVector< U > &lh) const
T perp2() const
Squared magnitude of transverse component.
Basic3DVector(const T &x, const T &y, const T &z, const T &w=0)
construct from cartesian coordinates
MathVector & mathVector()
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T operator*(const Basic3DVector< T > &v1, const Basic3DVector< T > &v2)
scalar product of vectors of same precision
Basic3DVector(MathVector const &iv)
Basic3DVector(const Basic3DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
Basic3DVector(Vec4< U > const &iv)
T y() const
Cartesian y coordinate.
Basic3DVector< T > operator+(const Basic3DVector< T > &a, const Basic3DVector< T > &b)
vector sum and subtraction of vectors of possibly different precision
class Basic3DVector __attribute__((aligned(16)))
float __attribute__((always_inline)) __attribute__((pure)) eta(float x
std::ostream & print3D(std::ostream &s, double x, double y, double z)
T operator[](int i) const
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Basic3DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Basic2DVector< T > xy() const
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
bool operator==(const Basic3DVector &rh) const
Basic3DVector & operator+=(const Basic3DVector< U > &p)
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Basic3DVector & operator-=(const Basic3DVector< U > &p)
Basic3DVector< float > Basic3DVectorF
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
PreciseFloatType< T, U >::Type dot(const Basic3DVector< U > &lh) const
Basic3DVector(const Basic3DVector< U > &p)
Copy constructor and implicit conversion from Basic3DVector of different precision.
Basic3DVector< T > operator/(const Basic3DVector< T > &v, T t)
Geom::Spherical2Cartesian< T > Spherical
auto dot2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
T x() const
Cartesian x coordinate.
MathVector const & mathVector() const
Geom::Cylindrical2Cartesian< T > Cylindrical
T perp() const
Magnitude of transverse component.
std::ostream & operator<<(std::ostream &s, const Basic3DVector< T > &v)
simple text output to standard streams
T z() const
Cartesian z coordinate.
Basic3DVector unit() const
Geom::Phi< T > phi() const
Basic3DVector(const Basic2DVector< T > &p)
constructor from 2D vector (X and Y from 2D vector, z set to zero)
Basic3DVector< double > Basic3DVectorD