EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtVector3R.hh
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#ifndef EVTVECTOR3R_HH
22#define EVTVECTOR3R_HH
23
24#include <iosfwd>
25
26class EvtVector3R final {
27 friend EvtVector3R rotateEuler( const EvtVector3R& v, double phi,
28 double theta, double ksi );
29
30 inline friend EvtVector3R operator*( double c, const EvtVector3R& v2 );
31 inline friend double operator*( const EvtVector3R& v1, const EvtVector3R& v2 );
32 inline friend EvtVector3R operator+( const EvtVector3R& v1,
33 const EvtVector3R& v2 );
34 inline friend EvtVector3R operator-( const EvtVector3R& v1,
35 const EvtVector3R& v2 );
36 inline friend EvtVector3R operator*( const EvtVector3R& v1, double c );
37 inline friend EvtVector3R operator/( const EvtVector3R& v1, double c );
38 friend EvtVector3R cross( const EvtVector3R& v1, const EvtVector3R& v2 );
39
40 public:
42 EvtVector3R( double x, double y, double z );
43 inline EvtVector3R& operator*=( const double c );
44 inline EvtVector3R& operator/=( const double c );
45 inline EvtVector3R& operator+=( const EvtVector3R& v2 );
46 inline EvtVector3R& operator-=( const EvtVector3R& v2 );
47 inline void set( int i, double d );
48 inline void set( double x, double y, double z );
49 void applyRotateEuler( double phi, double theta, double ksi );
50 inline double get( int i ) const;
51 friend std::ostream& operator<<( std::ostream& s, const EvtVector3R& v );
52 double dot( const EvtVector3R& v2 );
53 double d3mag() const;
54
55 private:
56 double m_v[3];
57};
58
59inline EvtVector3R& EvtVector3R::operator*=( const double c )
60{
61 m_v[0] *= c;
62 m_v[1] *= c;
63 m_v[2] *= c;
64 return *this;
65}
66
67inline EvtVector3R& EvtVector3R::operator/=( const double c )
68{
69 m_v[0] /= c;
70 m_v[1] /= c;
71 m_v[2] /= c;
72 return *this;
73}
74
76{
77 m_v[0] += v2.m_v[0];
78 m_v[1] += v2.m_v[1];
79 m_v[2] += v2.m_v[2];
80 return *this;
81}
82
84{
85 m_v[0] -= v2.m_v[0];
86 m_v[1] -= v2.m_v[1];
87 m_v[2] -= v2.m_v[2];
88 return *this;
89}
90
91inline EvtVector3R operator*( double c, const EvtVector3R& v2 )
92{
93 return EvtVector3R( v2 ) *= c;
94}
95
96inline EvtVector3R operator*( const EvtVector3R& v1, double c )
97{
98 return EvtVector3R( v1 ) *= c;
99}
100
101inline EvtVector3R operator/( const EvtVector3R& v1, double c )
102{
103 return EvtVector3R( v1 ) /= c;
104}
105
106inline double operator*( const EvtVector3R& v1, const EvtVector3R& v2 )
107{
108 return v1.m_v[0] * v2.m_v[0] + v1.m_v[1] * v2.m_v[1] + v1.m_v[2] * v2.m_v[2];
109}
110
111inline EvtVector3R operator+( const EvtVector3R& v1, const EvtVector3R& v2 )
112{
113 return EvtVector3R( v1 ) += v2;
114}
115
116inline EvtVector3R operator-( const EvtVector3R& v1, const EvtVector3R& v2 )
117{
118 return EvtVector3R( v1 ) -= v2;
119}
120
121inline double EvtVector3R::get( int i ) const
122{
123 return m_v[i];
124}
125
126inline void EvtVector3R::set( int i, double d )
127{
128 m_v[i] = d;
129}
130
131inline void EvtVector3R::set( double x, double y, double z )
132{
133 m_v[0] = x;
134 m_v[1] = y;
135 m_v[2] = z;
136}
137
138#endif
EvtVector3R operator*(double c, const EvtVector3R &v2)
EvtVector3R operator/(const EvtVector3R &v1, double c)
EvtVector3R operator+(const EvtVector3R &v1, const EvtVector3R &v2)
EvtVector3R operator-(const EvtVector3R &v1, const EvtVector3R &v2)
double get(int i) const
friend EvtVector3R operator*(double c, const EvtVector3R &v2)
friend EvtVector3R rotateEuler(const EvtVector3R &v, double phi, double theta, double ksi)
friend EvtVector3R operator/(const EvtVector3R &v1, double c)
double dot(const EvtVector3R &v2)
void applyRotateEuler(double phi, double theta, double ksi)
EvtVector3R & operator*=(const double c)
double d3mag() const
EvtVector3R & operator-=(const EvtVector3R &v2)
EvtVector3R & operator/=(const double c)
EvtVector3R & operator+=(const EvtVector3R &v2)
double m_v[3]
void set(int i, double d)
friend EvtVector3R cross(const EvtVector3R &v1, const EvtVector3R &v2)
friend EvtVector3R operator+(const EvtVector3R &v1, const EvtVector3R &v2)
friend std::ostream & operator<<(std::ostream &s, const EvtVector3R &v)
friend EvtVector3R operator-(const EvtVector3R &v1, const EvtVector3R &v2)