-
Notifications
You must be signed in to change notification settings - Fork 1
/
kinematics.cpp
65 lines (51 loc) · 1.77 KB
/
kinematics.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "header.h"
double fRand(const double& fMin, const double& fMax)
{
double f = (double)rand() / RAND_MAX;
return fMin + f * (fMax - fMin);
}
double q(const double& W)
{
if(channel){return sqrt((W*W + m_pi0*m_pi0 - m_p*m_p)*(W*W + m_pi0*m_pi0 - m_p*m_p)/(4*W*W) - m_pi0*m_pi0);}
else{return sqrt((W*W + m_pip*m_pip - m_n*m_n)*(W*W + m_pip*m_pip - m_n*m_n)/(4*W*W) - m_pip*m_pip);}
}
double k(const double& W)
{
return (W*W - m_p*m_p)/(2*W);
}
double k_mod(const double& W, const double& Q2)
{
return sqrt(Q2 + pow(W*W - m_p*m_p - Q2, 2)/(4*W*W));
}
double Eq(const double& W, const double& Q2) /* virtual photon energy in cm */
{
return (W*W - Q2 - m_p*m_p)/(2*W);
}
double lambda_q(const double& W, const double& Q2)
{
return 4*W*W*(Eq(W, Q2)*Eq(W, Q2) + Q2);
}
double E1(const double& W, const double& Q2) /* init. electron energy in cm */
{
return (2*E0*m_p - Q2)/(2*W);
}
double E2(const double& W) /* final electron energy in cm */
{
return (2*E0*m_p - W*W + m_p*m_p)/(2*W);
}
double cos_1(const double& W, const double& Q2) /* cos(theta)_1 - for polar angle of init. electron */
{
return ((2*E0*m_p - Q2)*(W*W - Q2 - m_p*m_p) + 2*Q2*W*W)/(2*W*sqrt(E1(W, Q2)*E1(W, Q2) - m_e*m_e)*sqrt(lambda_q(W, Q2)));
}
double cos_2(const double& W, const double& Q2) /* cos(theta)_2 - for polar angle of final electron */
{
return ((2*E0*m_p - W*W + m_p*m_p)*(W*W - Q2 - m_p*m_p) - 2*Q2*W*W)/(2*W*sqrt(E2(W)*E2(W) - m_e*m_e)*sqrt(lambda_q(W, Q2)));
}
double sin_1(const double& W, const double& Q2) /* sin(theta)_1 - for polar angle of init. electron */
{
return sqrt(1 - cos_1(W, Q2)*cos_1(W, Q2));
}
double sin_2(const double& W, const double& Q2) /* sin(theta)_2 - for polar angle of final electron */
{
return sqrt(1 - cos_2(W, Q2)*cos_2(W, Q2));
}