ROOT 6.13/01 Reference Guide |
TVector3 is a general three vector class, which can be used for the description of different vectors in 3D.
TVector3 has been implemented as a vector of three Double_t variables, representing the cartesian coordinates. By default all components are initialized to zero:
It is also possible (but not recommended) to initialize a TVector3 with a Double_t or Float_t C array.
You can get the basic components either by name or by index using operator():
The member functions SetX(), SetY(), SetZ() and SetXYZ() allow to set the components:
To get information on the TVector3 in spherical (rho,phi,theta) or cylindrical (z,r,theta) coordinates, the
the member functions Mag() (=magnitude=rho in spherical coordinates), Mag2(), Theta(), CosTheta(), Phi(), Perp() (the transverse component=r in cylindrical coordinates), Perp2() can be used:
It is also possible to get the transverse component with respect to another vector:
The pseudo-rapidity ( eta=-ln (tan (theta/2)) ) can be obtained by Eta() or PseudoRapidity():
There are set functions to change one of the non-cartesian coordinates:
The TVector3 class provides the operators to add, subtract, scale and compare vectors:
TVector3 objects can be rotated by objects of the TRotation class using the Transform() member functions,
the operator *= or the operator * of the TRotation class:
transforms v1 from the rotated frame (z' parallel to direction, x' in the theta plane and y' in the xy plane as well as perpendicular to the theta plane) to the (x,y,z) frame.
Definition at line 22 of file TVector3.h.
Public Types | |
typedef Double_t | Scalar |
Public Member Functions | |
TVector3 () | |
Constructors. More... | |
TVector3 (Double_t x, Double_t y, Double_t z) | |
TVector3 (const Double_t *) | |
TVector3 (const Float_t *) | |
TVector3 (const TVector3 &) | |
virtual | ~TVector3 () |
Double_t | Angle (const TVector3 &) const |
Return the angle w.r.t. another 3-vector. More... | |
Double_t | CosTheta () const |
TVector3 | Cross (const TVector3 &) const |
Double_t | DeltaPhi (const TVector3 &) const |
Double_t | DeltaR (const TVector3 &) const |
Return deltaR with respect to v. More... | |
Double_t | Dot (const TVector3 &) const |
Double_t | DrEtaPhi (const TVector3 &) const |
Double_t | Eta () const |
TVector2 | EtaPhiVector () const |
void | GetXYZ (Double_t *carray) const |
void | GetXYZ (Float_t *carray) const |
Double_t | Mag () const |
Double_t | Mag2 () const |
Bool_t | operator!= (const TVector3 &) const |
Double_t | operator() (int) const |
Double_t & | operator() (int) |
TVector3 & | operator*= (Double_t) |
TVector3 & | operator*= (const TRotation &) |
Multiplication operator. More... | |
TVector3 & | operator+= (const TVector3 &) |
TVector3 | operator- () const |
TVector3 & | operator-= (const TVector3 &) |
TVector3 & | operator= (const TVector3 &) |
Bool_t | operator== (const TVector3 &) const |
Double_t | operator[] (int) const |
Double_t & | operator[] (int) |
TVector3 | Orthogonal () const |
Double_t | Perp () const |
Return the transverse component (R in cylindrical coordinate system) More... | |
Double_t | Perp (const TVector3 &) const |
Return the transverse component (R in cylindrical coordinate system) More... | |
Double_t | Perp2 () const |
Double_t | Perp2 (const TVector3 &) const |
Double_t | Phi () const |
Return the azimuth angle. Returns phi from -pi to pi. More... | |
void | Print (Option_t *option="") const |
Print vector parameters. More... | |
Double_t | PseudoRapidity () const |
Double_t m = Mag(); return 0.5*log( (m+fZ)/(m-fZ) ); guard against Pt=0. More... | |
Double_t | Pt () const |
Double_t | Pt (const TVector3 &) const |
Double_t | Px () const |
Double_t | Py () const |
Double_t | Pz () const |
void | Rotate (Double_t, const TVector3 &) |
Rotate vector. More... | |
void | RotateUz (const TVector3 &) |
NewUzVector must be normalized ! More... | |
void | RotateX (Double_t) |
Rotate vector around X. More... | |
void | RotateY (Double_t) |
Rotate vector around Y. More... | |
void | RotateZ (Double_t) |
Rotate vector around Z. More... | |
void | SetMag (Double_t) |
void | SetMagThetaPhi (Double_t mag, Double_t theta, Double_t phi) |
Setter with mag, theta, phi. More... | |
void | SetPerp (Double_t) |
void | SetPhi (Double_t) |
Set phi keeping mag and theta constant (BaBar). More... | |
void | SetPtEtaPhi (Double_t pt, Double_t eta, Double_t phi) |
Set Pt, Eta and Phi. More... | |
void | SetPtThetaPhi (Double_t pt, Double_t theta, Double_t phi) |
Set Pt, Theta and Phi. More... | |
void | SetTheta (Double_t) |
Set theta keeping mag and phi constant (BaBar). More... | |
void | SetX (Double_t) |
void | SetXYZ (Double_t x, Double_t y, Double_t z) |
void | SetY (Double_t) |
void | SetZ (Double_t) |
Double_t | Theta () const |
Return the polar angle. More... | |
TVector3 & | Transform (const TRotation &) |
Transform this vector with a TRotation. More... | |
TVector3 | Unit () const |
Return unit vector parallel to this. More... | |
Double_t | x () const |
Double_t | X () const |
TVector2 | XYvector () const |
Double_t | y () const |
Double_t | Y () const |
Double_t | z () const |
Double_t | Z () const |
Private Attributes | |
Double_t | fX |
Double_t | fY |
Double_t | fZ |
Friends | |
class | TLorentzVector |
#include <TVector3.h>
typedef Double_t TVector3::Scalar |
Definition at line 26 of file TVector3.h.
|
inline |
Constructors.
Definition at line 247 of file TVector3.h.
|
inline |
Definition at line 253 of file TVector3.h.
|
inline |
Definition at line 256 of file TVector3.h.
|
inline |
Definition at line 259 of file TVector3.h.
|
inline |
Definition at line 250 of file TVector3.h.
|
inlinevirtual |
Definition at line 40 of file TVector3.h.
Double_t TVector3::Angle | ( | const TVector3 & | q | ) | const |
Return the angle w.r.t. another 3-vector.
Definition at line 197 of file TVector3.cxx.
|
inline |
Definition at line 371 of file TVector3.h.
Definition at line 335 of file TVector3.h.
|
inline |
Definition at line 396 of file TVector3.h.
Double_t TVector3::DeltaR | ( | const TVector3 & | v | ) | const |
Return deltaR with respect to v.
Definition at line 372 of file TVector3.cxx.
|
inline |
Definition at line 331 of file TVector3.h.
|
inline |
Definition at line 404 of file TVector3.h.
|
inline |
Definition at line 400 of file TVector3.h.
|
inline |
Definition at line 409 of file TVector3.h.
|
inline |
Definition at line 233 of file TVector3.h.
|
inline |
Definition at line 239 of file TVector3.h.
|
inline |
Definition at line 86 of file TVector3.h.
|
inline |
Definition at line 339 of file TVector3.h.
|
inline |
Definition at line 302 of file TVector3.h.
|
inline |
Definition at line 263 of file TVector3.h.
|
inline |
Definition at line 277 of file TVector3.h.
|
inline |
Definition at line 324 of file TVector3.h.
Multiplication operator.
Definition at line 183 of file TVector3.cxx.
Definition at line 306 of file TVector3.h.
|
inline |
Definition at line 320 of file TVector3.h.
Definition at line 313 of file TVector3.h.
Definition at line 291 of file TVector3.h.
|
inline |
Definition at line 298 of file TVector3.h.
|
inline |
Definition at line 211 of file TVector3.h.
|
inline |
Definition at line 210 of file TVector3.h.
|
inline |
Definition at line 342 of file TVector3.h.
Double_t TVector3::Perp | ( | ) | const |
Return the transverse component (R in cylindrical coordinate system)
Definition at line 213 of file TVector3.cxx.
Double_t TVector3::Perp | ( | const TVector3 & | p | ) | const |
Return the transverse component (R in cylindrical coordinate system)
Definition at line 222 of file TVector3.cxx.
|
inline |
Definition at line 353 of file TVector3.h.
|
inline |
Definition at line 358 of file TVector3.h.
Double_t TVector3::Phi | ( | ) | const |
Return the azimuth angle. Returns phi from -pi to pi.
Definition at line 230 of file TVector3.cxx.
void TVector3::Print | ( | Option_t * | option = "" | ) | const |
Print vector parameters.
Definition at line 460 of file TVector3.cxx.
Double_t TVector3::PseudoRapidity | ( | ) | const |
Double_t m = Mag(); return 0.5*log( (m+fZ)/(m-fZ) ); guard against Pt=0.
Definition at line 320 of file TVector3.cxx.
|
inline |
Definition at line 356 of file TVector3.h.
|
inline |
Definition at line 367 of file TVector3.h.
|
inline |
Definition at line 219 of file TVector3.h.
|
inline |
Definition at line 220 of file TVector3.h.
|
inline |
Definition at line 221 of file TVector3.h.
void TVector3::Rotate | ( | Double_t | angle, |
const TVector3 & | axis | ||
) |
Rotate vector.
Definition at line 290 of file TVector3.cxx.
void TVector3::RotateUz | ( | const TVector3 & | NewUzVector | ) |
NewUzVector must be normalized !
Definition at line 299 of file TVector3.cxx.
void TVector3::RotateX | ( | Double_t | angle | ) |
Rotate vector around X.
Definition at line 257 of file TVector3.cxx.
void TVector3::RotateY | ( | Double_t | angle | ) |
Rotate vector around Y.
Definition at line 268 of file TVector3.cxx.
void TVector3::RotateZ | ( | Double_t | angle | ) |
Rotate vector around Z.
Definition at line 279 of file TVector3.cxx.
|
inline |
Definition at line 376 of file TVector3.h.
void TVector3::SetMagThetaPhi | ( | Double_t | mag, |
Double_t | theta, | ||
Double_t | phi | ||
) |
Setter with mag, theta, phi.
Definition at line 382 of file TVector3.cxx.
|
inline |
Definition at line 388 of file TVector3.h.
void TVector3::SetPhi | ( | Double_t | ph | ) |
Set phi keeping mag and theta constant (BaBar).
Definition at line 362 of file TVector3.cxx.
void TVector3::SetPtEtaPhi | ( | Double_t | pt, |
Double_t | eta, | ||
Double_t | phi | ||
) |
Set Pt, Eta and Phi.
Definition at line 332 of file TVector3.cxx.
void TVector3::SetPtThetaPhi | ( | Double_t | pt, |
Double_t | theta, | ||
Double_t | phi | ||
) |
Set Pt, Theta and Phi.
Definition at line 340 of file TVector3.cxx.
void TVector3::SetTheta | ( | Double_t | th | ) |
Set theta keeping mag and phi constant (BaBar).
Definition at line 350 of file TVector3.cxx.
|
inline |
Definition at line 223 of file TVector3.h.
|
inline |
Definition at line 227 of file TVector3.h.
|
inline |
Definition at line 224 of file TVector3.h.
|
inline |
Definition at line 225 of file TVector3.h.
Double_t TVector3::Theta | ( | ) | const |
Return the polar angle.
Definition at line 238 of file TVector3.cxx.
Transform this vector with a TRotation.
Definition at line 190 of file TVector3.cxx.
TVector3 TVector3::Unit | ( | ) | const |
Return unit vector parallel to this.
Definition at line 246 of file TVector3.cxx.
|
inline |
Definition at line 213 of file TVector3.h.
|
inline |
Definition at line 216 of file TVector3.h.
|
inline |
Definition at line 413 of file TVector3.h.
|
inline |
Definition at line 214 of file TVector3.h.
|
inline |
Definition at line 217 of file TVector3.h.
|
inline |
Definition at line 215 of file TVector3.h.
|
inline |
Definition at line 218 of file TVector3.h.
|
friend |
Definition at line 191 of file TVector3.h.
|
private |
Definition at line 185 of file TVector3.h.
|
private |
Definition at line 185 of file TVector3.h.
|
private |
Definition at line 185 of file TVector3.h.