CMS 3D CMS Logo

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  typedef typename V1::ScalarType Scalar1;
11  typedef typename V2::ScalarType Scalar2;
12 
14  VectorDoublet(const V1& a, const V2& b) : a_(a), b_(b) {}
15 
16  const V1& first() const { return a_; }
17  const V2& second() const { return b_; }
18 
20  a_ += v.first();
21  b_ += v.second();
22  return *this;
23  }
25  a_ -= v.first();
26  b_ -= v.second();
27  return *this;
28  }
29 
30  VectorDoublet operator-() const { return VectorDoublet(-a_, -b_); }
31 
32  template <class T>
34  a_ *= t;
35  b_ *= t;
36  return *this;
37  }
38  template <class T>
40  a_ /= t;
41  b_ /= t;
42  return *this;
43  }
44 
46  return first() * v.first() + second() * v.second();
47  }
48 
49 private:
50  V1 a_;
51  V2 b_;
52 };
53 
55 template <class V1, class V2>
57  return VectorDoublet<V1, V2>(a.first() + b.first(), a.second() + b.second());
58 }
59 
60 template <class V1, class V2>
62  return VectorDoublet<V1, V2>(a.first() - b.first(), a.second() - b.second());
63 }
64 
68 template <class V1, class V2, class Scalar>
70  return VectorDoublet<V1, V2>(v.first() * s, v.second() * s);
71 }
72 template <class V1, class V2, class Scalar>
74  return VectorDoublet<V1, V2>(v.first() * s, v.second() * s);
75 }
76 
77 template <class V1, class V2, class Scalar>
79  return VectorDoublet<V1, V2>(v.first() / s, v.second() / s);
80 }
81 
82 #endif
Visibility.h
VectorDoublet::operator/=
VectorDoublet & operator/=(const T &t)
Definition: VectorDoublet.h:39
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
VectorDoublet::VectorDoublet
VectorDoublet(const V1 &a, const V2 &b)
Definition: VectorDoublet.h:14
findQualityFiles.v
v
Definition: findQualityFiles.py:179
VectorDoublet::second
const V2 & second() const
Definition: VectorDoublet.h:17
dqmdumpme.first
first
Definition: dqmdumpme.py:55
align::Scalar
double Scalar
Definition: Definitions.h:25
operator+
VectorDoublet< V1, V2 > operator+(const VectorDoublet< V1, V2 > &a, const VectorDoublet< V1, V2 > &b)
vector sum and subtraction
Definition: VectorDoublet.h:56
operator-
VectorDoublet< V1, V2 > operator-(const VectorDoublet< V1, V2 > &a, const VectorDoublet< V1, V2 > &b)
Definition: VectorDoublet.h:61
alignCSCRings.s
s
Definition: alignCSCRings.py:92
VectorDoublet::first
const V1 & first() const
Definition: VectorDoublet.h:16
PreciseFloatType.h
OrderedSet.t
t
Definition: OrderedSet.py:90
operator/
VectorDoublet< V1, V2 > operator/(const VectorDoublet< V1, V2 > &v, const Scalar &s)
Definition: VectorDoublet.h:78
b
double b
Definition: hdecay.h:118
VectorDoublet::operator-=
VectorDoublet & operator-=(const VectorDoublet &v)
Definition: VectorDoublet.h:24
a
double a
Definition: hdecay.h:119
VectorDoublet::b_
V2 b_
Definition: VectorDoublet.h:51
ScalarType
T ScalarType
Definition: Basic3DVectorLD.h:49
VectorDoublet::Scalar1
V1::ScalarType Scalar1
Definition: VectorDoublet.h:10
operator*
VectorDoublet< V1, V2 > operator*(const VectorDoublet< V1, V2 > &v, const Scalar &s)
Definition: VectorDoublet.h:69
VectorDoublet::operator-
VectorDoublet operator-() const
Definition: VectorDoublet.h:30
dso_internal
#define dso_internal
Definition: Visibility.h:13
VectorDoublet::dot
PreciseFloatType< Scalar1, Scalar2 >::Type dot(const VectorDoublet &v) const
Definition: VectorDoublet.h:45
VectorDoublet::operator+=
VectorDoublet & operator+=(const VectorDoublet &v)
Definition: VectorDoublet.h:19
PreciseFloatType::Type
double Type
Definition: PreciseFloatType.h:24
VectorDoublet::Scalar2
V2::ScalarType Scalar2
Definition: VectorDoublet.h:11
T
long double T
Definition: Basic3DVectorLD.h:48
VectorDoublet::a_
V1 a_
Definition: VectorDoublet.h:50
VectorDoublet::VectorDoublet
VectorDoublet()
Definition: VectorDoublet.h:13
VectorDoublet
Definition: VectorDoublet.h:8
VectorDoublet::operator*=
VectorDoublet & operator*=(const T &t)
Definition: VectorDoublet.h:33