1 #ifndef GeometryVector_newBasic3DVector_h 2 #define GeometryVector_newBasic3DVector_h 15 eta(
float x,
float y,
float z) {
float t(z/
std::sqrt(x*x+y*y)); return ::asinhf(
t);}
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>
63 template <
class OtherPo
int>
65 v(p.x(),p.y(),p.z()) {}
84 v.o.theX =
p.x();
v.o.theY =
p.y();
v.o.theZ =
p.z();
94 T x()
const {
return v.o.theX;}
97 T y()
const {
return v.o.theY;}
100 T z()
const {
return v.o.theZ;}
102 T w()
const {
return v.o.theW;}
152 return (0!=my_mag) ? (*this)*(
T(1)/
std::sqrt(my_mag)) : *
this;
227 std::ostream &
print3D(std::ostream&
s,
double x,
double y,
double z);
232 inline std::ostream & operator<<( std::ostream& s, const Basic3DVector<T>&
v) {
249 template <
class T,
class U>
253 return RT(a).
v+RT(b).v;
256 template <
class T,
class U>
260 return RT(a).
v-RT(b).v;
270 template <
class T,
class U>
292 template <
class T,
typename S>
294 return static_cast<T>(
t)*v;
297 template <
class T,
typename S>
299 return static_cast<T>(
t)*v;
311 template <
class T,
typename S>
326 #endif // GeometryVector_Basic3DVector_h T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector< T > xy() const
Basic3DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
T operator*(const Basic3DVector< T > &v1, const Basic3DVector< T > &v2)
scalar product of vectors of same precision
T y() const
Cartesian y coordinate.
T perp() const
Magnitude of transverse component.
T x() const
Cartesian x coordinate.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Basic3DVector(const T &x, const T &y, const T &z, const T &w=0)
construct from cartesian coordinates
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.
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Geom::Phi< T > phi() const
mathSSE::Vec4< T > MathVector
Basic3DVector< T > operator+(const Basic3DVector< T > &a, const Basic3DVector< T > &b)
vector sum and subtraction of vectors of possibly different precision
Basic3DVector(mathSSE::Vec4< U > const &iv)
Basic3DVector & operator-=(const Basic3DVector< U > &p)
Basic3DVector< T > operator/(const Basic3DVector< T > &v, T t)
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.
Basic3DVector< double > Basic3DVectorD
MathVector const & mathVector() const
T perp() const
Magnitude of transverse component.
T operator[](int i) const
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)
Geom::Spherical2Cartesian< T > Spherical
Basic3DVector< float > Basic3DVectorF
Geom::Theta< T > theta() const
MathVector & mathVector()
double S(const TLorentzVector &, const TLorentzVector &)
Geom::Cylindrical2Cartesian< T > Cylindrical
T perp2() const
Squared magnitude of transverse component.
float __attribute__((always_inline)) __attribute__((pure)) eta(float x
T transverse() const
Another name for perp()
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
Basic3DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Basic3DVector & operator+=(const Basic3DVector< U > &p)
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.
mathSSE::Vec4< T > VectorType