#include <TMBVector3.hpp>
Inheritance diagram for TMBVector3:

The Physics Vector package consists of five classes:
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:
TVector3 v1; // v1 = (0,0,0)
TVector3 v2(1); // v2 = (1,0,0)
TVector3 v3(1,2,3); // v3 = (1,2,3)
TVector3 v4(v2); // v4 = v2
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():
xx = v1.X(); or xx = v1(0);
yy = v1.Y(); yy = v1(1);
zz = v1.Z(); zz = v1(2);
The memberfunctions SetX(), SetY(), SetZ() and SetXYZ() allow to set the components:
v1.SetX(1.); v1.SetY(2.); v1.SetZ(3.);
v1.SetXYZ(1.,2.,3.);
To get information on the TVector3 in spherical (rho,phi,theta) or cylindrical (z,r,theta) coordinates, the
the member functions Mag3() (=magnitude=rho in spherical coordinates), Mag32(), Theta(), CosTheta(), Phi(), Perp() (the transverse component=r in cylindrical coordinates), Perp2() can be used:
Double_t m = v.Mag3(); // get magnitude (=rho=Sqrt(x*x+y*y+z*z)))
Double_t m2 = v.Mag32(); // get magnitude squared
Double_t t = v.Theta(); // get polar angle
Double_t ct = v.CosTheta();// get cos of theta
Double_t p = v.Phi(); // get azimuth angle
Double_t pp = v.Perp(); // get transverse component
Double_t pp2= v.Perp2(); // get transvers component squared
It is also possible to get the transverse component with respect to another vector:
Double_t ppv1 = v.Perp(v1);
Double_t pp2v1 = v.Perp2(v1);
The pseudorapiditiy ( eta=-ln (tan (phi/2)) ) can be get by Eta() or PseudoRapidity():
Double_t eta = v.PseudoRapidity();
There are set functions to change one of the noncartesian coordinates:
v.SetTheta(.5); // keeping rho and phi
v.SetPhi(.8); // keeping rho and theta
v.SetMag3(10.); // keeping theta and phi
v.SetPerp(3.); // keeping z and phi
The TVector3 class provides the operators to add, subtract, scale and compare vectors:
v3 = -v1;
v1 = v2+v3;
v1 += v3;
v1 = v1 - v3
v1 -= v3;
v1 *= 10;
v1 = 5*v2;
if(v1==v2) {...}
if(v1!=v2) {...}
v2 = v1.Unit(); // get unit vector parallel to v1
v2 = v1.Orthogonal(); // get vector orthogonal to v1
s = v1.Dot(v2); // scalar product
s = v1 * v2; // scalar product
v = v1.Cross(v2); // vector product
Double_t a = v1.Angle(v2);
v.RotateX(.5);
v.RotateY(TMath::Pi());
v.RotateZ(angle);
v1.Rotate(TMath::Pi()/4, v2); // rotation around v2
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:
TRotation m;
...
v1.transform(m);
v1 = m*v1;
v1 *= m; // Attention v1 = m*v1
TVector3 direction = v.Unit()
v1.RotateUz(direction); // direction must be TVector3 of unit length
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.'
See copyright statements at end of file.
Definition at line 163 of file TMBVector3.hpp.
Public Member Functions | |
| TMBVector3 (Double_t x=0.0, Double_t y=0.0, Double_t z=0.0) | |
| TMBVector3 (const Double_t *a) | |
| TMBVector3 (const Float_t *a) | |
| TMBVector3 (const TMBVector3 &p) | |
| TMBVector3 (const TVector3 &v) | |
| virtual | ~TMBVector3 () |
| Double_t | operator() (int i) const |
| Double_t | operator[] (int i) const |
| Double_t & | operator() (int i) |
| Double_t & | operator[] (int i) |
| Double_t | x () const |
| Double_t | X () const |
| Double_t | Px () const |
| Double_t | y () const |
| Double_t | Y () const |
| Double_t | Py () const |
| Double_t | z () const |
| Double_t | Z () const |
| Double_t | Pz () const |
| void | SetX (Double_t a) |
| void | SetPx (Double_t a) |
| void | SetY (Double_t a) |
| void | SetPy (Double_t a) |
| void | SetZ (Double_t a) |
| void | SetPz (Double_t a) |
| void | SetXYZ (Double_t x, Double_t y, Double_t z) |
| void | SetPtEtaPhi (Double_t pt, Double_t eta, Double_t phi) |
| void | SetPtThetaPhi (Double_t pt, Double_t theta, Double_t phi) |
| void | GetXYZ (Double_t *carray) const |
| void | GetXYZ (Float_t *carray) const |
| Double_t | Eta () const |
| Double_t | Theta () const |
| Double_t | CosTheta () const |
| Double_t | Phi () const |
| Double_t | Rho () const |
| virtual Double_t | Mag32 () const |
| virtual Double_t | Mag3 () const |
| Double_t | P () const |
| Double_t | DeltaPhi (const TMBVector3 &v) const |
| Double_t | DeltaR (const TMBVector3 &v) const |
| Double_t | DrEtaPhi (const TMBVector3 &lv) const |
| Double_t | Angle (const TVector3 &q) const |
| void | SetPhi (Double_t ph) |
| void | SetTheta (Double_t th) |
| void | SetMag3 (Double_t ma) |
| Double_t | Perp2 () const |
| Double_t | Pt () const |
| Double_t | Perp () const |
| void | SetPerp (Double_t r) |
| Double_t | Perp2 (const TMBVector3 &p) const |
| Double_t | Pt (const TMBVector3 &p) const |
| Double_t | Perp (const TMBVector3 &p) const |
| void | SetMag3ThetaPhi (Double_t mag, Double_t theta, Double_t phi) |
| TMBVector3 & | operator= (const TMBVector3 &p) |
| Bool_t | operator== (const TMBVector3 &v) const |
| Bool_t | operator!= (const TMBVector3 &v) const |
| Bool_t | is_equal (const TMBVector3 &v) const |
| Equivalence operator. | |
| TMBVector3 & | operator+= (const TMBVector3 &p) |
| TMBVector3 & | operator-= (const TMBVector3 &p) |
| TMBVector3 | operator- () const |
| TMBVector3 & | operator *= (Double_t a) |
| TMBVector3 | Unit () const |
| TMBVector3 | Orthogonal () const |
| Double_t | Dot (const TMBVector3 &p) const |
| TMBVector3 | Cross (const TMBVector3 &p) const |
| Double_t | PseudoRapidity () const |
| void | RotateX (Double_t angle) |
| void | RotateY (Double_t angle) |
| void | RotateZ (Double_t angle) |
| void | RotateUz (const TMBVector3 &NewUzVector) |
| void | Rotate (Double_t angle, const TMBVector3 &axis) |
| TMBVector3 & | operator *= (const TRotation &m) |
| TMBVector3 & | Transform (const TRotation &m) |
| TVector2 | XYvector () const |
| operator TVector3 () const | |
| void | Print (Option_t *option="") const |
Static Public Member Functions | |
| bool | is_equal (double x1, double x2) |
Private Attributes | |
| Double32_t | fX |
| X component (left-right). | |
| Double32_t | fY |
| Y component (up-down). | |
| Double32_t | fZ |
| Z component (along the beam). | |
|
||||||||||||||||
|
The constructor. Definition at line 166 of file TMBVector3.hpp. References fX, fY, fZ, and z(). Referenced by Cross(), operator-(), and Orthogonal(). |
|
|
Constructor from an array Definition at line 170 of file TMBVector3.hpp. |
|
|
Constructor from an array Definition at line 174 of file TMBVector3.hpp. |
|
|
Copy constructor. Definition at line 178 of file TMBVector3.hpp. |
|
|
conversion constructor from TVector3 Definition at line 183 of file TMBVector3.hpp. |
|
|
Definition at line 188 of file TMBVector3.hpp. |
|
|
Angle wrt. another vector. Definition at line 323 of file TMBVector3.hpp. |
|
|
get cos(Theta) Definition at line 287 of file TMBVector3.hpp. Referenced by TMBTrack::fill_trpars(), and PseudoRapidity(). |
|
|
Cross product Definition at line 452 of file TMBVector3.hpp. References fX, fY, fZ, and TMBVector3(). |
|
|
Get difference in phi, between -pi and pi Definition at line 306 of file TMBVector3.hpp. References Phi(). |
|
|
Get "distance" dR of v to *this, dR=sqrt(dPhi*dPhi+dEta*dEta) Definition at line 310 of file TMBVector3.hpp. Referenced by DrEtaPhi(), and TMBTrackCalJet::GetDR(). |
|
|
Scalar product. Definition at line 449 of file TMBVector3.hpp. Referenced by Angle(), TMBLorentzVector::Dot(), operator *(), and Perp2(). |
|
|
Get "distance" dR of lv to *this, dR=sqrt(dPhi*dPhi+dEta*dEta) Definition at line 316 of file TMBVector3.hpp. References DeltaR(). |
|
|
get eta (aka pseudo-rapidity) Definition at line 283 of file TMBVector3.hpp. References PseudoRapidity(). Referenced by TMBJet::ActAsJESCorrected(), TMBJet::ActAsJESCorrectedShiftedMinus(), TMBJet::ActAsJESCorrectedShiftedPlus(), TMBJet::ActAsJESMUCorrected(), TMBJet::ActAsJESMUCorrectedShiftedMinus(), TMBJet::ActAsJESMUCorrectedShiftedPlus(), TMBMuon::ActAsSmeared(), TMBJet::ActAsSmeared(), TMBJet::ActAsSmearedMU(), TMBJet::ActAsUnCorrected(), TMBMuon::CorrectPt(), DeltaR(), TMBTrack::det_etaCFT(), TMBTrackCalJet::print(), and TMBTrack::propagate(). |
|
|
Getters into an arry (no checking of array bounds!) Definition at line 279 of file TMBVector3.hpp. |
|
|
Getters into an arry (no checking of array bounds!) Definition at line 276 of file TMBVector3.hpp. Referenced by TMBLorentzVector::GetXYZT(). |
|
||||||||||||
|
Definition at line 10 of file TMBVector3.cpp. |
|
|
Equivalence operator. True if all components are equivalent within machine precision. Definition at line 27 of file TMBVector3.cpp. Referenced by TMBLorentzVector::is_equal(). |
|
|
The magnitude (rho in spherical coordinate system). Definition at line 300 of file TMBVector3.hpp. References Mag32(). Referenced by TMBLorentzVector::Beta(), CosTheta(), P(), Print(), Rho(), SetMag3(), and SetTheta(). |
|
|
The magnitude squared (rho^2 in spherical coordinate system). Definition at line 297 of file TMBVector3.hpp. Referenced by Angle(), TMBLorentzVector::E(), Mag3(), Perp2(), TMBLorentzVector::SetT(), and Unit(). |
|
|
Transform with a rotation matrix Reimplemented in TMBLorentzVector. Definition at line 517 of file TMBVector3.hpp. |
|
|
Scaling with real numbers. Reimplemented in TMBLorentzVector. Definition at line 428 of file TMBVector3.hpp. Referenced by Rotate(). |
|
|
cast to a TVector3 Definition at line 530 of file TMBVector3.hpp. |
|
|
Inequality operator. Not equal if any of X,Y,Z are not equal. Definition at line 407 of file TMBVector3.hpp. |
|
|
Get components by index. Definition at line 206 of file TMBVector3.hpp. |
|
|
Get components by index. Reimplemented in TMBLorentzVector. Definition at line 191 of file TMBVector3.hpp. Referenced by operator[](). |
|
|
Addition. Definition at line 415 of file TMBVector3.hpp. |
|
|
Unary minus. Reimplemented in TMBLorentzVector. Definition at line 425 of file TMBVector3.hpp. References fX, fY, fZ, and TMBVector3(). |
|
|
Subtraction. Definition at line 420 of file TMBVector3.hpp. |
|
|
Assignment. Definition at line 398 of file TMBVector3.hpp. |
|
|
Equality operator. Equal if all components X,Y,Z are equal. Definition at line 404 of file TMBVector3.hpp. |
|
|
Set components by index. Definition at line 217 of file TMBVector3.hpp. References operator()(). |
|
|
Get components by index. Reimplemented in TMBLorentzVector. Definition at line 202 of file TMBVector3.hpp. References operator()(). |
|
|
Vector orthogonal to this. Definition at line 440 of file TMBVector3.hpp. References fX, fY, fZ, and TMBVector3(). |
|
|
get |P| Definition at line 303 of file TMBVector3.hpp. References Mag3(). Referenced by TMBJet::ActAsJESCorrected(), TMBJet::ActAsJESCorrectedShiftedMinus(), TMBJet::ActAsJESCorrectedShiftedPlus(), TMBJet::ActAsJESMUCorrected(), TMBJet::ActAsJESMUCorrectedShiftedMinus(), TMBJet::ActAsJESMUCorrectedShiftedPlus(), TMBJet::ActAsSmeared(), TMBJet::ActAsSmearedMU(), TMBSecondaryVertex::fill_pv_attributes(), and TMBTrackCalJet::print(). |
|
|
The transverse component w.r.t. given axis. Definition at line 386 of file TMBVector3.hpp. References Perp2(). |
|
|
The transverse component (R in cylindrical coordinate system) Definition at line 363 of file TMBVector3.hpp. References Perp2(). Referenced by TMBTau::ET(), Pt(), SetPerp(), SetPhi(), and Theta(). |
|
|
The transverse component w.r.t. given axis squared. Definition at line 376 of file TMBVector3.hpp. |
|
|
The transverse component squared (R^2 in cylindrical coordinate system) Definition at line 357 of file TMBVector3.hpp. Referenced by Perp(). |
|
|
|
print components to stdout Definition at line 534 of file TMBVector3.hpp. |
|
|
Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) Definition at line 456 of file TMBVector3.hpp. References CosTheta(), and fZ. Referenced by Eta(). |
|
|
The transverse component w.r.t. given axis. Definition at line 383 of file TMBVector3.hpp. References Perp(). |
|
|
transverse component; projection of 3 vector onto XY plane (R in cylindrical coords) Definition at line 360 of file TMBVector3.hpp. References Perp(). Referenced by TMBMuon::ActAsSmeared(), TMBJet::ActAsUnCorrected(), TMBJet::btag_print(), TMBMuon::CorrectPt(), TMBTrack::fill_trpars(), TMBTrack::fill_trpos(), TMBMuon::GetEtaDetector(), TMBTrackCalJet::print(), TMBTrackCal::print(), TMBTrack::propagate(), and TMBJet::uncorrPt(). |
|
|
get X component Definition at line 224 of file TMBVector3.hpp. References x(). Referenced by TMBMuon::CorrectPt(), TMBSecondaryVertex::fill_pv_attributes(), TMBTrack::fill_trpos(), and TMBTrackCalJet::TMBTrackCalJet(). |
|
|
get X component Definition at line 231 of file TMBVector3.hpp. References y(). Referenced by TMBMuon::CorrectPt(), TMBSecondaryVertex::fill_pv_attributes(), TMBTrack::fill_trpos(), and TMBTrackCalJet::TMBTrackCalJet(). |
|
|
get X component Definition at line 238 of file TMBVector3.hpp. References z(). Referenced by TMBMuon::CorrectPt(), TMBTau::etad(), TMBSecondaryVertex::fill_pv_attributes(), TMBLorentzVector::Rapidity(), and TMBTrackCalJet::TMBTrackCalJet(). |
|
|
get magnitude of momentum ("radius" in spherical coords) Definition at line 294 of file TMBVector3.hpp. References Mag3(). |
|
||||||||||||
|
Rotates around the axis specified by another vector Definition at line 510 of file TMBVector3.hpp. References operator *=(). |
|
|
Rotates reference frame from Uz to newUz (must be unit vector!) Definition at line 492 of file TMBVector3.hpp. |
|
|
Rotates around the x-axis. Definition at line 465 of file TMBVector3.hpp. |
|
|
Rotates around the y-axis. Definition at line 474 of file TMBVector3.hpp. |
|
|
Rotates around the z-axis. Definition at line 483 of file TMBVector3.hpp. |
|
|
Set magnitude keeping theta and phi constant Definition at line 346 of file TMBVector3.hpp. |
|
||||||||||||||||
|
Set all components as magnitude, theta, and phi Definition at line 390 of file TMBVector3.hpp. |
|
|
Set the transverse component keeping phi and z constant. Definition at line 367 of file TMBVector3.hpp. |
|
|
set phi keeping mag and theta constant Definition at line 332 of file TMBVector3.hpp. |
|
||||||||||||||||
|
set all members using |momentum|, eta, and phi Definition at line 257 of file TMBVector3.hpp. References SetXYZ(). Referenced by TMBLorentzVector::SetPEtaPhiE(), TMBLorentzVector::SetPEtaPhiM(), TMBLorentzVector::SetPtEtaPhiE(), and TMBLorentzVector::SetPtEtaPhiM(). |
|
||||||||||||||||
|
set all members using |momentum|, theta, and phi Definition at line 265 of file TMBVector3.hpp. |
|
|
set X component, see TVector3::SetX() Definition at line 243 of file TMBVector3.hpp. References SetX(). |
|
|
set X component, see TVector3::SetX() Definition at line 247 of file TMBVector3.hpp. References SetY(). |
|
|
set X component, see TVector3::SetX() Definition at line 251 of file TMBVector3.hpp. References SetZ(). |
|
|
Set theta keeping mag and phi constant Definition at line 338 of file TMBVector3.hpp. |
|
|
set X component, see TVector3::SetX() Definition at line 241 of file TMBVector3.hpp. References fX. Referenced by SetMag3(), SetPhi(), SetPx(), and SetTheta(). |
|
||||||||||||||||
|
set all members using Cartesian coordinates Definition at line 253 of file TMBVector3.hpp. Referenced by SetPtEtaPhi(), TMBLorentzVector::SetXYZM(), and TMBLorentzVector::SetXYZT(). |
|
|
set X component, see TVector3::SetY() Definition at line 245 of file TMBVector3.hpp. References fY. Referenced by SetMag3(), SetPhi(), SetPy(), and SetTheta(). |
|
|
set X component, see TVector3::SetZ() Definition at line 249 of file TMBVector3.hpp. References fZ. Referenced by SetMag3(), SetPz(), and SetTheta(). |
|
|
get theta Definition at line 285 of file TMBVector3.hpp. References fX, fY, fZ, and Perp(). Referenced by TMBMuon::GetEtaDetector(), Print(), and TMBMuonType::tlm(). |
|
|
Transform with a rotation matrix Reimplemented in TMBLorentzVector. Definition at line 521 of file TMBVector3.hpp. Referenced by TMBLorentzVector::Transform(). |
|
|
Unit vector parallel to this. Definition at line 434 of file TMBVector3.hpp. |
|
|
get X component Definition at line 222 of file TMBVector3.hpp. References x(). Referenced by TMBMuon::FixMuonPt(), operator *(), TMBLorentzVector::operator TLorentzVector(), operator TVector3(), operator+(), operator-(), Print(), and TMBVector3(). |
|
|
get X component Reimplemented in TMBTrack. Definition at line 220 of file TMBVector3.hpp. References fX. Referenced by TMBMuon::det_eta(), TMBTau::give_sign(), Px(), and X(). |
|
|
TVector2 containing x and y components Definition at line 526 of file TMBVector3.hpp. |
|
|
get Y component Definition at line 229 of file TMBVector3.hpp. References y(). Referenced by TMBMuon::FixMuonPt(), operator *(), TMBLorentzVector::operator TLorentzVector(), operator TVector3(), operator+(), operator-(), Print(), and TMBVector3(). |
|
|
get Y component Reimplemented in TMBTrack. Definition at line 227 of file |