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
EvtVector3C.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
22
24
25#include <iostream>
26#include <math.h>
27using std::ostream;
28
30{
31 m_v[0] = EvtComplex( 0.0 );
32 m_v[1] = EvtComplex( 0.0 );
33 m_v[2] = EvtComplex( 0.0 );
34}
35
37 const EvtComplex& e3 )
38{
39 m_v[0] = e1;
40 m_v[1] = e2;
41 m_v[2] = e3;
42}
43
45{
46 //Calcs the cross product. Added by djl on July 27, 1995.
47
48 EvtVector3C temp;
49
50 temp.m_v[0] = m_v[1] * p2.m_v[2] - m_v[2] * p2.m_v[1];
51 temp.m_v[1] = m_v[2] * p2.m_v[0] - m_v[0] * p2.m_v[2];
52 temp.m_v[2] = m_v[0] * p2.m_v[1] - m_v[1] * p2.m_v[0];
53
54 return temp;
55}
56
57EvtVector3C rotateEuler( const EvtVector3C& v, double alpha, double beta,
58 double gamma )
59{
60 EvtVector3C tmp( v );
61 tmp.applyRotateEuler( alpha, beta, gamma );
62 return tmp;
63}
64
65void EvtVector3C::applyRotateEuler( double phi, double theta, double ksi )
66{
67 EvtComplex temp[3];
68 double sp, st, sk, cp, ct, ck;
69
70 sp = sin( phi );
71 st = sin( theta );
72 sk = sin( ksi );
73 cp = cos( phi );
74 ct = cos( theta );
75 ck = cos( ksi );
76
77 temp[0] = ( ck * ct * cp - sk * sp ) * m_v[0] +
78 ( -sk * ct * cp - ck * sp ) * m_v[1] + st * cp * m_v[2];
79 temp[1] = ( ck * ct * sp + sk * cp ) * m_v[0] +
80 ( -sk * ct * sp + ck * cp ) * m_v[1] + st * sp * m_v[2];
81 temp[2] = -ck * st * m_v[0] + sk * st * m_v[1] + ct * m_v[2];
82
83 m_v[0] = temp[0];
84 m_v[1] = temp[1];
85 m_v[2] = temp[2];
86}
87
88ostream& operator<<( ostream& s, const EvtVector3C& v )
89{
90 s << "(" << v.m_v[0] << "," << v.m_v[1] << "," << v.m_v[2] << ")";
91
92 return s;
93}
EvtVector3C rotateEuler(const EvtVector3C &v, double alpha, double beta, double gamma)
ostream & operator<<(ostream &s, const EvtVector3C &v)
EvtComplex m_v[3]
EvtVector3C cross(const EvtVector3C &v2)
void applyRotateEuler(double phi, double theta, double ksi)