@@ -1156,10 +1156,14 @@ void GlueXBeamConversionProcess::GenerateBetheHeitlerProcess(const G4Step &step)
1156
1156
TFourVectorReal q3 (Erecoil, 0 , 0 , 0 );
1157
1157
LDouble_t q3dotq0 (0 );
1158
1158
LDouble_t qRkin (qR * kin);
1159
- LDouble_t costhetaR = (sqr (Mpair) / 2 - sqr (mRecoil ) / 2
1160
- - q0.InvariantSqr () / 2
1161
- + Erecoil * (kin + Etarget)
1162
- - kin * (Etarget - q0[3 ])
1159
+ LDouble_t mTarget (Etarget);
1160
+ if (q0.Length () > 0 ) {
1161
+ mTarget = q0.Invariant ();
1162
+ }
1163
+ LDouble_t costhetaR = (sqr (Mpair) / 2 - sqr (mRecoil - mTarget ) / 2
1164
+ + kin * (Erecoil - Etarget + q0[3 ])
1165
+ + Etarget * (Erecoil - mRecoil )
1166
+ + mRecoil * (Etarget - mTarget )
1163
1167
- q3dotq0
1164
1168
) / qRkin;
1165
1169
for (int i=0 ; i < 99 ; ++i) {
@@ -1171,7 +1175,7 @@ void GlueXBeamConversionProcess::GenerateBetheHeitlerProcess(const G4Step &step)
1171
1175
q3[2 ] = qR * sinthetaR * sin (phiR),
1172
1176
q3[3 ] = qR * costhetaR;
1173
1177
LDouble_t delta = q3.Dot (q0) - q3dotq0;
1174
- if (fabs (delta) < qRkin * 1e-12 )
1178
+ if (fabs (delta) < qRkin * 1e-15 )
1175
1179
break ;
1176
1180
costhetaR -= delta / qRkin;
1177
1181
q3dotq0 += delta;
@@ -1182,6 +1186,7 @@ void GlueXBeamConversionProcess::GenerateBetheHeitlerProcess(const G4Step &step)
1182
1186
(q3[2 ] - q0[2 ]) / E12 ,
1183
1187
(q3[3 ] - q0[3 ] - kin) / E12 );
1184
1188
TLorentzBoost toLab (beta);
1189
+ toLab.SetGamma (E12 / Mpair);
1185
1190
LDouble_t sinthetastar = sqrt (1 - sqr (costhetastar));
1186
1191
TThreeVectorReal k12 (k12star * sinthetastar * cos (phi12),
1187
1192
k12star * sinthetastar * sin (phi12),
@@ -1206,6 +1211,8 @@ void GlueXBeamConversionProcess::GenerateBetheHeitlerProcess(const G4Step &step)
1206
1211
TFourVectorReal pFi (pOut.Mom () + eOut.Mom () + nOut.Mom ());
1207
1212
TFourVectorReal::SetResolution (1e-10 );
1208
1213
if (pIn != pFi) {
1214
+ std::streamsize defprec = std::cout.precision ();
1215
+ std::cout << std::setprecision (12 );
1209
1216
std::cout << " Warning in GenerateBetheHeitlerConversion - "
1210
1217
<< " momentum conservation violated." << std::endl
1211
1218
<< " pIn = " ;
@@ -1224,6 +1231,7 @@ void GlueXBeamConversionProcess::GenerateBetheHeitlerProcess(const G4Step &step)
1224
1231
nOut.Mom ().Print ();
1225
1232
std::cout << " pIn - pFi = " ;
1226
1233
(pIn-pFi).Print ();
1234
+ std::cout << std::setprecision (defprec);
1227
1235
}
1228
1236
1229
1237
// Compute the polarized differential cross section (barnes/GeV^4)
0 commit comments