![]() |
Belle II Software development
|
A fast and root compatible alternative to TVector3. More...
#include <B2Vector3.h>
Public Types | |
typedef DataType | value_type |
storage type of the vector | |
Public Member Functions | |
B2Vector3 (void) | |
empty Constructor sets everything to 0 | |
B2Vector3 (const DataType xVal, const DataType yVal, const DataType zVal) | |
Constructor expecting 3 coordinates. | |
B2Vector3 (const DataType(&coords)[3]) | |
Constructor using a reference. | |
B2Vector3 (const DataType(*coords)[3]) | |
Constructor using a pointer. | |
B2Vector3 (const TVector3 &tVec3) | |
Constructor expecting a TVector3. | |
B2Vector3 (const TVector3 *tVec3) | |
Constructor expecting a pointer to a TVector3. | |
B2Vector3 (const B2Vector3< DataType > &b2Vec3) | |
Constructor expecting a B2Vector3 of same type. | |
B2Vector3 (const B2Vector3< DataType > *b2Vec3) | |
Constructor expecting a pointer to a B2Vector3. | |
template<typename OtherType > | |
B2Vector3 (const B2Vector3< OtherType > &b2Vec3) | |
Constructor expecting a B2Vector3 of different type. | |
template<typename OtherType > | |
B2Vector3 (const B2Vector3< OtherType > *b2Vec3) | |
Constructor expecting a pointer to a B2Vector3 of different type. | |
B2Vector3 (const ROOT::Math::XYZVector &xyzVec) | |
Constructor expecting a XYZVector. | |
B2Vector3 (const ROOT::Math::XYZVector *xyzVec) | |
Constructor expecting a pointer to a XYZVector. | |
DataType | operator() (unsigned i) const |
member access without boundary check | |
DataType | operator[] (unsigned i) const |
member access without boundary check | |
DataType & | operator() (unsigned i) |
member access without boundary check | |
DataType & | operator[] (unsigned i) |
member access without boundary check | |
B2Vector3< DataType > & | operator= (const B2Vector3< DataType > &b) |
Assignment via B2Vector3. | |
B2Vector3< DataType > & | operator= (const TVector3 &b) |
Assignment via TVector3. | |
B2Vector3< DataType > & | operator= (const ROOT::Math::XYZVector &b) |
Assignment via XYZVector. | |
operator TVector3 () const | |
type conversion in TVector3 | |
operator ROOT::Math::XYZVector () const | |
type conversion in ROOT::Math::XYZVector | |
bool | operator== (const B2Vector3< DataType > &b) const |
Comparison for equality with a B2Vector3. | |
bool | operator== (const TVector3 &b) const |
Comparison for equality with a TVector3. | |
bool | operator== (const ROOT::Math::XYZVector &b) const |
Comparison for equality with a XYZVector. | |
bool | operator!= (const B2Vector3< DataType > &b) const |
Comparison != with a B2Vector3. | |
bool | operator!= (const TVector3 &b) const |
Comparison != with a TVector3. | |
bool | operator!= (const ROOT::Math::XYZVector &b) const |
Comparison != with a XYZVector. | |
B2Vector3< DataType > & | operator+= (const B2Vector3< DataType > &b) |
addition | |
B2Vector3< DataType > & | operator-= (const B2Vector3< DataType > &b) |
subtraction | |
B2Vector3< DataType > & | operator*= (DataType a) |
scaling with real numbers | |
B2Vector3< DataType > | operator- () const |
unary minus | |
B2Vector3< DataType > | operator+ (const B2Vector3< DataType > &b) const |
Addition of 3-vectors. | |
B2Vector3< DataType > | operator- (const B2Vector3< DataType > &b) const |
Subtraction of 3-vectors. | |
B2Vector3< DataType > | operator* (DataType a) const |
Scaling of 3-vectors with a real number. | |
B2Vector3< DataType > | operator/ (DataType a) const |
Scaling of 3-vectors with a real number. | |
DataType | operator* (const B2Vector3< DataType > &b) const |
Scalar product of 3-vectors. | |
DataType | Phi () const |
The azimuth angle. | |
DataType | Theta () const |
The polar angle. | |
DataType | CosTheta () const |
Cosine of the polar angle. | |
DataType | Mag2 () const |
The magnitude squared (rho^2 in spherical coordinate system). | |
DataType | Mag () const |
The magnitude (rho in spherical coordinate system). | |
void | SetPhi (DataType phi) |
Set phi keeping mag and theta constant. | |
void | SetTheta (DataType theta) |
Set theta keeping mag and phi constant. | |
void | SetMag (DataType mag) |
Set magnitude keeping theta and phi constant. | |
DataType | Perp2 () const |
The transverse component squared (R^2 in cylindrical coordinate system). | |
DataType | Pt () const |
The transverse component (R in cylindrical coordinate system). | |
DataType | Perp () const |
The transverse component (R in cylindrical coordinate system). | |
void | SetPerp (DataType r) |
Set the transverse component keeping phi and z constant. | |
DataType | Perp2 (const B2Vector3< DataType > &axis) const |
The transverse component w.r.t. | |
DataType | Pt (const B2Vector3< DataType > &axis) const |
The transverse component w.r.t. | |
DataType | Perp (const B2Vector3< DataType > &axis) const |
The transverse component w.r.t. | |
DataType | DeltaPhi (const B2Vector3< DataType > &v) const |
returns phi in the interval [-PI,PI) | |
DataType | DeltaR (const B2Vector3< DataType > &v) const |
return deltaR with respect to input-vector | |
DataType | DrEtaPhi (const B2Vector3< DataType > &v) const |
return DrEtaPhi with respect to input-vector | |
void | SetMagThetaPhi (DataType mag, DataType theta, DataType phi) |
setter with mag, theta, phi | |
B2Vector3< DataType > | Unit () const |
Unit vector parallel to this. | |
B2Vector3< DataType > | Orthogonal () const |
Vector orthogonal to this one. | |
DataType | Dot (const B2Vector3< DataType > &p) const |
Scalar product. | |
B2Vector3< DataType > | Cross (const B2Vector3< DataType > &p) const |
Cross product. | |
DataType | Angle (const B2Vector3< DataType > &q) const |
The angle w.r.t. | |
DataType | PseudoRapidity () const |
Returns the pseudo-rapidity, i.e. | |
DataType | Eta () const |
Returns the pseudo-rapidity. | |
void | RotateX (DataType angle) |
Rotates the B2Vector3 around the x-axis. | |
void | RotateY (DataType angle) |
Rotates the B2Vector3 around the y-axis. | |
void | RotateZ (DataType angle) |
Rotates the B2Vector3 around the z-axis. | |
void | RotateUz (const B2Vector3< DataType > &NewUzVector) |
Rotates reference frame from Uz to newUz (unit vector). | |
void | Rotate (DataType alpha, const B2Vector3< DataType > &v) |
Rotation around an arbitrary axis v with angle alpha. | |
void | Abs () |
calculates the absolute value of the coordinates element-wise | |
void | Sqrt () |
calculates the square root of the absolute values of the coordinates element-wise | |
DataType | at (unsigned i) const |
safe member access (with boundary check!) | |
DataType | x () const |
access variable X (= .at(0) without boundary check) | |
DataType | y () const |
access variable Y (= .at(1) without boundary check) | |
DataType | z () const |
access variable Z (= .at(2) without boundary check) | |
DataType | X () const |
access variable X (= .at(0) without boundary check) | |
DataType | Y () const |
access variable Y (= .at(1) without boundary check) | |
DataType | Z () const |
access variable Z (= .at(2) without boundary check) | |
DataType | Px () const |
access variable X (= .at(0) without boundary check) | |
DataType | Py () const |
access variable Y (= .at(1) without boundary check) | |
DataType | Pz () const |
access variable Z (= .at(2) without boundary check) | |
void | GetXYZ (Double_t *carray) const |
directly copies coordinates to an array of double | |
void | GetXYZ (Float_t *carray) const |
directly copies coordinates to an array of float | |
void | GetXYZ (TVector3 *tVec) const |
directly copies coordinates to a TVector3 | |
void | GetXYZ (ROOT::Math::XYZVector *xyzVec) const |
directly copies coordinates to a XYZVector | |
TVector3 | GetTVector3 () const |
returns a TVector3 containing the same coordinates | |
ROOT::Math::XYZVector | GetXYZVector () const |
returns a XYZVector containing the same coordinates | |
void | SetX (DataType x) |
set X/1st-coordinate | |
void | SetY (DataType y) |
set Y/2nd-coordinate | |
void | SetZ (DataType z) |
set Z/3rd-coordinate | |
void | SetXYZ (DataType x, DataType y, DataType z) |
set all coordinates using data type | |
void | SetXYZ (const TVector3 &tVec) |
set all coordinates using a reference to TVector3 | |
void | SetXYZ (const TVector3 *tVec) |
set all coordinates using a pointer to TVector3 | |
void | SetXYZ (const ROOT::Math::XYZVector &xyzVec) |
set all coordinates using a reference to XYZVector | |
void | SetXYZ (const ROOT::Math::XYZVector *xyzVec) |
set all coordinates using a pointer to XYZVector | |
std::string | PrintString (unsigned precision=4) const |
create a string containing vector in cartesian and spherical coordinates | |
std::string | PrintStringXYZ (unsigned precision=4) const |
create a string containing vector in cartesian coordinates | |
std::string | PrintStringCyl (unsigned precision=4) const |
create a string containing vector in spherical coordinates | |
void | Print () |
just for backward compatibility, should not be used with new code | |
Static Public Member Functions | |
static DataType | Mpi_pi (DataType angle) |
returns given angle in the interval [-PI,PI) | |
static std::string | name () |
Returns the name of the B2Vector. | |
Protected Attributes | |
DataType | m_coordinates [3] |
Make sure that we only have floating point vectors. | |
A fast and root compatible alternative to TVector3.
Goals:
DataType: shall be the data type one wants to store in the B2Vector (e.g. double)
Definition at line 42 of file B2Vector3.h.
typedef DataType value_type |
storage type of the vector
Definition at line 50 of file B2Vector3.h.
|
inline |
empty Constructor sets everything to 0
Definition at line 53 of file B2Vector3.h.
|
inline |
Constructor expecting 3 coordinates.
Definition at line 55 of file B2Vector3.h.
|
inlineexplicit |
Constructor using a reference.
Definition at line 57 of file B2Vector3.h.
|
inlineexplicit |
Constructor using a pointer.
Definition at line 59 of file B2Vector3.h.
|
inline |
Constructor expecting a TVector3.
Definition at line 62 of file B2Vector3.h.
|
inline |
Constructor expecting a pointer to a TVector3.
Definition at line 65 of file B2Vector3.h.
Constructor expecting a B2Vector3 of same type.
Definition at line 67 of file B2Vector3.h.
Constructor expecting a pointer to a B2Vector3.
Definition at line 69 of file B2Vector3.h.
Constructor expecting a B2Vector3 of different type.
Definition at line 72 of file B2Vector3.h.
Constructor expecting a pointer to a B2Vector3 of different type.
Definition at line 75 of file B2Vector3.h.
|
inline |
Constructor expecting a XYZVector.
Definition at line 79 of file B2Vector3.h.
|
inline |
Constructor expecting a pointer to a XYZVector.
Definition at line 82 of file B2Vector3.h.
|
inline |
calculates the absolute value of the coordinates element-wise
Definition at line 406 of file B2Vector3.h.
|
inline |
The angle w.r.t.
another B2Vector3.
Definition at line 302 of file B2Vector3.h.
|
inline |
Cosine of the polar angle.
Definition at line 155 of file B2Vector3.h.
Cross product.
Definition at line 296 of file B2Vector3.h.
|
inline |
returns phi in the interval [-PI,PI)
Definition at line 228 of file B2Vector3.h.
|
inline |
return deltaR with respect to input-vector
Definition at line 245 of file B2Vector3.h.
|
inline |
Scalar product.
Definition at line 290 of file B2Vector3.h.
|
inline |
return DrEtaPhi with respect to input-vector
Definition at line 253 of file B2Vector3.h.
|
inline |
Returns the pseudo-rapidity.
Definition at line 331 of file B2Vector3.h.
|
inline |
The magnitude (rho in spherical coordinate system).
Definition at line 159 of file B2Vector3.h.
|
inline |
|
inlinestatic |
returns given angle in the interval [-PI,PI)
Definition at line 232 of file B2Vector3.h.
|
inline |
type conversion in ROOT::Math::XYZVector
Definition at line 103 of file B2Vector3.h.
|
inline |
type conversion in TVector3
Definition at line 101 of file B2Vector3.h.
Comparison != with a B2Vector3.
Definition at line 112 of file B2Vector3.h.
|
inline |
Comparison != with a XYZVector.
Definition at line 116 of file B2Vector3.h.
|
inline |
Comparison != with a TVector3.
Definition at line 114 of file B2Vector3.h.
|
inline |
|
inline |
|
inline |
|
inline |
Scaling of 3-vectors with a real number.
Definition at line 137 of file B2Vector3.h.
Addition of 3-vectors.
Definition at line 127 of file B2Vector3.h.
|
inline |
unary minus
Definition at line 125 of file B2Vector3.h.
Subtraction of 3-vectors.
Definition at line 132 of file B2Vector3.h.
|
inline |
Scaling of 3-vectors with a real number.
Definition at line 142 of file B2Vector3.h.
|
inline |
|
inline |
Comparison for equality with a XYZVector.
Definition at line 110 of file B2Vector3.h.
|
inline |
Comparison for equality with a TVector3.
Definition at line 108 of file B2Vector3.h.
|
inline |
|
inline |
|
inline |
Vector orthogonal to this one.
Definition at line 277 of file B2Vector3.h.
|
inline |
The transverse component (R in cylindrical coordinate system).
Definition at line 200 of file B2Vector3.h.
|
inline |
The transverse component w.r.t.
given axis.
Definition at line 226 of file B2Vector3.h.
|
inline |
|
inline |
|
inline |
|
inline |
just for backward compatibility, should not be used with new code
Definition at line 507 of file B2Vector3.h.
|
inline |
create a string containing vector in cartesian and spherical coordinates
Definition at line 481 of file B2Vector3.h.
|
inline |
create a string containing vector in spherical coordinates
Definition at line 497 of file B2Vector3.h.
|
inline |
create a string containing vector in cartesian coordinates
Definition at line 487 of file B2Vector3.h.
|
inline |
Returns the pseudo-rapidity, i.e.
-ln(tan(theta/2)).
for the sake of keeping compatibility to TVector3, the hardcoded values are not replaced by something more intelligent
Definition at line 319 of file B2Vector3.h.
|
inline |
The transverse component (R in cylindrical coordinate system).
Definition at line 198 of file B2Vector3.h.
|
inline |
|
inline |
access variable X (= .at(0) without boundary check)
Definition at line 437 of file B2Vector3.h.
|
inline |
access variable Y (= .at(1) without boundary check)
Definition at line 439 of file B2Vector3.h.
|
inline |
access variable Z (= .at(2) without boundary check)
Definition at line 441 of file B2Vector3.h.
|
inline |
Rotation around an arbitrary axis v with angle alpha.
With n = (n1, n2, n3)^T being the unit vector of v, the rotation matrix R(n, alpha) with ca = cos(alpha) and sa = sin(alpha) reads / n1^2*(1-ca)+ca n1*n2*(1-ca)-n3*sa n1*n3*(1-ca)+n2*sa \ R(n, alpha) = | n2*n1*(1-ca)+n3*sa n2^2*(1-ca)+ca n2*n3*(1-ca)-n1*sa | \ n3*n1*(1-ca)-n2*sa n3*n2*(1-ca)+n1*sa n3^2*(1-ca)+ca / . Using this rotation matrix, the full rotation of a vector b (= this) around the axis v by angle alpha can be written as R(n, alpha)*b = n(n*b) + cos(alpha) * (n x b) x n + sin(alpha) * (n x b).
Definition at line 399 of file B2Vector3.h.
|
inline |
Rotates reference frame from Uz to newUz (unit vector).
Definition at line 370 of file B2Vector3.h.
|
inline |
Rotates the B2Vector3 around the x-axis.
Definition at line 335 of file B2Vector3.h.
|
inline |
Rotates the B2Vector3 around the y-axis.
Definition at line 347 of file B2Vector3.h.
|
inline |
Rotates the B2Vector3 around the z-axis.
Definition at line 359 of file B2Vector3.h.
|
inline |
Set magnitude keeping theta and phi constant.
Definition at line 182 of file B2Vector3.h.
|
inline |
setter with mag, theta, phi
Definition at line 259 of file B2Vector3.h.
|
inline |
Set the transverse component keeping phi and z constant.
Definition at line 203 of file B2Vector3.h.
|
inline |
Set phi keeping mag and theta constant.
Definition at line 162 of file B2Vector3.h.
|
inline |
Set theta keeping mag and phi constant.
Definition at line 170 of file B2Vector3.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
calculates the square root of the absolute values of the coordinates element-wise
Definition at line 414 of file B2Vector3.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Make sure that we only have floating point vectors.
contains the coordinates in given data type
Definition at line 47 of file B2Vector3.h.