CMS 3D CMS Logo

Classes | Namespaces | Typedefs | Functions | Variables
extBasic3DVector.h File Reference
#include "DataFormats/GeometryVector/interface/Basic2DVector.h"
#include "DataFormats/GeometryVector/interface/Theta.h"
#include "DataFormats/GeometryVector/interface/Phi.h"
#include "DataFormats/GeometryVector/interface/PreciseFloatType.h"
#include "DataFormats/GeometryVector/interface/CoordinateSets.h"
#include "DataFormats/Math/interface/ExtVec.h"
#include <iosfwd>
#include <cmath>
#include "Basic3DVectorLD.h"

Go to the source code of this file.

Classes

class  Basic3DVector< T >
 

Namespaces

 detailsBasic3DVector
 
 geometryDetails
 

Typedefs

typedef Basic3DVector< double > Basic3DVectorD
 
typedef Basic3DVector< float > Basic3DVectorF
 
typedef Geom::Cylindrical2Cartesian< TCylindrical
 
typedef Vec4< TMathVector
 
typedef Spherical Polar
 
typedef T ScalarType
 
typedef Geom::Spherical2Cartesian< TSpherical
 
typedef Vec4< TVectorType
 

Functions

template<typename T >
class Basic3DVector __attribute__ ((aligned(16)))
 
