12#ifndef ROOT_TEveVector
13#define ROOT_TEveVector
33 template <
typename OO>
48 Error(
"TEveVectorT",
"Subsequent nembers cannot be accessed as array!");
54 Error(
"TEveVectorT",
"Subsequent nembers cannot be accessed as array!");
61 "Subsequent nembers cannot be accessed as array!");
67 "Subsequent nembers cannot be accessed as array!");
72 operator const TT*()
const {
return Arr(); }
73 operator TT*() {
return Arr(); }
87 template <
typename OO>
138 return fX == 0 && fY == 0 && fZ == 0 ? 0 :
TMath::ATan2(Perp(), fZ);
145 Float_t ptot = Mag();
return ptot == 0 ? 1 : fZ/ptot;
153 (fY -
b.fY)*(fY -
b.fY) +
154 (fZ -
b.fZ)*(fZ -
b.fZ));
161 return ((fX -
b.fX) * (fX -
b.fX) +
162 (fY -
b.fY) * (fY -
b.fY) +
163 (fZ -
b.fZ) * (fZ -
b.fZ));
170 return a.fX*fX +
a.fY*fY +
a.fZ*fZ;
178 r.fX = fY *
a.fZ - fZ *
a.fY;
179 r.fY = fZ *
a.fX - fX *
a.fZ;
180 r.fZ = fX *
a.fY - fY *
a.fX;
241template <
typename TT>
250 template <
typename OO>
252 template <
typename OO>
254 template <
typename OO>
266 using TP::operator+=;
267 using TP::operator-=;
309template <
typename TT>
316 template <
typename OO>
324 operator const TT*()
const {
return &
fX; }
325 operator TT*() {
return &
fX; }
334 const TT*
Arr()
const {
return &
fX; }
341 template <
typename OO>
373 return fX == 0.0 && fY == 0.0 ? 0.0 :
TMath::ATan2(fY, fX);
381 (fY -
b.fY)*(fY -
b.fY));
388 return ((fX -
b.fX) * (fX -
b.fX) +
389 (fY -
b.fY) * (fY -
b.fY));
396 return a.fX*fX +
a.fY*fY;
403 return fX *
a.fY - fY *
a.fX;
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
TEveVector2T< Float_t > TEveVector2
TEveVectorT< Float_t > TEveVectorF
TEveVectorT< TT > operator+(const TEveVectorT< TT > &a, const TEveVectorT< TT > &b)
TEveVectorT< Double_t > TEveVectorD
TEveVectorT< TT > operator*(const TEveVectorT< TT > &a, TT b)
TEveVectorT< Float_t > TEveVector
TEveVector4T< Float_t > TEveVector4F
TEveVector4T< Double_t > TEveVector4D
TEveVector2T< Double_t > TEveVector2D
TEveVector2T< Float_t > TEveVector2F
TEveVectorT< TT > operator-(const TEveVectorT< TT > &a, const TEveVectorT< TT > &b)
TEveVector4T< Float_t > TEveVector4
Minimal, templated two-vector.
TEveVector2T(const TEveVector2T< OO > &v)
void Set(const Double_t *v)
TT Cross(const TEveVector2T &a) const
void Dump() const
Dump to stdout as "(x, y)\n".
TT Distance(const TEveVector2T &v) const
TT Dot(const TEveVector2T &a) const
TEveVector2T(const Double_t *v)
TEveVector2T & Mult(const TEveVector2T &a, TT af)
void Normalize(TT length=1)
Normalize the vector to length if current length is non-zero.
TT SquareDistance(const TEveVector2T &v) const
TT operator[](Int_t idx) const
TEveVector2T(const Float_t *v)
TEveVector2T & operator-=(const TEveVector2T &v)
void Set(const Float_t *v)
TT & operator[](Int_t idx)
void Set(const TEveVector2T< OO > &v)
ClassDefNV(TEveVector2T, 1)
TEveVector2T & operator+=(const TEveVector2T &v)
TEveVector2T & operator*=(TT s)
TEveVector2T & Sub(const TEveVector2T &p, const TEveVector2T &q)
Minimal, templated four-vector.
TEveVector4T(const TEveVectorT< OO > &v)
ClassDefNV(TEveVector4T, 1)
TEveVector4T(const Float_t *v)
void Dump() const
Dump to stdout as "(x, y, z; t)\n".
TEveVector4T(TT x, TT y, TT z, TT t=0)
TEveVector4T & operator-=(const TEveVector4T &v)
TEveVector4T & operator*=(TT s)
TEveVector4T & operator+=(const TEveVector4T &v)
TEveVector4T(const TEveVectorT< OO > &v, Float_t t)
TEveVector4T(const TEveVector4T< OO > &v)
TEveVector4T(const Double_t *v)
Minimal, templated three-vector.
TEveVectorT Cross(const TEveVectorT &a) const
void OrthoNormBase(TEveVectorT &a, TEveVectorT &b) const
Set vectors a and b to be normal to this and among themselves, both of length 1.
void Set(TT x, TT y, TT z)
void Set(const Double_t *v)
TT Distance(const TEveVectorT &v) const
TEveVectorT(TT x, TT y, TT z)
TEveVectorT & Mult(const TEveVectorT &a, TT af)
TT Normalize(TT length=1)
Normalize the vector to length if current length is non-zero.
TEveVectorT(const Float_t *v)
TEveVectorT & operator+=(const TEveVectorT &v)
TT Eta() const
Calculate eta of the point, pretending it's a momentum vector.
TEveVectorT & operator-=(const TEveVectorT &v)
TT Dot(const TEveVectorT &a) const
void Set(const TEveVectorT< OO > &v)
TEveVectorT & operator*=(TT s)
TEveVectorT(const Double_t *v)
ClassDefNV(TEveVectorT, 2)
TT operator[](Int_t idx) const
TEveVectorT Orthogonal() const
Returns an orthogonal vector (not normalized).
void Dump() const
Dump to stdout as "(x, y, z)\n".
TEveVectorT & Sub(const TEveVectorT &a, const TEveVectorT &b)
void Set(const Float_t *v)
TEveVectorT(const TEveVectorT< OO > &v)
TT SquareDistance(const TEveVectorT &v) const
Double_t ATan2(Double_t y, Double_t x)
Double_t Sqrt(Double_t x)