27 const Double_t PI = 3.14159265358979323846;
30 Double_t Theta0 = ThetaInBeamSystem;
31 Double_t Phi0 = PhiInBeamSystem;
33 Double_t alpha = BeamDirectionAtVertexPhi;
34 Double_t beta = BeamDirectionAtVertexTheta;
37 Double_t px = sin(Theta0) * cos(Phi0);
38 Double_t py = sin(Theta0) * sin(Phi0);
39 Double_t pz = cos(Theta0);
41 Double_t sa = sin(alpha);
42 Double_t ca = cos(alpha);
43 Double_t sb = sin(beta);
44 Double_t cb = cos(beta);
45 Double_t sg = sin(gamma);
46 Double_t cg = cos(gamma);
48 Double_t px_1 = px * (ca * cb * cg - sa * sg) + py * (-ca * cb * sg - sa * cg) + pz * (ca * sb);
49 Double_t py_1 = px * (sa * cb * cg + ca * sg) + py * (-sa * cb * sg + ca * cg) + pz * (sa * sb);
50 Double_t pz_1 = px * (-sb * cg) + py * (sb * sg) + pz * (cb);
52 Double_t pxy_1 = sqrt(px_1 * px_1 + py_1 * py_1);
53 Double_t sithe1 = pxy_1;
54 Double_t cothe1 = pz_1;
56 Double_t theta_1 = atan2(sithe1, cothe1);
58 ThetaInLabSystem = theta_1;
63 Double_t siphi1 = py_1 / pxy_1;
64 Double_t cophi1 = px_1 / pxy_1;
65 phi_1 = atan2(siphi1, cophi1);
68 phi_1 = 2. * PI + phi_1;
76 PhiInLabSystem = phi_1;
83 std::cout <<
"Beam direction in the Lab frame:" << std::endl
84 <<
" theta=" << BeamDirectionAtVertexTheta <<
", phi=" << BeamDirectionAtVertexPhi << std::endl;
85 std::cout <<
"Particle direction in the beam system:" << std::endl
86 <<
" theta=" << ThetaInBeamSystem <<
", phi=" << PhiInBeamSystem << std::endl;
87 std::cout <<
"Particle direction in the Lab system:" << std::endl
88 <<
" theta=" << ThetaInLabSystem <<
", phi=" << PhiInLabSystem << std::endl;