float detailsBasic3DVector::__attribute__ ((always_inline)) __attribute__((pure)) eta(float x
 
T barePhi () const
 
T bareTheta () const
 
 Basic3DVector ()
 
 Basic3DVector (const Basic2DVector< T > &p)
 constructor from 2D vector (X and Y from 2D vector, z set to zero) More...
 
 Basic3DVector (const Basic3DVector &p)
 Copy constructor from same type. Should not be needed but for gcc bug 12685. More...
 
template<class U >
 Basic3DVector (const Basic3DVector< U > &p)
 Copy constructor and implicit conversion from Basic3DVector of different precision. More...
 
template<typename U >
 Basic3DVector (const Geom::Theta< U > &theta, const Geom::Phi< U > &phi, const T &r)
 
template<class OtherPoint >
 Basic3DVector (const OtherPoint &p)
 
 Basic3DVector (const T &x, const T &y, const T &z, const T &w=0)
 construct from cartesian coordinates More...
 
template<class U >
 Basic3DVector (Vec4< U > const &iv)
 
Basic3DVector cross (const Basic3DVector &lh) const
 Vector product, or "cross" product, with a vector of same type. More...
 
template<class U >
Basic3DVector< typename PreciseFloatType< T, U >::Type > cross (const Basic3DVector< U > &lh) const
 
T dot (const Basic3DVector &rh) const
 Scalar product, or "dot" product, with a vector of same type. More...
 
template<class U >
PreciseFloatType< T, U >::Type dot (const Basic3DVector< U > &lh) const
 
T eta () const
 
T mag () const
 The vector magnitude. Equivalent to sqrt(vec.mag2()) More...
 
T mag2 () const
 The vector magnitude squared. Equivalent to vec.dot(vec) More...
 
MathVector const & mathVector () const
 
template<class T , typename S >
Basic3DVector< Toperator* (const Basic3DVector< T > &v, S t)
 
template<class T >
Basic3DVector< Toperator* (const Basic3DVector< T > &v, T t)
 
template<class T >
T operator* (const Basic3DVector< T > &v1, const Basic3DVector< T > &v2)
 scalar product of vectors of same precision More...
 
template<class T , class U >
PreciseFloatType< T, U >::Type operator* (const Basic3DVector< T > &v1, const Basic3DVector< U > &v2)
 scalar product of vectors of different precision More...
 
template<class T , typename S >
Basic3DVector< Toperator* (S t, const Basic3DVector< T > &v)
 
template<class T >
Basic3DVector< Toperator* (T t, const Basic3DVector< T > &v)
 Same as operator*( Vector, Scalar) More...
 
Basic3DVectoroperator*= (T t)
 Scaling by a scalar value (multiplication) More...
 
template<class T >
Basic3DVector< Toperator+ (const Basic3DVector< T > &a, const Basic3DVector< T > &b)
 vector sum and subtraction of vectors of possibly different precision More...
 
template<class T , class U >
Basic3DVector< typename PreciseFloatType< T, U >::Type > operator+ (const Basic3DVector< T > &a, const Basic3DVector< U > &b)
 
template<class U >
Basic3DVectoroperator+= (const Basic3DVector< U > &p)
 
Basic3DVector operator- () const
 Unary minus, returns a vector with components (-x(),-y(),-z()) More...
 
template<class T >
Basic3DVector< Toperator- (const Basic3DVector< T > &a, const Basic3DVector< T > &b)
 
template<class T , class U >
Basic3DVector< typename PreciseFloatType< T, U >::Type > operator- (const Basic3DVector< T > &a, const Basic3DVector< U > &b)
 
template<class U >
Basic3DVectoroperator-= (const Basic3DVector< U > &p)
 
template<class T , typename S >
Basic3DVector< Toperator/ (const Basic3DVector< T > &v, S s)
 
template<class T >
Basic3DVector< Toperator/ (const Basic3DVector< T > &v, T t)
 
Basic3DVectoroperator/= (T t)
 Scaling by a scalar value (division) More...
 
template<class T >
std::ostream & operator<< (std::ostream &s, const Basic3DVector< T > &v)
 simple text output to standard streams More...
 
bool operator== (const Basic3DVector &rh) const
 
T operator[] (int i) const
 
T perp () const
 Magnitude of transverse component. More...
 
T perp2 () const
 Squared magnitude of transverse component. More...
 
Geom::Phi< Tphi () const
 
std::ostream & geometryDetails::print3D (std::ostream &s, double x, double y, double z)
 
Geom::Theta< Ttheta () const
 
T transverse () const
 Another name for perp() More...
 
Basic3DVector unit () const
 
T w () const
 
T x () const
 Cartesian x coordinate. More...
 
Basic2DVector< Txy () const
 
T y () const
 Cartesian y coordinate. More...
 
T z () const
 Cartesian z coordinate. More...
 

Variables

Vec4< Tv
 
float float detailsBasic3DVector::y
 
float float float detailsBasic3DVector::z
 

Typedef Documentation

◆ Basic3DVectorD

typedef Basic3DVector<double> Basic3DVectorD

Definition at line 306 of file extBasic3DVector.h.

◆ Basic3DVectorF

typedef Basic3DVector<float> Basic3DVectorF

Definition at line 305 of file extBasic3DVector.h.

◆ Cylindrical

Definition at line 167 of file extBasic3DVector.h.

◆ MathVector

typedef Vec4<T> MathVector

Definition at line 166 of file extBasic3DVector.h.

◆ Polar

typedef Spherical Polar

Definition at line 169 of file extBasic3DVector.h.

◆ ScalarType

typedef T ScalarType

Definition at line 164 of file extBasic3DVector.h.

◆ Spherical

Definition at line 168 of file extBasic3DVector.h.

◆ VectorType

typedef Vec4<T> VectorType

Definition at line 165 of file extBasic3DVector.h.

Function Documentation

◆ __attribute__()

template<typename T >
class Basic3DVector __attribute__ ( (aligned(16))  )

◆ barePhi()

T __attribute__::barePhi ( ) const

Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. Same precision as the system atan2(x,y) function. The return type is Geom::Phi<T>, see it's documentation.

Definition at line 263 of file extBasic3DVector.h.

270 {

◆ bareTheta()

T __attribute__::bareTheta ( ) const

Polar angle. The value is returned in radians, in the range [0,pi] Same precision as the system atan2(x,y) function. The return type is Geom::Phi<T>, see it's documentation.

Definition at line 270 of file extBasic3DVector.h.

270 {

◆ Basic3DVector() [1/8]

__attribute__::Basic3DVector ( )

default constructor uses default constructor of T to initialize the components. For built-in floating-point types this means initialization to zero??? (force init to 0)

Definition at line 175 of file extBasic3DVector.h.

176 {

◆ Basic3DVector() [2/8]

__attribute__::Basic3DVector ( const Basic2DVector< T > &  p)

constructor from 2D vector (X and Y from 2D vector, z set to zero)

Definition at line 185 of file extBasic3DVector.h.

189 { return ::dot(v, rh.v); }

◆ Basic3DVector() [3/8]

__attribute__::Basic3DVector ( const Basic3DVector p)

Copy constructor from same type. Should not be needed but for gcc bug 12685.

Definition at line 178 of file extBasic3DVector.h.

182 {

◆ Basic3DVector() [4/8]

template<class U >
__attribute__::Basic3DVector ( const Basic3DVector< U > &  p)

Copy constructor and implicit conversion from Basic3DVector of different precision.

Definition at line 182 of file extBasic3DVector.h.

182 {

References submitPVValidationJobs::t, and Basic3DVector< T >::v.

◆ Basic3DVector() [5/8]

template<typename U >
__attribute__::Basic3DVector ( const Geom::Theta< U > &  theta,
const Geom::Phi< U > &  phi,
const T r 
)

Deprecated construct from polar coordinates, use
Basic3DVector<T>( Basic3DVector<T>::Polar( theta, phi, r)) instead.

Definition at line 212 of file extBasic3DVector.h.

216  :
217  Vec4<T> v;

◆ Basic3DVector() [6/8]

template<class OtherPoint >
__attribute__::Basic3DVector ( const OtherPoint &  p)
explicit

Explicit constructor from other (possibly unrelated) vector classes The only constraint on the argument type is that it has methods x(), y() and z(), and that these methods return a type convertible to T. Examples of use are
construction from a Basic3DVector with different precision
construction from a Hep3Vector
construction from a coordinate system converter

Definition at line 196 of file extBasic3DVector.h.

◆ Basic3DVector() [7/8]

__attribute__::Basic3DVector ( const T x,
const T y,
const T z,
const T w = 0 
)

construct from cartesian coordinates

Definition at line 205 of file extBasic3DVector.h.

◆ Basic3DVector() [8/8]

template<class U >
__attribute__::Basic3DVector ( Vec4< U > const &  iv)

Definition at line 202 of file extBasic3DVector.h.

203 { return ::cross3(v, lh.v); }

◆ cross() [1/2]

Basic3DVector __attribute__::cross ( const Basic3DVector lh) const

Vector product, or "cross" product, with a vector of same type.

Definition at line 335 of file extBasic3DVector.h.

◆ cross() [2/2]

template<class U >
Basic3DVector<typename PreciseFloatType<T, U>::Type> __attribute__::cross ( const Basic3DVector< U > &  lh) const

Vector (or cross) product with a vector of different precision. The product is computed without loss of precision. The type of the returned vector is the more precise of the types of the two vectors.

Definition at line 343 of file extBasic3DVector.h.

◆ dot() [1/2]

T __attribute__::dot ( const Basic3DVector rh) const

Scalar product, or "dot" product, with a vector of same type.

Definition at line 321 of file extBasic3DVector.h.

Referenced by Basic3DVector< align::Scalar >::dot(), and Basic3DVector< align::Scalar >::mag2().

◆ dot() [2/2]

template<class U >
PreciseFloatType<T, U>::Type __attribute__::dot ( const Basic3DVector< U > &  lh) const

Scalar (or dot) product with a vector of different precision. The product is computed without loss of precision. The type of the returned scalar is the more precise of the scalar types of the two vectors.

Definition at line 329 of file extBasic3DVector.h.

◆ eta()

T __attribute__::eta ( ) const

Pseudorapidity. Does not check for zero transverse component; in this case the behavior is as for divide-by zero, i.e. system-dependent.

Definition at line 278 of file extBasic3DVector.h.

281 {

Referenced by Basic3DVector< align::Scalar >::eta().

◆ mag()

T __attribute__::mag ( ) const

The vector magnitude. Equivalent to sqrt(vec.mag2())

Definition at line 248 of file extBasic3DVector.h.

249 {

◆ mag2()

T __attribute__::mag2 ( ) const

The vector magnitude squared. Equivalent to vec.dot(vec)

Definition at line 245 of file extBasic3DVector.h.

◆ mathVector()

MathVector & mathVector ( ) const

Definition at line 219 of file extBasic3DVector.h.

220 {

References geometryDetails::print3D(), and alignCSCRings::s.

◆ operator*() [1/6]

template<class T , typename S >
Basic3DVector<T> operator* ( const Basic3DVector< T > &  v,
S  t 
)
inline

Definition at line 286 of file extBasic3DVector.h.

286  {
287  return static_cast<T>(t) * v;
288 }

References submitPVValidationJobs::t, and v.

◆ operator*() [2/6]

template<class T >
Basic3DVector<T> operator* ( const Basic3DVector< T > &  v,
T  t 
)
inline

Multiplication by scalar, does not change the precision of the vector. The return type is the same as the type of the vector argument.

Definition at line 270 of file extBasic3DVector.h.

270  {
271  return v.v * t;
272 }

◆ operator*() [3/6]

template<class T >
T operator* ( const Basic3DVector< T > &  v1,
const Basic3DVector< T > &  v2 
)
inline

scalar product of vectors of same precision

Definition at line 256 of file extBasic3DVector.h.

256  {
257  return v1.dot(v2);
258 }

◆ operator*() [4/6]

template<class T , class U >
PreciseFloatType<T, U>::Type operator* ( const Basic3DVector< T > &  v1,
const Basic3DVector< U > &  v2 
)
inline

scalar product of vectors of different precision

Definition at line 262 of file extBasic3DVector.h.

262  {
263  return v1.dot(v2);
264 }

◆ operator*() [5/6]

template<class T , typename S >
Basic3DVector<T> operator* ( S  t,
const Basic3DVector< T > &  v 
)
inline

Definition at line 281 of file extBasic3DVector.h.

281  {
282  return static_cast<T>(t) * v;
283 }

References submitPVValidationJobs::t, and v.

◆ operator*() [6/6]

template<class T >
Basic3DVector<T> operator* ( T  t,
const Basic3DVector< T > &  v 
)
inline

Same as operator*( Vector, Scalar)

Definition at line 276 of file extBasic3DVector.h.

276  {
277  return v.v * t;
278 }

References submitPVValidationJobs::t, and v.

◆ operator*=()

Basic3DVector& __attribute__::operator*= ( T  t)

Scaling by a scalar value (multiplication)

Definition at line 308 of file extBasic3DVector.h.

◆ operator+() [1/2]

template<class T >
Basic3DVector<T> operator+ ( const Basic3DVector< T > &  a,
const Basic3DVector< T > &  b 
)
inline

vector sum and subtraction of vectors of possibly different precision

Definition at line 232 of file extBasic3DVector.h.

232  {
233  return a.v + b.v;
234 }

◆ operator+() [2/2]

template<class T , class U >
Basic3DVector<typename PreciseFloatType<T, U>::Type> operator+ ( const Basic3DVector< T > &  a,
const Basic3DVector< U > &  b 
)
inline

Definition at line 241 of file extBasic3DVector.h.

242  {
244  return RT(a).v + RT(b).v;
245 }

References a, b, and Basic3DVector< T >::v.

◆ operator+=()

template<class U >
Basic3DVector& __attribute__::operator+= ( const Basic3DVector< U > &  p)

Operator += with a Basic3DVector of possibly different precision.

Definition at line 291 of file extBasic3DVector.h.

294  {

◆ operator-() [1/3]

Basic3DVector __attribute__::operator- ( ) const

Unary minus, returns a vector with components (-x(),-y(),-z())

Definition at line 305 of file extBasic3DVector.h.

◆ operator-() [2/3]

template<class T >
Basic3DVector<T> operator- ( const Basic3DVector< T > &  a,
const Basic3DVector< T > &  b 
)
inline

Definition at line 236 of file extBasic3DVector.h.

236  {
237  return a.v - b.v;
238 }

◆ operator-() [3/3]

template<class T , class U >
Basic3DVector<typename PreciseFloatType<T, U>::Type> operator- ( const Basic3DVector< T > &  a,
const Basic3DVector< U > &  b 
)
inline

Definition at line 248 of file extBasic3DVector.h.

249  {
251  return RT(a).v - RT(b).v;
252 }

◆ operator-=()

template<class U >
Basic3DVector& __attribute__::operator-= ( const Basic3DVector< U > &  p)

Operator -= with a Basic3DVector of possibly different precision.

Definition at line 299 of file extBasic3DVector.h.

299  {
300  // T t = S(1)/s; return v*t;
301  T t = s;
302  return v / t;

◆ operator/() [1/2]

template<class T , typename S >
Basic3DVector<T> operator/ ( const Basic3DVector< T > &  v,
S  s 
)
inline

Definition at line 299 of file extBasic3DVector.h.

299  {
300  // T t = S(1)/s; return v*t;
301  T t = s;
302  return v / t;
303 }

References alignCSCRings::s, submitPVValidationJobs::t, and v.

◆ operator/() [2/2]

template<class T >
Basic3DVector<T> operator/ ( const Basic3DVector< T > &  v,
T  t 
)
inline

Division by scalar, does not change the precision of the vector. The return type is the same as the type of the vector argument.

Definition at line 294 of file extBasic3DVector.h.

294  {
295  return v.v / t;
296 }

References submitPVValidationJobs::t, and v.

◆ operator/=()

Basic3DVector& __attribute__::operator/= ( T  t)

Scaling by a scalar value (division)

Definition at line 314 of file extBasic3DVector.h.

◆ operator<<()

template<class T >
std::ostream& operator<< ( std::ostream &  s,
const Basic3DVector< T > &  v 
)
inline

simple text output to standard streams

Definition at line 226 of file extBasic3DVector.h.

226  {
227  return geometryDetails::print3D(s, v.x(), v.y(), v.z());
228 }

◆ operator==()

bool __attribute__::operator== ( const Basic3DVector rh) const

Definition at line 239 of file extBasic3DVector.h.

242  {

◆ operator[]()

T & operator[] ( int  i) const

◆ perp()

T __attribute__::perp ( ) const

Magnitude of transverse component.

Definition at line 254 of file extBasic3DVector.h.

256 {

◆ perp2()

T __attribute__::perp2 ( ) const

Squared magnitude of transverse component.

Definition at line 251 of file extBasic3DVector.h.

256 {

◆ phi()

Geom::Phi<T> __attribute__::phi ( ) const

Definition at line 264 of file extBasic3DVector.h.

270 {

◆ theta()

Geom::Theta<T> __attribute__::theta ( ) const

Definition at line 271 of file extBasic3DVector.h.

276 {

◆ transverse()

T __attribute__::transverse ( ) const

Another name for perp()

Definition at line 257 of file extBasic3DVector.h.

◆ unit()

Basic3DVector __attribute__::unit ( ) const

Unit vector parallel to this. If mag() is zero, a zero vector is returned.

Definition at line 283 of file extBasic3DVector.h.

286  {

◆ w()

T __attribute__::w ( ) const

Definition at line 234 of file extBasic3DVector.h.

236 {

◆ x()

T __attribute__::x ( ) const

Cartesian x coordinate.

Definition at line 226 of file extBasic3DVector.h.

226 {

References geometryDetails::print3D(), alignCSCRings::s, and v.

◆ xy()

Basic2DVector<T> __attribute__::xy ( ) const

Definition at line 236 of file extBasic3DVector.h.

236 {

References a, and b.

Referenced by Basic3DVector< align::Scalar >::xy().

◆ y()

T __attribute__::y ( ) const

Cartesian y coordinate.

Definition at line 229 of file extBasic3DVector.h.

232 {

◆ z()

T __attribute__::z ( ) const

Cartesian z coordinate.

Definition at line 232 of file extBasic3DVector.h.

232 {

References a, and b.

Variable Documentation

◆ v

Vec4<T> v

Definition at line 349 of file extBasic3DVector.h.

Referenced by operator*(), operator/(), and x().

Vec4
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:64
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
alignCSCRings.s
s
Definition: alignCSCRings.py:92
geometryDetails::print3D
std::ostream & print3D(std::ostream &s, double x, double y, double z)
Definition: print.cc:5
Basic3DVector::dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:189
dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:321
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
Basic3DVector::v
Vec4< T > v
Definition: extBasic3DVector.h:217
T
long double T
Definition: Basic3DVectorLD.h:48
v
Vec4< T > v
Definition: extBasic3DVector.h:349
cross3
Vec cross3(Vec x, Vec y)
Definition: ExtVec.h:91
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
Basic3DVector
Definition: extBasic3DVector.h:30