1 #ifndef GeometryVector_newBasic3DVector_h
2 #define GeometryVector_newBasic3DVector_h
13 namespace detailsBasic3DVector {
17 eta(
double x,
double y,
double z) {
double t(z/
std::sqrt(x*x+y*y)); return ::asinh(
t);}
19 eta(
long double x,
long double y,
long double z) {
long double t(z/
std::sqrt(x*x+y*y)); return ::asinhl(
t);}
23 template <
typename T>
47 v{
T(p.
v[0]),
T(p.
v[1]),
T(p.
v[2]),
T(p.
v[3])} {}
63 template <
class OtherPo
int>
65 v{
T(p.x()),
T(p.y()),
T(p.z())} {}
74 v{
T(iv[0]),
T(iv[1]),
T(iv[2]),
T(iv[3])} {}
88 v[0] = p.x(); v[1] = p.y(); v[2] = p.z();
99 T x()
const {
return v[0];}
102 T y()
const {
return v[1];}
105 T z()
const {
return v[2];}
107 T w()
const {
return v[3];}
114 return res[0]&res[1]&res[2]&res[3];
158 return (0!=my_mag) ? (*this)*(
T(1)/
std::sqrt(my_mag)) : *
this;
232 namespace geometryDetails {
233 std::ostream &
print3D(std::ostream&
s,
double x,
double y,
double z);
238 inline std::ostream & operator<<( std::ostream& s, const Basic3DVector<T>&
v) {
255 template <
class T,
class U>
259 return RT(a).
v+RT(b).v;
262 template <
class T,
class U>
266 return RT(a).
v-RT(b).v;
276 template <
class T,
class U>
298 template <
class T,
typename S>
300 return static_cast<T>(
t)*v;
303 template <
class T,
typename S>
305 return static_cast<T>(
t)*v;
317 template <
class T,
typename S>
332 #endif // GeometryVector_Basic3DVector_h
Basic3DVector(MathVector const &iv)
Basic2DVector< T > xy() const
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Basic3DVector(const T &x, const T &y, const T &z, const T &w=0)
construct from cartesian coordinates
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
T perp2() const
Squared magnitude of transverse component.
Geom::Theta< T > theta() const
Basic3DVector unit() const
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Basic3DVector< typename PreciseFloatType< T, U >::Type > cross(const Basic3DVector< U > &lh) const
bool operator==(const Basic3DVector &rh) const
Basic3DVector(const Basic3DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
Geom::Phi< T > phi() const
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
Basic3DVector(const Geom::Theta< U > &theta, const Geom::Phi< U > &phi, const T &r)
T z() const
Cartesian z coordinate.
auto dot2(V1 x, V2 y) -> typenamestd::remove_reference< decltype(x[0])>::type
Basic3DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
Basic3DVector & operator+=(const Basic3DVector< U > &p)
MathVector const & mathVector() const
T perp() const
Magnitude of transverse component.
Basic3DVector & operator-=(const Basic3DVector< U > &p)
T y() const
Cartesian y coordinate.
T operator[](int i) const
Basic3DVector(Vec4< U > const &iv)
T value() const
Explicit access to value in case implicit conversion not OK.
T value() const
Explicit access to value in case implicit conversion not OK.
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
float __attribute__((vector_size(8))) float32x2_t
Geom::Spherical2Cartesian< T > Spherical
MathVector & mathVector()
double S(const TLorentzVector &, const TLorentzVector &)
Geom::Cylindrical2Cartesian< T > Cylindrical
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
float __attribute__((always_inline)) __attribute__((pure)) eta(float x
T transverse() const
Another name for perp()
Basic3DVector< float > Basic3DVectorF
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
std::ostream & print3D(std::ostream &s, double x, double y, double z)
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Basic3DVector(const OtherPoint &p)
PreciseFloatType< T, U >::Type dot(const Basic3DVector< U > &lh) const
T x() const
Cartesian x coordinate.
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.