1 #ifndef GeometryVector_newBasic3DVector_h 2 #define GeometryVector_newBasic3DVector_h 24 eta(
long double x,
long double y,
long double z) {
67 template <
class OtherPo
int>
97 T x()
const {
return v[0]; }
100 T y()
const {
return v[1]; }
103 T z()
const {
return v[2]; }
105 T w()
const {
return v[3]; }
111 auto res =
v == rh.
v;
224 std::ostream&
print3D(std::ostream&
s,
double x,
double y,
double z);
229 inline std::ostream& operator<<(std::ostream& s, const Basic3DVector<T>&
v) {
243 template <
class T,
class U>
247 return RT(
a).
v + RT(
b).v;
250 template <
class T,
class U>
254 return RT(
a).
v - RT(
b).v;
264 template <
class T,
class U>
283 template <
class T,
typename S>
285 return static_cast<T>(
t) *
v;
288 template <
class T,
typename S>
290 return static_cast<T>(
t) *
v;
301 template <
class T,
typename S>
314 #endif // GeometryVector_Basic3DVector_h Basic3DVector(MathVector const &iv)
Basic3DVector< T > operator+(const Basic3DVector< T > &a, const Basic3DVector< T > &b)
vector sum and subtraction of vectors of possibly different precision
T x() const
Cartesian x coordinate.
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
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
class Basic3DVector __attribute__((aligned(16)))
Basic3DVector(const Basic3DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
bool operator==(const Basic3DVector &rh) const
Basic2DVector< T > xy() const
T y() const
Cartesian y coordinate.
T operator[](int i) const
Geom::Theta< T > theta() const
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
Basic3DVector(const Geom::Theta< U > &theta, const Geom::Phi< U > &phi, const T &r)
PreciseFloatType< T, U >::Type dot(const Basic3DVector< U > &lh) const
Basic3DVector< typename PreciseFloatType< T, U >::Type > cross(const Basic3DVector< U > &lh) const
Basic3DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Basic3DVector & operator+=(const Basic3DVector< U > &p)
T transverse() const
Another name for perp()
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Basic2DVector< T > xy() const
MathVector const & mathVector() const
Basic3DVector< T > operator/(const Basic3DVector< T > &v, T t)
Basic3DVector & operator-=(const Basic3DVector< U > &p)
T operator*(const Basic3DVector< T > &v1, const Basic3DVector< T > &v2)
scalar product of vectors of same precision
Basic3DVector(Vec4< U > const &iv)
T perp() const
Magnitude of transverse component.
Basic3DVector(const Basic3DVector< U > &p)
Copy constructor and implicit conversion from Basic3DVector of different precision.
Basic3DVector(const Basic2DVector< T > &p)
constructor from 2D vector (X and Y from 2D vector, z set to zero)
Basic3DVector< double > Basic3DVectorD
T z() const
Cartesian z coordinate.
Geom::Spherical2Cartesian< T > Spherical
MathVector & mathVector()
Geom::Cylindrical2Cartesian< T > Cylindrical
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
float __attribute__((always_inline)) __attribute__((pure)) eta(float x
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Basic3DVector unit() const
Basic3DVector< float > Basic3DVectorF
Geom::Phi< T > phi() const
std::ostream & print3D(std::ostream &s, double x, double y, double z)
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Basic3DVector(const OtherPoint &p)
auto dot2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
Basic3DVector & operator=(const Basic3DVector &)=default
Assignment operator.