BOSS 8.0.0
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//
22#include "EvtVector3R.hh"
23#include "EvtPatches.hh"
24#include <iostream>
25#include <math.h>
26using std::ostream;
27
29
30EvtVector3R::EvtVector3R() { v[0] = v[1] = v[2] = 0.0; }
31
32EvtVector3R::EvtVector3R( double x, double y, double z ) {
33
34 v[0] = x;
35 v[1] = y;
36 v[2] = z;
37}
38
39EvtVector3R rotateEuler( const EvtVector3R& v, double alpha, double beta, double gamma ) {
40
41 EvtVector3R tmp( v );
42 tmp.applyRotateEuler( alpha, beta, gamma );
43 return tmp;
44}
45
46void EvtVector3R::applyRotateEuler( double phi, double theta, double ksi ) {
47
48 double temp[3];
49 double sp, st, sk, cp, ct, ck;
50
51 sp = sin( phi );
52 st = sin( theta );
53 sk = sin( ksi );
54 cp = cos( phi );
55 ct = cos( theta );
56 ck = cos( ksi );
57
58 temp[0] =
59 ( ck * ct * cp - sk * sp ) * v[0] + ( -sk * ct * cp - ck * sp ) * v[1] + st * cp * v[2];
60 temp[1] =
61 ( ck * ct * sp + sk * cp ) * v[0] + ( -sk * ct * sp + ck * cp ) * v[1] + st * sp * v[2];
62 temp[2] = -ck * st * v[0] + sk * st * v[1] + ct * v[2];
63
64 v[0] = temp[0];
65 v[1] = temp[1];
66 v[2] = temp[2];
67}
68
69ostream& operator<<( ostream& s, const EvtVector3R& v ) {
70
71 s << "(" << v.v[0] << "," << v.v[1] << "," << v.v[2] << ")";
72
73 return s;
74}
75
77
78 // Calcs the cross product. Added by djl on July 27, 1995.
79 // Modified for real vectros by ryd Aug 28-96
80
81 return EvtVector3R( p1.v[1] * p2.v[2] - p1.v[2] * p2.v[1],
82 p1.v[2] * p2.v[0] - p1.v[0] * p2.v[2],
83 p1.v[0] * p2.v[1] - p1.v[1] * p2.v[0] );
84}
85
86double EvtVector3R::d3mag() const
87
88// returns the 3 momentum mag.
89{
90 double temp;
91
92 temp = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
93 temp = sqrt( temp );
94
95 return temp;
96} // r3mag
97
99
100 double temp;
101
102 temp = v[0] * p2.v[0];
103 temp += v[1] * p2.v[1]; // 2010-2-22,pingrg: corrected
104 temp += v[2] * p2.v[2];
105
106 return temp;
107} // dot
double p2[4]
double p1[4]
double alpha
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)
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()