12#ifndef ROOT7_REveVector
13#define ROOT7_REveVector
21namespace Experimental {
34 template <
typename OO>
46 Error(
"REveVectorT",
"Subsequent members cannot be accessed as array!");
52 Error(
"REveVectorT",
"Subsequent members cannot be accessed as array!");
59 "Subsequent members cannot be accessed as array!");
65 "Subsequent members cannot be accessed as array!");
70 operator const TT*()
const {
return Arr(); }
71 operator TT*() {
return Arr(); }
85 template <
typename OO>
141 Float_t ptot =
Mag();
return ptot == 0 ? 1 : fZ/ptot;
149 (fY -
b.fY)*(fY -
b.fY) +
150 (fZ -
b.fZ)*(fZ -
b.fZ));
157 return ((fX -
b.fX) * (fX -
b.fX) +
158 (fY -
b.fY) * (fY -
b.fY) +
159 (fZ -
b.fZ) * (fZ -
b.fZ));
166 return a.fX*fX +
a.fY*fY +
a.fZ*fZ;
174 r.fX = fY *
a.fZ - fZ *
a.fY;
175 r.fY = fZ *
a.fX - fX *
a.fZ;
176 r.fZ = fX *
a.fY - fY *
a.fX;
237template <
typename TT>
246 template <
typename OO>
248 template <
typename OO>
250 template <
typename OO>
262 using TP::operator+=;
263 using TP::operator-=;
303template <
typename TT>
310 template <
typename OO>
318 operator const TT*()
const {
return &
fX; }
319 operator TT*() {
return &
fX; }
328 const TT*
Arr()
const {
return &
fX; }
335 template <
typename OO>
365 return fX == 0.0 && fY == 0.0 ? 0.0 :
TMath::ATan2(fY, fX);
373 (fY -
b.fY)*(fY -
b.fY));
380 return ((fX -
b.fX) * (fX -
b.fX) +
381 (fY -
b.fY) * (fY -
b.fY));
388 return a.fX*fX +
a.fY*fY;
395 return fX *
a.fY - fY *
a.fX;
void Error(const char *location, const char *msgfmt,...)
REveVector2T A two-vector template without TObject inheritance and virtual functions.
REveVector2T & operator-=(const REveVector2T &v)
REveVector2T & Mult(const REveVector2T &a, TT af)
REveVector2T(const Float_t *v)
void Normalize(TT length=1)
Normalize the vector to length if current length is non-zero.
void Set(const Float_t *v)
void Set(const REveVector2T< OO > &v)
TT & operator[](Int_t idx)
REveVector2T(const Double_t *v)
TT SquareDistance(const REveVector2T &v) const
TT operator[](Int_t idx) const
REveVector2T & operator+=(const REveVector2T &v)
TT Distance(const REveVector2T &v) const
TT Dot(const REveVector2T &a) const
REveVector2T & operator*=(TT s)
REveVector2T(const REveVector2T< OO > &v)
void Dump() const
Dump to stdout as "(x, y)\n".
REveVector2T & Sub(const REveVector2T &p, const REveVector2T &q)
TT Cross(const REveVector2T &a) const
void Set(const Double_t *v)
REveVector4T A four-vector template without TObject inheritance and virtual functions.
REveVector4T & operator-=(const REveVector4T &v)
REveVector4T(const REveVector4T< OO > &v)
REveVector4T(const REveVectorT< OO > &v)
REveVector4T(const Double_t *v)
void Dump() const
Dump to stdout as "(x, y, z; t)\n".
REveVector4T(const Float_t *v)
REveVector4T(const REveVectorT< OO > &v, Float_t t)
REveVector4T(TT x, TT y, TT z, TT t=0)
REveVector4T & operator+=(const REveVector4T &v)
REveVector4T & operator*=(TT s)
REveVectorT A three-vector template without TObject inheritance and virtual functions.
void Set(TT x, TT y, TT z)
TT Normalize(TT length=1)
Normalize the vector to length if current length is non-zero.
REveVectorT(const REveVectorT< OO > &v)
REveVectorT & operator*=(TT s)
REveVectorT & operator-=(const REveVectorT &v)
REveVectorT & Mult(const REveVectorT &a, TT af)
REveVectorT(TT x, TT y, TT z)
REveVectorT Cross(const REveVectorT &a) const
TT Distance(const REveVectorT &v) const
void Set(const REveVectorT< OO > &v)
void Set(const Double_t *v)
TT operator[](Int_t idx) const
REveVectorT(const Float_t *v)
REveVectorT & Sub(const REveVectorT &a, const REveVectorT &b)
REveVectorT Orthogonal() const
Returns an orthogonal vector (not normalized).
TT SquareDistance(const REveVectorT &v) const
void Set(const Float_t *v)
void OrthoNormBase(REveVectorT &a, REveVectorT &b) const
Set vectors a and b to be normal to this and among themselves, both of length 1.
TT Eta() const
Calculate eta of the point, pretending it's a momentum vector.
REveVectorT(const Double_t *v)
TT Dot(const REveVectorT &a) const
REveVectorT & operator+=(const REveVectorT &v)
void Dump() const
Dump to stdout as "(x, y, z)\n".
TVector3 is a general three vector class, which can be used for the description of different vectors ...
T Mag(const SVector< T, D > &rhs)
Vector magnitude (Euclidian norm) Compute : .
REveVector4T< Double_t > REveVector4D
REveVector2T< Double_t > REveVector2D
REveVectorT< Float_t > REveVectorF
REveVector2T< Float_t > REveVector2F
REveVector4T< Float_t > REveVector4F
REveVector2T< Float_t > REveVector2
REveVectorT< TT > operator-(const REveVectorT< TT > &a, const REveVectorT< TT > &b)
REveVectorT< TT > operator*(const REveVectorT< TT > &a, TT b)
REveVector4T< Float_t > REveVector4
REveVectorT< Float_t > REveVector
REveVectorT< Double_t > REveVectorD
REveException operator+(const REveException &s1, const std::string &s2)
double Perp(const Vector1 &v, const Vector2 &u)
Find the magnitude of the vector component of v perpendicular to the given direction of u.
static constexpr double s
Double_t ATan2(Double_t y, Double_t x)
Double_t Sqrt(Double_t x)