BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/BesVisLib/BesVisLib/vector3.h File Reference

Go to the source code of this file.

Classes

struct  vector3
 
struct  polar
 

Functions

vector3 InitV (float x, float y, float z)
 
vector3 InitV1 (float phi, float cosTheta, float magnitude)
 
float Mag (vector3 v)
 
float Mag2 (vector3 v)
 
float Dot (vector3 v1, vector3 v2)
 
vector3 Cross (vector3 v1, vector3 v2)
 
vector3 Unit (vector3 v)
 
vector3 Intersection (float z0, vector3 vec, vector3 pos)
 
vector3 TimesA (float a, vector3 v)
 
vector3 AddV (vector3 v1, vector3 v2)
 
vector3 SubV (vector3 v1, vector3 v2)
 
vector3 TransformFrom (vector3 v, vector3 ux, vector3 uy, vector3 uz)
 
vector3 TransformTo (vector3 v, vector3 ux, vector3 uy, vector3 uz)
 
polar XYZ2Polar (vector3 v)
 

Variables

const float pi = 3.1415926536
 
const float rad = 57.29578
 

Function Documentation

◆ AddV()

vector3 AddV ( vector3  v1,
vector3  v2 
)

Definition at line 93 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

94{
95 vector3 v;
96 v.x = v1.x + v2.x;
97 v.y = v1.y + v2.y;
98 v.z = v1.z + v2.z;
99 return v;
100}
**********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

Referenced by TransformFrom().

◆ Cross()

vector3 Cross ( vector3  v1,
vector3  v2 
)

Definition at line 49 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

50{
51 vector3 v;
52 v.x = v1.y*v2.z - v1.z*v2.y;
53 v.y = v1.z*v2.x - v1.x*v2.z;
54 v.z = v1.x*v2.y - v1.y*v2.x;
55 return v;
56}

◆ Dot()

float Dot ( vector3  v1,
vector3  v2 
)

Definition at line 42 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

43{
44 return v1.x*v2.x+v1.y*v2.y+v1.z*v2.z;
45}

Referenced by TransformTo().

◆ InitV()

vector3 InitV ( float  x,
float  y,
float  z 
)

Definition at line 9 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

10{
11 vector3 v;
12 v.x = x;
13 v.y = y;
14 v.z = z;
15 return v;
16}
Double_t x[10]

◆ InitV1()

vector3 InitV1 ( float  phi,
float  cosTheta,
float  magnitude 
)

Definition at line 19 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

20{
21 vector3 v;
22 float sinTheta = sqrt(1.0-cosTheta*cosTheta);
23 v.z = magnitude*cosTheta;
24 v.y = magnitude*sinTheta*sin(phi);
25 v.x = magnitude*sinTheta*cos(phi);
26 return v;
27}
double sin(const BesAngle a)
double cos(const BesAngle a)

◆ Intersection()

vector3 Intersection ( float  z0,
vector3  vec,
vector3  pos 
)

Definition at line 72 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

73{
74 vector3 vz0;
75 vz0.z = z0;
76 vz0.x = (vz0.z - pos.z)*vec.x/vec.z + pos.x;
77 vz0.y = (vz0.z - pos.z)*vec.y/vec.z + pos.y;
78 return vz0;
79}

◆ Mag()

float Mag ( vector3  v)

Definition at line 30 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

31{
32 return sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
33}

Referenced by Unit().

◆ Mag2()

float Mag2 ( vector3  v)

Definition at line 36 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

37{
38 return v.x*v.x+v.y*v.y+v.z*v.z;
39}

◆ SubV()

vector3 SubV ( vector3  v1,
vector3  v2 
)

Definition at line 103 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

104{
105 vector3 v;
106 v.x = v1.x - v2.x;
107 v.y = v1.y - v2.y;
108 v.z = v1.z - v2.z;
109 return v;
110}

◆ TimesA()

vector3 TimesA ( float  a,
vector3  v 
)

Definition at line 83 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

84{
85 vector3 vv;
86 vv.x = a*v.x;
87 vv.y = a*v.y;
88 vv.z = a*v.z;
89 return vv;
90}

Referenced by TransformFrom().

◆ TransformFrom()

vector3 TransformFrom ( vector3  v,
vector3  ux,
vector3  uy,
vector3  uz 
)

Definition at line 113 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

114{
115 ux = TimesA(v.x,ux);
116 uy = TimesA(v.y,uy);
117 uz = TimesA(v.z,uz);
118 v = AddV(AddV(ux, uy), uz);
119 return v;
120}
vector3 AddV(vector3 v1, vector3 v2)
vector3 TimesA(float a, vector3 v)

◆ TransformTo()

vector3 TransformTo ( vector3  v,
vector3  ux,
vector3  uy,
vector3  uz 
)

Definition at line 124 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

125{
126 vector3 vv;
127 vv.x = Dot(v,ux);
128 vv.y = Dot(v,uy);
129 vv.z = Dot(v,uz);
130 return vv;
131}
float Dot(vector3 v1, vector3 v2)

◆ Unit()

vector3 Unit ( vector3  v)

Definition at line 59 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

60{
61 vector3 vv;
62 float p = Mag(v);
63 vv.x = v.x/p;
64 vv.y = v.y/p;
65 vv.z = v.z/p;
66 return vv;
67}

◆ XYZ2Polar()

polar XYZ2Polar ( vector3  v)

Definition at line 142 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

143{
144 polar s;
145 float rxy;
146
147 s.r = sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
148 if(s.r==0.0){
149 s.theta = 0.0;
150 }
151 else{
152 s.theta = acos(v.z/s.r);
153 }
154
155 rxy = sqrt(v.x*v.x+v.y*v.y);
156 if(rxy==0.0){
157 s.phi = 0.0;
158 }
159 else{
160 if(v.y>=0.0) s.phi = acos(v.x/rxy);
161 else{
162 s.phi = 2.0*pi-acos(v.x/rxy);
163 }
164 }
165
166 return s;
167}
XmlRpcServer s
Definition: HelloServer.cpp:11

Variable Documentation

◆ pi

const float pi = 3.1415926536

Definition at line 133 of file InstallArea/include/BesVisLib/BesVisLib/vector3.h.

Referenced by XYZ2Polar().

◆ rad

const float rad = 57.29578