CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtVector3R.cc
Go to the documentation of this file.
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: EvtVector3R.cc
12//
13// Description: Real implementation of 3-vectors
14//
15// Modification history:
16// pingrg Feb. 22, 2011 correct EvtVector3R::dot
17//
18// RYD September 5, 1997 Module created
19//
20//------------------------------------------------------------------------
21//
23#include <iostream>
24#include <math.h>
26using std::ostream;
27
28
29
31
33
34 v[0]=v[1]=v[2]=0.0;
35}
36
37
38EvtVector3R::EvtVector3R(double x,double y, double z){
39
40 v[0]=x; v[1]=y; v[2]=z;
41}
42
44 double alpha,double beta,double gamma){
45
46 EvtVector3R tmp(v);
47 tmp.applyRotateEuler(alpha,beta,gamma);
48 return tmp;
49
50}
51
52
53void EvtVector3R::applyRotateEuler(double phi,double theta,double ksi){
54
55 double temp[3];
56 double sp,st,sk,cp,ct,ck;
57
58 sp=sin(phi);
59 st=sin(theta);
60 sk=sin(ksi);
61 cp=cos(phi);
62 ct=cos(theta);
63 ck=cos(ksi);
64
65 temp[0]=( ck*ct*cp-sk*sp)*v[0]+( -sk*ct*cp-ck*sp)*v[1]+st*cp*v[2];
66 temp[1]=( ck*ct*sp+sk*cp)*v[0]+(-sk*ct*sp+ck*cp)*v[1]+st*sp*v[2];
67 temp[2]=-ck*st*v[0]+sk*st*v[1]+ct*v[2];
68
69
70 v[0]=temp[0];
71 v[1]=temp[1];
72 v[2]=temp[2];
73}
74
75ostream& operator<<(ostream& s,const EvtVector3R& v){
76
77 s<<"("<<v.v[0]<<","<<v.v[1]<<","<<v.v[2]<<")";
78
79 return s;
80
81}
82
83
85
86 //Calcs the cross product. Added by djl on July 27, 1995.
87 //Modified for real vectros by ryd Aug 28-96
88
89 return EvtVector3R(p1.v[1]*p2.v[2] - p1.v[2]*p2.v[1],
90 p1.v[2]*p2.v[0] - p1.v[0]*p2.v[2],
91 p1.v[0]*p2.v[1] - p1.v[1]*p2.v[0]);
92
93}
94
95double EvtVector3R::d3mag() const
96
97// returns the 3 momentum mag.
98{
99 double temp;
100
101 temp = v[0]*v[0]+v[1]*v[1]+v[2]*v[2];
102 temp = sqrt( temp );
103
104 return temp;
105} // r3mag
106
107double EvtVector3R::dot ( const EvtVector3R& p2 ){
108
109 double temp;
110
111 temp = v[0]*p2.v[0];
112 temp += v[1]*p2.v[1]; //2010-2-22,pingrg: corrected
113 temp += v[2]*p2.v[2];
114
115 return temp;
116} //dot
117
118
119
120
121
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
Double_t x[10]
EvtVector3R rotateEuler(const EvtVector3R &v, double alpha, double beta, double gamma)
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
ostream & operator<<(ostream &s, const EvtVector3R &v)
const double alpha
XmlRpcServer s
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
double dot(const EvtVector3R &v2)
void applyRotateEuler(double phi, double theta, double ksi)
double d3mag() const
virtual ~EvtVector3R()