![]() |
Belle II Software development
|
A three dimensional vector. More...
#include <Vector3D.h>
Public Member Functions | |
| Vector3D () | |
| Default constructor for ROOT compatibility. | |
| Vector3D (const TVector3 &tVector3) | |
| Constructor translating from a TVector3 instance. | |
| Vector3D (const B2Vector3D &b2Vector3) | |
| Constructor translating from a B2Vector3 instance. | |
| Vector3D (const ROOT::Math::XYZVector &xyzVector) | |
| Constructor translating from a ROOT::Math::XYZVector instance. | |
| Vector3D (double x, double y, double z) | |
| Constructor from three coordinates. | |
| Vector3D (const Vector2D &xy) | |
| Constructor augmeting a Vector2D to a Vector3D setting z to zero. | |
| Vector3D (const Vector2D &xy, double z) | |
| Constructor augmeting a Vector2D to a Vector3D setting z explicitly. | |
| Vector3D & | operator= (const TVector3 &tVector3) |
| Assignment translating from a TVector3 instance. | |
| Vector3D & | operator= (const B2Vector3D &b2Vector3) |
| Assignment translating from a B2Vector3 instance. | |
| Vector3D & | operator= (const ROOT::Math::XYZVector &xyzVector) |
| Assignment translating from a ROOT::Math::XYZVector instance. | |
| operator const TVector3 () const | |
| Casting the back to TVector3 seamlessly. | |
| operator const B2Vector3D () const | |
| Casting the back to B2Vector3 seamlessly. | |
| operator const ROOT::Math::XYZVector () const | |
| Casting the back to ROOT::Math::XYZVector seamlessly. | |
| bool | operator== (const Vector3D &rhs) const |
| Equality comparison with all three coordinates. | |
| bool | operator< (const Vector3D &rhs) const |
| Total ordering based on cylindrical radius first the z component second and azimuth angle third. | |
| bool | isNull () const |
| Checks if the vector is the null vector. | |
| bool | hasNAN () const |
| Checks if one of the coordinates is NAN. | |
| std::string | __str__ () const |
| Output operator for python. | |
| double | dot (const Vector3D &rhs) const |
| Calculates the three dimensional dot product. | |
| double | Dot (const Vector3D &rhs) const |
| Calculates the three dimensional dot product, ROOT::Math compatible. | |
| double | dotXY (const Vector3D &rhs) const |
| Calculates the two dimensional dot product in xy projection. | |
| Vector3D | cross (const Vector3D &rhs) const |
| Calculated the three dimensional cross product. | |
| double | crossXY (const Vector3D &rhs) const |
| Calculates the two dimensional cross product in xy projection. | |
| double | crossXY (const Vector2D &rhs) const |
| Calculates the two dimensional cross product in xy projection. | |
| double | normSquared () const |
| Calculates the squared length of the vector. | |
| double | Mag2 () const |
| Alias for normSquared. | |
| double | norm () const |
| Calculates the length of the vector. | |
| double | distance (const Vector3D &rhs=Vector3D(0.0, 0.0, 0.0)) const |
| Calculates the distance of this point to the rhs. | |
| Vector3D & | scale (const double factor) |
| Scales the vector in place by the given factor. | |
| Vector3D & | operator*= (const double factor) |
| Same as scale() | |
| Vector3D | scaled (const double factor) const |
| Returns a scaled copy of the vector. | |
| Vector3D | operator* (const double factor) const |
| Same as scaled() | |
| Vector3D & | divide (const double denominator) |
| Divides all coordinates by a common denominator in place. | |
| Vector3D & | operator/= (const double denominator) |
| Same as divide() | |
| Vector3D | divided (const double denominator) const |
| Returns a copy where all coordinates got divided by a common denominator. | |
| Vector3D | operator/ (const double denominator) const |
| Same as divided() | |
| Vector3D & | add (const Vector3D &rhs) |
| Adds a vector to this in place. | |
| Vector3D & | add (const Vector2D &rhs) |
| Adds a two dimensional vector to this in place taking z of the given vector as zero. | |
| Vector3D & | operator+= (const Vector3D &rhs) |
| Same as add() | |
| Vector3D & | operator+= (const Vector2D &rhs) |
| Same as add() | |
| Vector3D & | subtract (const Vector3D &rhs) |
| Subtracts a vector to this in place. | |
| Vector3D & | subtract (const Vector2D &rhs) |
| Subtracts a two dimensional vector from this in place taking z of the given vector as zero. | |
| Vector3D & | operator-= (const Vector3D &rhs) |
| Same as subtract() | |
| Vector3D & | operator-= (const Vector2D &rhs) |
| Same as subtract() | |
| Vector3D | unit () const |
| Returns a unit vector colaligned with this. | |
| double | normalize () |
| Normalizes the vector to unit length. | |
| double | normalizeTo (const double toLength) |
| Normalizes the vector to the given length. | |
| Vector3D & | reverse () |
| Reverses the direction of the vector in place. | |
| Vector3D | reversed () const |
| Returns a vector pointing in the opposite direction. | |
| Vector3D | operator- () const |
| Same as reversed() | |
| Vector3D | operator+ (const Vector3D &rhs) const |
| Returns a new vector as sum of this and rhs. | |
| Vector3D | operator- (const Vector3D &rhs) const |
| Returns a new vector as difference of this and rhs. | |
| double | parallelComp (const Vector3D &relativTo) const |
| Calculates the component parallel to the given vector. | |
| double | unnormalizedParallelComp (const Vector3D &relativTo) const |
| Same as parallelComp() but assumes the given vector to be of unit length. | |
| double | orthogonalComp (const Vector3D &relativTo) const |
| Calculates the component orthogonal to the given vector. | |
| Vector3D | orthogonalVector (const Vector3D &relativTo) const |
| Calculates the part of this vector that is orthogonal to the given vector. | |
| double | unnormalizedOrthogonalComp (const Vector3D &relativTo) const |
| Same as orthogonalComp() but assumes the given vector to be of unit length. | |
| void | passiveMoveBy (const Vector3D &by) |
| Passively moves the vector inplace by the given vector. | |
| Vector3D | passiveMovedBy (const Vector3D &by) |
| Passively moves the vector inplace by the given vector. | |
| double | x () const |
| Getter for the x coordinate. | |
| void | setX (const double x) |
| Setter for the x coordinate. | |
| double | y () const |
| Getter for the y coordinate. | |
| void | setY (const double y) |
| Setter for the y coordinate. | |
| double | z () const |
| Getter for the z coordinate. | |
| void | setZ (const double z) |
| Setter for the z coordinate. | |
| const Vector2D & | xy () const |
| Getter for the xy projected vector ( reference ! ) | |
| void | setXY (const Vector2D &xy) |
| Setter for the xy projected vector. | |
| void | set (const double first, const double second, const double third) |
| Setter for all three coordinates. | |
| double | cylindricalRSquared () const |
| Getter for the squared cylindrical radius ( xy projected squared norm ) | |
| double | cylindricalR () const |
| Getter for the cylindrical radius ( xy projected norm ) | |
| double | phi () const |
| Getter for the azimuth angle. | |
| double | theta () const |
| Getter for the polar angle. | |
| double | lambda () const |
| Getter for lambda. | |
| double | cotTheta () const |
| Getter for the cotangent of the polar angle. | |
| double | tanLambda () const |
| Getter for the tangent of lambda equivalent to cotTheta() | |
Angle functions | |
These functions measure the angle between two vectors from this to rhs.
| |
| double | cosWith (const Vector3D &rhs) const |
| double | sinWith (const Vector3D &rhs) const |
| Sine of the angle between this and rhs. | |
| double | angleWith (const Vector3D &rhs) const |
| The angle between this and rhs. | |
Static Public Member Functions | |
| static Vector3D | average (const Vector3D &one, const Vector3D &two) |
| Constructs the average of two vectors. | |
| static Vector3D | average (const Vector3D &one, const Vector3D &two, const Vector3D &three) |
| Constructs the average of three vectors. | |
| static Vector3D | getLowest () |
| Getter for the lowest possible vector. | |
Private Attributes | |
| Vector2D | m_xy |
| Memory for the first and second coordinate available as a vector. | |
| double | m_z |
| Memory for the third coordinate. | |
A three dimensional vector.
A three dimensional vector which is equipped with the expected vector methods.
Also this vector can be passed to functions where a TVector3 is expected syntactically.
Definition at line 34 of file Vector3D.h.
|
inline |
Default constructor for ROOT compatibility.
Definition at line 38 of file Vector3D.h.
|
explicit |
Constructor translating from a TVector3 instance.
Definition at line 20 of file Vector3D.cc.
|
explicit |
Constructor translating from a B2Vector3 instance.
Definition at line 26 of file Vector3D.cc.
| Vector3D | ( | const ROOT::Math::XYZVector & | xyzVector | ) |
Constructor translating from a ROOT::Math::XYZVector instance.
Definition at line 32 of file Vector3D.cc.
|
inline |
Constructor from three coordinates.
Definition at line 54 of file Vector3D.h.
Constructor augmeting a Vector2D to a Vector3D setting z to zero.
Definition at line 61 of file Vector3D.h.
Constructor augmeting a Vector2D to a Vector3D setting z explicitly.
Definition at line 68 of file Vector3D.h.
| std::string __str__ | ( | ) | const |
Output operator for python.
Definition at line 82 of file Vector3D.cc.
Adds a two dimensional vector to this in place taking z of the given vector as zero.
Definition at line 324 of file Vector3D.h.
Adds a vector to this in place.
Definition at line 316 of file Vector3D.h.
|
inline |
The angle between this and rhs.
Definition at line 248 of file Vector3D.h.
Constructs the average of two vectors.
Computes the average of two vectors. If one vector contains NAN the average is the other vector, since the former is not considered a valid value.
Definition at line 88 of file Vector3D.h.
|
inlinestatic |
Constructs the average of three vectors.
Computes the average of three vectors. In case one of the three dimensional vectors contains an NAN, it is not considered a valid value for the average and is therefore left out. The average() of the other two vectors is then returned.
Definition at line 107 of file Vector3D.h.
|
inline |
Cosine of the angle between this and rhs
Definition at line 236 of file Vector3D.h.
|
inline |
Getter for the cotangent of the polar angle.
Definition at line 563 of file Vector3D.h.
Calculated the three dimensional cross product.
Definition at line 192 of file Vector3D.h.
|
inline |
Calculates the two dimensional cross product in xy projection.
Definition at line 206 of file Vector3D.h.
|
inline |
Calculates the two dimensional cross product in xy projection.
Definition at line 200 of file Vector3D.h.
|
inline |
Getter for the cylindrical radius ( xy projected norm )
Definition at line 539 of file Vector3D.h.
|
inline |
Getter for the squared cylindrical radius ( xy projected squared norm )
Definition at line 533 of file Vector3D.h.
Calculates the distance of this point to the rhs.
Definition at line 255 of file Vector3D.h.
|
inline |
Divides all coordinates by a common denominator in place.
Definition at line 290 of file Vector3D.h.
|
inline |
Returns a copy where all coordinates got divided by a common denominator.
Definition at line 304 of file Vector3D.h.
|
inline |
Calculates the three dimensional dot product, ROOT::Math compatible.
Definition at line 180 of file Vector3D.h.
|
inline |
Calculates the three dimensional dot product.
Definition at line 175 of file Vector3D.h.
|
inline |
Calculates the two dimensional dot product in xy projection.
Definition at line 186 of file Vector3D.h.
|
inlinestatic |
Getter for the lowest possible vector.
The lowest possible vector according to the comparison is the null vector
Definition at line 154 of file Vector3D.h.
|
inline |
Checks if one of the coordinates is NAN.
Definition at line 166 of file Vector3D.h.
|
inline |
Checks if the vector is the null vector.
Definition at line 160 of file Vector3D.h.
|
inline |
Getter for lambda.
Definition at line 557 of file Vector3D.h.
|
inline |
Alias for normSquared.
Definition at line 217 of file Vector3D.h.
|
inline |
Calculates the length of the vector.
Definition at line 223 of file Vector3D.h.
|
inline |
Normalizes the vector to unit length.
Normalizes the vector to unit length and returns the length the vector had before.
The null vector is not transformed.
Definition at line 378 of file Vector3D.h.
|
inline |
Normalizes the vector to the given length.
Normalizes the vector to the given length and returns the length the vector had before.
The null vector is not transformed.
Definition at line 388 of file Vector3D.h.
|
inline |
Calculates the squared length of the vector.
Definition at line 212 of file Vector3D.h.
| operator const B2Vector3D | ( | ) | const |
Casting the back to B2Vector3 seamlessly.
Definition at line 67 of file Vector3D.cc.
| operator const ROOT::Math::XYZVector | ( | ) | const |
Casting the back to ROOT::Math::XYZVector seamlessly.
Definition at line 72 of file Vector3D.cc.
| operator const TVector3 | ( | ) | const |
Casting the back to TVector3 seamlessly.
Definition at line 62 of file Vector3D.cc.
|
inline |
|
inline |
Returns a new vector as sum of this and rhs.
Definition at line 415 of file Vector3D.h.
|
inline |
Same as reversed()
Definition at line 409 of file Vector3D.h.
Returns a new vector as difference of this and rhs.
Definition at line 421 of file Vector3D.h.
|
inline |
Same as divided()
Definition at line 310 of file Vector3D.h.
|
inline |
Same as divide()
Definition at line 298 of file Vector3D.h.
|
inline |
Total ordering based on cylindrical radius first the z component second and azimuth angle third.
Total order achieving a lower bound Vector3D(0.0, 0.0, 0.0). By first taking the norm
for comparison the null vector is smaller than all other possible
vectors. Secondly the polar angle theta ( equivalently z ) and finally the azimuth
angle phi is considered to have a total ordering for all vectors.
Note does not commute with the projection to xy space.
Definition at line 146 of file Vector3D.h.
| Vector3D & operator= | ( | const B2Vector3D & | b2Vector3 | ) |
Assignment translating from a B2Vector3 instance.
Definition at line 46 of file Vector3D.cc.
| Vector3D & operator= | ( | const ROOT::Math::XYZVector & | xyzVector | ) |
| Vector3D & operator= | ( | const TVector3 & | tVector3 | ) |
|
inline |
Equality comparison with all three coordinates.
Definition at line 133 of file Vector3D.h.
|
inline |
Calculates the component orthogonal to the given vector.
The orthogonal component is the rest of the vector not parallel to
relative to. Since the three dimensional space does not have a unique
orientation given by the vector relative to, the sign of the orthogonal
component is meaningless and is always set to positive
Definition at line 445 of file Vector3D.h.
Calculates the part of this vector that is orthogonal to the given vector.
Definition at line 451 of file Vector3D.h.
|
inline |
Calculates the component parallel to the given vector.
Definition at line 427 of file Vector3D.h.
|
inline |
Passively moves the vector inplace by the given vector.
Definition at line 465 of file Vector3D.h.
Passively moves the vector inplace by the given vector.
Definition at line 471 of file Vector3D.h.
|
inline |
Getter for the azimuth angle.
Definition at line 545 of file Vector3D.h.
|
inline |
Reverses the direction of the vector in place.
Definition at line 396 of file Vector3D.h.
|
inline |
Returns a vector pointing in the opposite direction.
Definition at line 403 of file Vector3D.h.
|
inline |
Scales the vector in place by the given factor.
Definition at line 264 of file Vector3D.h.
|
inline |
Returns a scaled copy of the vector.
Definition at line 278 of file Vector3D.h.
|
inline |
Setter for all three coordinates.
Definition at line 525 of file Vector3D.h.
|
inline |
Setter for the x coordinate.
Definition at line 483 of file Vector3D.h.
|
inline |
Setter for the xy projected vector.
Definition at line 519 of file Vector3D.h.
|
inline |
Setter for the y coordinate.
Definition at line 495 of file Vector3D.h.
|
inline |
|
inline |
Sine of the angle between this and rhs.
Definition at line 242 of file Vector3D.h.
Subtracts a two dimensional vector from this in place taking z of the given vector as zero.
Definition at line 351 of file Vector3D.h.
Subtracts a vector to this in place.
Definition at line 343 of file Vector3D.h.
|
inline |
Getter for the tangent of lambda equivalent to cotTheta()
Definition at line 569 of file Vector3D.h.
|
inline |
Getter for the polar angle.
Definition at line 551 of file Vector3D.h.
|
inline |
Returns a unit vector colaligned with this.
Definition at line 370 of file Vector3D.h.
|
inline |
Same as orthogonalComp() but assumes the given vector to be of unit length.
This assumes the given vector relativeTo to be of unit length and avoids
a costly computation of the vector norm()
Definition at line 459 of file Vector3D.h.
|
inline |
Same as parallelComp() but assumes the given vector to be of unit length.
This assumes the given vector relativeTo to be of unit length and avoids
a costly computation of the vector norm()
Definition at line 435 of file Vector3D.h.
|
inline |
Getter for the x coordinate.
Definition at line 477 of file Vector3D.h.
|
inline |
Getter for the xy projected vector ( reference ! )
Definition at line 513 of file Vector3D.h.
|
inline |
Getter for the y coordinate.
Definition at line 489 of file Vector3D.h.
|
inline |
|
private |
Memory for the first and second coordinate available as a vector.
Definition at line 576 of file Vector3D.h.
|
private |
Memory for the third coordinate.
Definition at line 579 of file Vector3D.h.