EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenBase
EvtVector3R.cpp
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
#include "
EvtGenBase/EvtVector3R.hh
"
22
23
#include <iostream>
24
#include <math.h>
25
using
std::ostream;
26
27
EvtVector3R::EvtVector3R
()
28
{
29
m_v
[0] =
m_v
[1] =
m_v
[2] = 0.0;
30
}
31
32
EvtVector3R::EvtVector3R
(
double
x,
double
y,
double
z )
33
{
34
m_v
[0] = x;
35
m_v
[1] = y;
36
m_v
[2] = z;
37
}
38
39
EvtVector3R
rotateEuler
(
const
EvtVector3R
& v,
double
alpha,
double
beta,
40
double
gamma )
41
{
42
EvtVector3R
tmp( v );
43
tmp.
applyRotateEuler
( alpha, beta, gamma );
44
return
tmp;
45
}
46
47
void
EvtVector3R::applyRotateEuler
(
double
phi,
double
theta,
double
ksi )
48
{
49
double
temp[3];
50
double
sp, st, sk, cp, ct, ck;
51
52
sp = sin( phi );
53
st = sin( theta );
54
sk = sin( ksi );
55
cp = cos( phi );
56
ct = cos( theta );
57
ck = cos( ksi );
58
59
temp[0] = ( ck * ct * cp - sk * sp ) *
m_v
[0] +
60
( -sk * ct * cp - ck * sp ) *
m_v
[1] + st * cp *
m_v
[2];
61
temp[1] = ( ck * ct * sp + sk * cp ) *
m_v
[0] +
62
( -sk * ct * sp + ck * cp ) *
m_v
[1] + st * sp *
m_v
[2];
63
temp[2] = -ck * st *
m_v
[0] + sk * st *
m_v
[1] + ct *
m_v
[2];
64
65
m_v
[0] = temp[0];
66
m_v
[1] = temp[1];
67
m_v
[2] = temp[2];
68
}
69
70
ostream&
operator<<
( ostream& s,
const
EvtVector3R
& v )
71
{
72
s <<
"("
<< v.
m_v
[0] <<
","
<< v.
m_v
[1] <<
","
<< v.
m_v
[2] <<
")"
;
73
74
return
s;
75
}
76
77
EvtVector3R
cross
(
const
EvtVector3R
& p1,
const
EvtVector3R
& p2 )
78
{
79
//Calcs the cross product. Added by djl on July 27, 1995.
80
//Modified for real vectros by ryd Aug 28-96
81
82
return
EvtVector3R
( p1.
m_v
[1] * p2.
m_v
[2] - p1.
m_v
[2] * p2.
m_v
[1],
83
p1.
m_v
[2] * p2.
m_v
[0] - p1.
m_v
[0] * p2.
m_v
[2],
84
p1.
m_v
[0] * p2.
m_v
[1] - p1.
m_v
[1] * p2.
m_v
[0] );
85
}
86
87
double
EvtVector3R::d3mag
()
const
88
{
89
// Returns the 3 momentum mag
90
double
temp;
91
92
temp =
m_v
[0] *
m_v
[0] +
m_v
[1] *
m_v
[1] +
m_v
[2] *
m_v
[2];
93
temp = sqrt( temp );
94
95
return
temp;
96
}
97
98
double
EvtVector3R::dot
(
const
EvtVector3R
& p2 )
99
{
100
double
temp;
101
102
temp =
m_v
[0] * p2.
m_v
[0];
103
temp +=
m_v
[1] * p2.
m_v
[1];
104
temp +=
m_v
[2] * p2.
m_v
[2];
105
106
return
temp;
107
}
rotateEuler
EvtVector3R rotateEuler(const EvtVector3R &v, double alpha, double beta, double gamma)
Definition
EvtVector3R.cpp:39
cross
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
Definition
EvtVector3R.cpp:77
operator<<
ostream & operator<<(ostream &s, const EvtVector3R &v)
Definition
EvtVector3R.cpp:70
EvtVector3R.hh
EvtVector3R
Definition
EvtVector3R.hh:26
EvtVector3R::dot
double dot(const EvtVector3R &v2)
Definition
EvtVector3R.cpp:98
EvtVector3R::applyRotateEuler
void applyRotateEuler(double phi, double theta, double ksi)
Definition
EvtVector3R.cpp:47
EvtVector3R::d3mag
double d3mag() const
Definition
EvtVector3R.cpp:87
EvtVector3R::m_v
double m_v[3]
Definition
EvtVector3R.hh:56
EvtVector3R::EvtVector3R
EvtVector3R()
Definition
EvtVector3R.cpp:27
Generated by
1.17.0