20{
21
22
23
24
25
26
30
31
32 if (m<100*CLHEP::keV) {
33 m_x.reset ( (Genfun::FixedConstant(x0.x()) + (CLHEP::c_light*
p0.x()/
p0.vect().mag())*t).clone() );
34 m_y.reset ( (Genfun::FixedConstant(x0.y()) + (CLHEP::c_light*
p0.y()/
p0.vect().mag())*t).clone() );
35 m_z.reset ( (Genfun::FixedConstant(x0.z()) + (CLHEP::c_light*
p0.z()/
p0.vect().mag())*t).clone() );
36 m_px.reset ( Genfun::FixedConstant(
p0.x()).clone() );
37 m_py.reset ( Genfun::FixedConstant(
p0.y()).clone() );
38 m_pz.reset ( Genfun::FixedConstant(
p0.z()).clone() );
39
40
41 }
42 else {
43
44 Genfun::RKIntegrator rkIntegrator;
45 Genfun::Variable Px(0,6),Py(1,6), Pz(2,6),
X(3,6),
Y(4,6),
Z(5,6);
46 Genfun::FixedConstant
I(1.0);
47
48 const double inv_E = 1. /
E;
49 Genfun::GENFUNCTION DPxDt = (
q*inv_E)*(Py*(
I%
I%
I%Bz) -Pz*(
I%
I%
I%By))*CLHEP::c_light;
50 Genfun::GENFUNCTION DPyDt = (
q*inv_E)*(Pz*(
I%
I%
I%Bx) -Px*(
I%
I%
I%Bz))*CLHEP::c_light;
51 Genfun::GENFUNCTION DPzDt = (
q*inv_E)*(Px*(
I%
I%
I%By) -Py*(
I%
I%
I%Bx))*CLHEP::c_light;
52 Genfun::GENFUNCTION DxDt = Px*inv_E;
53 Genfun::GENFUNCTION DyDt = Py*inv_E;
54 Genfun::GENFUNCTION DzDt = Pz*inv_E;
55
56 rkIntegrator.addDiffEquation(&DPxDt,
"Px",
p0.x(),
p0.x(),
p0.x());
57 rkIntegrator.addDiffEquation(&DPyDt,
"Py",
p0.y(),
p0.y(),
p0.y());
58 rkIntegrator.addDiffEquation(&DPzDt,
"Pz",
p0.z(),
p0.z(),
p0.z());
59 rkIntegrator.addDiffEquation(&DxDt, "x", x0.x(), x0.x(), x0.x());
60 rkIntegrator.addDiffEquation(&DyDt, "y", x0.y(), x0.y(), x0.y());
61 rkIntegrator.addDiffEquation(&DzDt, "z", x0.z(), x0.z(), x0.z());
62
63
64
65 m_px.reset ( (*rkIntegrator.getFunction(0))(CLHEP::c_light*t).clone() );
66 m_py.reset ( (*rkIntegrator.getFunction(1))(CLHEP::c_light*t).clone() );
67 m_pz.reset ( (*rkIntegrator.getFunction(2))(CLHEP::c_light*t).clone() );
68 m_x.reset ( (*rkIntegrator.getFunction(3))(CLHEP::c_light*t).clone() );
69 m_y.reset ( (*rkIntegrator.getFunction(4))(CLHEP::c_light*t).clone() );
70 m_z.reset ( (*rkIntegrator.getFunction(5))(CLHEP::c_light*t).clone() );
71 }
72}
std::unique_ptr< const Genfun::AbsFunction > m_py
std::unique_ptr< const Genfun::AbsFunction > m_x
std::unique_ptr< const Genfun::AbsFunction > m_z
std::unique_ptr< const Genfun::AbsFunction > m_pz
std::unique_ptr< const Genfun::AbsFunction > m_y
std::unique_ptr< const Genfun::AbsFunction > m_px