83{
86
93
100 G4cout <<
"G4LEpp:ApplyYourself: incident particle: "
102 G4cout <<
"P = " << P/GeV <<
" GeV/c"
103 << ", Px = " << Px/GeV << " GeV/c"
104 << ", Py = " << Py/GeV << " GeV/c"
105 <<
", Pz = " << Pz/GeV <<
" GeV/c" <<
G4endl;
106 G4cout <<
"E = " << E/GeV <<
" GeV"
107 << ", kinetic energy = " << ek/GeV << " GeV"
108 << ", mass = " << E0/GeV << " GeV"
109 <<
", charge = " << Q <<
G4endl;
112 << ", Z = " << Z
113 << ", atomic mass "
116
117
118
119 E += proton_mass_c2;
121 E0 = std::sqrt(std::fabs(E02));
122 if (E02 < 0)E0 *= -1;
123 Q += Z;
125 G4cout <<
"E = " << E/GeV <<
" GeV"
126 << ", mass = " << E0/GeV << " GeV"
127 <<
", charge = " << Q <<
G4endl;
128 }
129
130
131
133 G4int je2 = NENERGY - 1;
134 ek = ek/GeV;
135 do {
136 G4int midBin = (je1 + je2)/2;
137 if (ek < elab[midBin])
138 je2 = midBin;
139 else
140 je1 = midBin;
141 } while (je2 - je1 > 1);
142 G4double delab = elab[je2] - elab[je1];
143
144
145
148 G4int ke2 = NANGLE - 1;
149 G4double dsig = sig[je2][0] - sig[je1][0];
151 G4double b = sig[je1][0] - rc*elab[je1];
154
156 << ke1 << " " << ke2 << " "
157 << sigint1 <<
" " << sigint2 <<
G4endl;
158
159 do {
160 G4int midBin = (ke1 + ke2)/2;
161 dsig = sig[je2][midBin] - sig[je1][midBin];
162 rc = dsig/delab;
163 b = sig[je1][midBin] - rc*elab[je1];
165 if (sample < sigint) {
166 ke2 = midBin;
167 sigint2 = sigint;
168 }
169 else {
170 ke1 = midBin;
171 sigint1 = sigint;
172 }
174 << sigint1 <<
" " << sigint2 <<
G4endl;
175 } while (ke2 - ke1 > 1);
176
177 dsig = sigint2 - sigint1;
178 rc = 1./dsig;
179 b = ke1 - rc*sigint1;
181 G4double theta = (0.5 + kint)*pi/180.;
182 if (theta < 0.) { theta = 0.; }
183
185 G4cout <<
" energy bin " << je1 <<
" energy=" << elab[je1] <<
G4endl;
186 G4cout <<
" angle bin " << kint <<
" angle=" << theta/degree <<
G4endl;
187 }
188
189
191
197 G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
198
199
200
204 G4double p = std::sqrt(px*px + py*py + pz*pz);
205
207 G4cout <<
" E1, M1 (GeV) " << E1/GeV <<
" " << M1/GeV <<
G4endl;
208 G4cout <<
" E2, M2 (GeV) " << E2/GeV <<
" " << M2/GeV <<
G4endl;
209 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
210 << pz/GeV <<
" " << p/GeV <<
G4endl;
211 }
212
213
215 G4double pxnew = p*std::sin(theta)*std::cos(phi);
216 G4double pynew = p*std::sin(theta)*std::sin(phi);
218
219
220 if (px*px + py*py > 0) {
221 G4double cost, sint, ph, cosp, sinp;
222 cost = pz/p;
223 sint = (std::sqrt(std::fabs((1-cost)*(1+cost))) + std::sqrt(px*px+py*py)/p)/2;
224 py < 0 ? ph = 3*halfpi : ph = halfpi;
225 if (std::fabs(px) > 0.000001*GeV) ph = std::atan2(py,px);
226 cosp = std::cos(ph);
227 sinp = std::sin(ph);
228 px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
229 py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
230 pz = (-sint*pxnew + cost*pznew);
231 }
232 else {
233 px = pxnew;
234 py = pynew;
235 pz = pznew;
236 }
237
240 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
241 << pz/GeV <<
" " << p/GeV <<
G4endl;
242 }
243
244
245
251 G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
252
254 G4cout <<
" betaCM " << betaCMx <<
" " << betaCMy <<
" "
255 << betaCMz <<
" " << betaCM <<
G4endl;
257 }
258
259
260
262 BETA[1] = -betaCMx;
263 BETA[2] = -betaCMy;
264 BETA[3] = -betaCMz;
265 BETA[4] = gammaCM;
266
267
268
269 PA[1] = px;
270 PA[2] = py;
271 PA[3] = pz;
272 PA[4] = std::sqrt(M1*M1 + p*p);
273
274 G4double BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
275 G4double BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
276
277 PB[1] = PA[1] + BPGAM * BETA[1];
278 PB[2] = PA[2] + BPGAM * BETA[2];
279 PB[3] = PA[3] + BPGAM * BETA[3];
280 PB[4] = (PA[4] - BETPA) * BETA[4];
281
285
286
287
288 PA[1] = -px;
289 PA[2] = -py;
290 PA[3] = -pz;
291 PA[4] = std::sqrt(M2*M2 + p*p);
292
293 BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
294 BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
295
296 PB[1] = PA[1] + BPGAM * BETA[1];
297 PB[2] = PA[2] + BPGAM * BETA[2];
298 PB[3] = PA[3] + BPGAM * BETA[3];
299 PB[4] = (PA[4] - BETPA) * BETA[4];
300
302
304 G4cout <<
" particle 1 momentum in LAB "
307 G4cout <<
" particle 2 momentum in LAB "
310 G4cout <<
" TOTAL momentum in LAB "
312 << " "
315 }
316
319 delete newP;
320
321
324}
CLHEP::Hep3Vector G4ThreeVector
G4DLLIMPORT std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
void SetMomentum(const G4ThreeVector &momentum)
G4ThreeVector GetMomentum() const
G4double GetTotalMomentum() const
void AddSecondary(G4DynamicParticle *aP)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
G4double GetTotalMomentum() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4double GetTotalEnergy() const
G4HadFinalState theParticleChange
G4DynamicParticle * ReturnTargetParticle() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * Proton()