Line data Source code
1 : //--------------------------------------------------------------------------
2 : //
3 : // Environment:
4 : // This software is part of the EvtGen package developed jointly
5 : // for the BaBar and CLEO collaborations. If you use all or part
6 : // of it, please give an appropriate acknowledgement.
7 : //
8 : // Copyright Information: See EvtGen/COPYRIGHT
9 : // Copyright (C) 1998 Caltech, UCSB
10 : //
11 : // Module: EvtVector3C.cc
12 : //
13 : // Description: Complex 3 vectors.
14 : //
15 : // Modification history:
16 : //
17 : // RYD September 5, 1997 Module created
18 : //
19 : //------------------------------------------------------------------------
20 : //
21 : #include "EvtGenBase/EvtPatches.hh"
22 : #include <iostream>
23 : #include <math.h>
24 : #include "EvtGenBase/EvtComplex.hh"
25 : #include "EvtGenBase/EvtVector3C.hh"
26 : using std::ostream;
27 :
28 :
29 :
30 :
31 0 : EvtVector3C::EvtVector3C(){
32 :
33 0 : v[0]=EvtComplex(0.0); v[1]=EvtComplex(0.0); v[2]=EvtComplex(0.0);
34 0 : }
35 :
36 0 : EvtVector3C::~EvtVector3C(){
37 :
38 0 : return;
39 0 : }
40 :
41 :
42 0 : EvtVector3C::EvtVector3C(const EvtComplex& e1,const EvtComplex& e2,const EvtComplex& e3){
43 :
44 0 : v[0]=e1; v[1]=e2; v[2]=e3;
45 0 : }
46 :
47 :
48 : EvtVector3C EvtVector3C::cross( const EvtVector3C& p2 ){
49 :
50 : //Calcs the cross product. Added by djl on July 27, 1995.
51 :
52 0 : EvtVector3C temp;
53 :
54 0 : temp.v[0] = v[1]*p2.v[2] - v[2]*p2.v[1];
55 0 : temp.v[1] = v[2]*p2.v[0] - v[0]*p2.v[2];
56 0 : temp.v[2] = v[0]*p2.v[1] - v[1]*p2.v[0];
57 :
58 : return temp;
59 0 : }
60 :
61 : EvtVector3C rotateEuler(const EvtVector3C& v,
62 : double alpha,double beta,double gamma){
63 :
64 0 : EvtVector3C tmp(v);
65 0 : tmp.applyRotateEuler(alpha,beta,gamma);
66 : return tmp;
67 :
68 0 : }
69 :
70 :
71 : void EvtVector3C::applyRotateEuler(double phi,double theta,double ksi){
72 :
73 0 : EvtComplex temp[3];
74 : double sp,st,sk,cp,ct,ck;
75 :
76 0 : sp=sin(phi);
77 0 : st=sin(theta);
78 0 : sk=sin(ksi);
79 0 : cp=cos(phi);
80 0 : ct=cos(theta);
81 0 : ck=cos(ksi);
82 :
83 0 : temp[0]=( ck*ct*cp-sk*sp)*v[0]+( -sk*ct*cp-ck*sp)*v[1]+st*cp*v[2];
84 0 : temp[1]=( ck*ct*sp+sk*cp)*v[0]+(-sk*ct*sp+ck*cp)*v[1]+st*sp*v[2];
85 0 : temp[2]=-ck*st*v[0]+sk*st*v[1]+ct*v[2];
86 :
87 :
88 0 : v[0]=temp[0];
89 0 : v[1]=temp[1];
90 0 : v[2]=temp[2];
91 0 : }
92 :
93 :
94 :
95 : ostream& operator<<(ostream& s,const EvtVector3C& v){
96 :
97 0 : s<<"("<<v.v[0]<<","<<v.v[1]<<","<<v.v[2]<<")";
98 :
99 0 : return s;
100 : }
101 :
102 :
|