62{
63
64
65
66
67
68
71
79
85
87
88
89
90
91 if( (std::fabs(R_1) < 1e-10)||(Bmag<1e-12) )
92 {
94
95
96
100 }
101 else
102 {
103 Bnorm = (1.0/Bmag)*Bfld;
104
105
106
107 B_x_P = Bnorm.
cross(initTangent);
108
109
110
111 B_d_P = Bnorm.
dot(initTangent);
112
113 vpar = B_d_P * Bnorm;
114 vperp= initTangent - vpar;
115
116 B_v_P = std::sqrt( 1 - B_d_P * B_d_P);
117
118
119
120 Theta = R_1 * h;
121
122
123
124 if( std::fabs(Theta) > approc_limit )
125 {
126 SinT = std::sin(Theta);
127 CosT = std::cos(Theta);
128 }
129 else
130 {
134 SinT = Theta - 1.0/6.0 * Theta3;
135 CosT = 1 - 0.5 * Theta2 + 1.0/24.0 * Theta4;
136 }
137
138
139
141
142 positionMove = R * ( SinT * vperp + (1-CosT) * B_x_P) + h * vpar;
143 endTangent = CosT * vperp + SinT * B_x_P + vpar;
144
145
146
147 yHelix[0] = yIn[0] + positionMove.
x();
148 yHelix[1] = yIn[1] + positionMove.
y();
149 yHelix[2] = yIn[2] + positionMove.
z();
150 yHelix[3] = velocityVal * endTangent.
x();
151 yHelix[4] = velocityVal * endTangent.
y();
152 yHelix[5] = velocityVal * endTangent.
z();
153
154
155
156 if(yHelix2)
157 {
158 SinT2 = 2.0 * SinT * CosT;
159 CosT2 = 1.0 - 2.0 * SinT * SinT;
160 endTangent = (CosT2 * vperp + SinT2 * B_x_P + vpar);
161 positionMove = R * ( SinT2 * vperp + (1-CosT2) * B_x_P) + h*2 * vpar;
162
163 yHelix2[0] = yIn[0] + positionMove.
x();
164 yHelix2[1] = yIn[1] + positionMove.
y();
165 yHelix2[2] = yIn[2] + positionMove.
z();
166 yHelix2[3] = velocityVal * endTangent.
x();
167 yHelix2[4] = velocityVal * endTangent.
y();
168 yHelix2[5] = velocityVal * endTangent.
z();
169 }
170
171
172
174
175 G4double particleCharge = fPtrMagEqOfMot->
FCof() / (eplus*c_light);
176 R_Helix =std::abs( ptan/(fUnitConstant * particleCharge*Bmag));
177
181 }
182}
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
void SetCurve(const G4double Curve)
void SetRadHelix(const G4double Rad)
G4double GetInverseCurve(const G4double Momentum, const G4double Bmag)
void LinearStep(const G4double yIn[], G4double h, G4double yHelix[]) const
void SetAngCurve(const G4double Ang)