evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
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 
23 #include "EvtGenBase/EvtComplex.hh"
24 #include "EvtGenBase/EvtPatches.hh"
25 
26 #include <iostream>
27 #include <math.h>
28 using std::ostream;
29 
31 {
32  v[0] = EvtComplex( 0.0 );
33  v[1] = EvtComplex( 0.0 );
34  v[2] = EvtComplex( 0.0 );
35 }
36 
38  const EvtComplex& e3 )
39 {
40  v[0] = e1;
41  v[1] = e2;
42  v[2] = e3;
43 }
44 
46 {
47  //Calcs the cross product. Added by djl on July 27, 1995.
48 
49  EvtVector3C temp;
50 
51  temp.v[0] = v[1] * p2.v[2] - v[2] * p2.v[1];
52  temp.v[1] = v[2] * p2.v[0] - v[0] * p2.v[2];
53  temp.v[2] = v[0] * p2.v[1] - v[1] * p2.v[0];
54 
55  return temp;
56 }
57 
58 EvtVector3C rotateEuler( const EvtVector3C& v, double alpha, double beta,
59  double gamma )
60 {
61  EvtVector3C tmp( v );
62  tmp.applyRotateEuler( alpha, beta, gamma );
63  return tmp;
64 }
65 
66 void EvtVector3C::applyRotateEuler( double phi, double theta, double ksi )
67 {
68  EvtComplex temp[3];
69  double sp, st, sk, cp, ct, ck;
70 
71  sp = sin( phi );
72  st = sin( theta );
73  sk = sin( ksi );
74  cp = cos( phi );
75  ct = cos( theta );
76  ck = cos( ksi );
77 
78  temp[0] = ( ck * ct * cp - sk * sp ) * v[0] +
79  ( -sk * ct * cp - ck * sp ) * v[1] + st * cp * v[2];
80  temp[1] = ( ck * ct * sp + sk * cp ) * v[0] +
81  ( -sk * ct * sp + ck * cp ) * v[1] + st * sp * v[2];
82  temp[2] = -ck * st * v[0] + sk * st * v[1] + ct * v[2];
83 
84  v[0] = temp[0];
85  v[1] = temp[1];
86  v[2] = temp[2];
87 }
88 
89 ostream& operator<<( ostream& s, const EvtVector3C& v )
90 {
91  s << "(" << v.v[0] << "," << v.v[1] << "," << v.v[2] << ")";
92 
93  return s;
94 }
EvtVector3C cross(const EvtVector3C &v2)
Definition: EvtVector3C.cpp:45
EvtComplex v[3]
Definition: EvtVector3C.hh:69
ostream & operator<<(ostream &s, const EvtVector3C &v)
Definition: EvtVector3C.cpp:89
EvtVector3C rotateEuler(const EvtVector3C &v, double alpha, double beta, double gamma)
Definition: EvtVector3C.cpp:58
void applyRotateEuler(double phi, double theta, double ksi)
Definition: EvtVector3C.cpp:66