test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VectorDoublet.h
Go to the documentation of this file.
1 #ifndef VectorDoublet_H
2 #define VectorDoublet_H
3 
6 
7 template <class V1, class V2>
9 public:
10 
11  typedef typename V1::ScalarType Scalar1;
12  typedef typename V2::ScalarType Scalar2;
13 
15  VectorDoublet( const V1& a, const V2& b) : a_(a), b_(b) {}
16 
17  const V1& first() const {return a_;}
18  const V2& second() const {return b_;}
19 
21  a_ += v.first();
22  b_ += v.second();
23  return *this;
24  }
26  a_ -= v.first();
27  b_ -= v.second();
28  return *this;
29  }
30 
31  VectorDoublet operator-() const { return VectorDoublet( -a_, -b_);}
32 
33  template <class T>
35  a_ *= t;
36  b_ *= t;
37  return *this;
38  }
39  template <class T>
41  a_ /= t;
42  b_ /= t;
43  return *this;
44  }
45 
47  return first()*v.first() + second()*v.second();
48  }
49 
50 private:
51 
52  V1 a_;
53  V2 b_;
54 
55 };
56 
58 template <class V1, class V2>
61  return VectorDoublet<V1,V2>(a.first()+b.first(), a.second()+b.second());
62 }
63 
64 template <class V1, class V2>
67  return VectorDoublet<V1,V2>(a.first()-b.first(), a.second()-b.second());
68 }
69 
73 template <class V1, class V2, class Scalar>
75  return VectorDoublet<V1,V2>( v.first()*s, v.second()*s);
76 }
77 template <class V1, class V2, class Scalar>
79  return VectorDoublet<V1,V2>( v.first()*s, v.second()*s);
80 }
81 
82 template <class V1, class V2, class Scalar>
84  return VectorDoublet<V1,V2>( v.first()/s, v.second()/s);
85 }
86 
87 #endif
Basic3DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
VectorDoublet(const V1 &a, const V2 &b)
Definition: VectorDoublet.h:15
double Scalar
Definition: Definitions.h:27
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Basic3DVector & operator-=(const Basic3DVector< U > &p)
T ScalarType
const V1 & first() const
Definition: VectorDoublet.h:17
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
U second(std::pair< T, U > const &p)
V1::ScalarType Scalar1
Definition: VectorDoublet.h:11
V2::ScalarType Scalar2
Definition: VectorDoublet.h:12
PreciseFloatType< Scalar1, Scalar2 >::Type dot(const VectorDoublet &v) const
Definition: VectorDoublet.h:46
const V2 & second() const
Definition: VectorDoublet.h:18
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
double b
Definition: hdecay.h:120
#define dso_internal
double a
Definition: hdecay.h:121
VectorDoublet operator-() const
Definition: VectorDoublet.h:31
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
long double T
Basic3DVector & operator+=(const Basic3DVector< U > &p)