66{
69
76
83 G4cout <<
"G4LEnp:ApplyYourself: incident particle: "
85 G4cout <<
"P = " << P/GeV <<
" GeV/c"
86 << ", Px = " << Px/GeV << " GeV/c"
87 << ", Py = " << Py/GeV << " GeV/c"
88 <<
", Pz = " << Pz/GeV <<
" GeV/c" <<
G4endl;
89 G4cout <<
"E = " << E/GeV <<
" GeV"
90 << ", kinetic energy = " << ek/GeV << " GeV"
91 << ", mass = " << E0/GeV << " GeV"
92 <<
", charge = " << Q <<
G4endl;
95 << ", Z = " << Z
96 << ", atomic mass "
99
100
101
102 E += proton_mass_c2;
104 E0 = std::sqrt(std::abs(E02));
105 if (E02 < 0)E0 *= -1;
106 Q += Z;
108 G4cout <<
"E = " << E/GeV <<
" GeV"
109 << ", mass = " << E0/GeV << " GeV"
110 <<
", charge = " << Q <<
G4endl;
111 }
112
113
114
116 G4int je2 = NENERGY - 1;
117 ek = ek/GeV;
118 do {
119 G4int midBin = (je1 + je2)/2;
120 if (ek < elab[midBin])
121 je2 = midBin;
122 else
123 je1 = midBin;
124 } while (je2 - je1 > 1);
125 G4double delab = elab[je2] - elab[je1];
126
127
128
131 G4int ke2 = NANGLE - 1;
132 G4double dsig = sig[je2][0] - sig[je1][0];
134 G4double b = sig[je1][0] - rc*elab[je1];
137
140 << ke1 << " " << ke2 << " "
141 << sigint1 <<
" " << sigint2 <<
G4endl;
142 }
143 do {
144 G4int midBin = (ke1 + ke2)/2;
145 dsig = sig[je2][midBin] - sig[je1][midBin];
146 rc = dsig/delab;
147 b = sig[je1][midBin] - rc*elab[je1];
149 if (sample < sigint) {
150 ke2 = midBin;
151 sigint2 = sigint;
152 }
153 else {
154 ke1 = midBin;
155 sigint1 = sigint;
156 }
158 G4cout << ke1 <<
" " << ke2 <<
" "
159 << sigint1 <<
" " << sigint2 <<
G4endl;
160 }
161 } while (ke2 - ke1 > 1);
162
163 dsig = sigint2 - sigint1;
164 rc = 1./dsig;
165 b = ke1 - rc*sigint1;
167 G4double theta = (0.5 + kint)*pi/180.;
168
170 G4cout <<
" energy bin " << je1 <<
" energy=" << elab[je1] <<
G4endl;
171 G4cout <<
" angle bin " << kint <<
" angle=" << theta/degree <<
G4endl;
172 }
173
174
175
177
183 G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
184
185
186
190 G4double p = std::sqrt(px*px + py*py + pz*pz);
191
193 G4cout <<
" E1, M1 (GeV) " << E1/GeV <<
" " << M1/GeV <<
G4endl;
194 G4cout <<
" E2, M2 (GeV) " << E2/GeV <<
" " << M2/GeV <<
G4endl;
195 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
196 << pz/GeV <<
" " << p/GeV <<
G4endl;
197 }
198
199
201 G4double pxnew = p*std::sin(theta)*std::cos(phi);
202 G4double pynew = p*std::sin(theta)*std::sin(phi);
204
205
206 if (px*px + py*py > 0) {
207 G4double cost, sint, ph, cosp, sinp;
208 cost = pz/p;
209 sint = (std::sqrt(std::fabs((1-cost)*(1+cost))) + std::sqrt(px*px+py*py)/p)/2;
210 py < 0 ? ph = 3*halfpi : ph = halfpi;
211 if (std::abs(px) > 0.000001*GeV) ph = std::atan2(py,px);
212 cosp = std::cos(ph);
213 sinp = std::sin(ph);
214 px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
215 py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
216 pz = (-sint*pxnew + cost*pznew);
217 }
218 else {
219 px = pxnew;
220 py = pynew;
221 pz = pznew;
222 }
223
226 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
227 << pz/GeV <<
" " << p/GeV <<
G4endl;
228 }
229
230
231
237 G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
238
240 G4cout <<
" betaCM " << betaCMx <<
" " << betaCMy <<
" "
241 << betaCMz <<
" " << betaCM <<
G4endl;
243 }
244
245
246
248 BETA[1] = -betaCMx;
249 BETA[2] = -betaCMy;
250 BETA[3] = -betaCMz;
251 BETA[4] = gammaCM;
252
253
254
255 PA[1] = px;
256 PA[2] = py;
257 PA[3] = pz;
258 PA[4] = std::sqrt(M1*M1 + p*p);
259
260 G4double BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
261 G4double BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
262
263 PB[1] = PA[1] + BPGAM * BETA[1];
264 PB[2] = PA[2] + BPGAM * BETA[2];
265 PB[3] = PA[3] + BPGAM * BETA[3];
266 PB[4] = (PA[4] - BETPA) * BETA[4];
267
271
272
273
274 PA[1] = -px;
275 PA[2] = -py;
276 PA[3] = -pz;
277 PA[4] = std::sqrt(M2*M2 + p*p);
278
279 BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
280 BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
281
282 PB[1] = PA[1] + BPGAM * BETA[1];
283 PB[2] = PA[2] + BPGAM * BETA[2];
284 PB[3] = PA[3] + BPGAM * BETA[3];
285 PB[4] = (PA[4] - BETPA) * BETA[4];
286
288
290 G4cout <<
" particle 1 momentum in LAB "
293 G4cout <<
" particle 2 momentum in LAB "
296 G4cout <<
" TOTAL momentum in LAB "
298 << " "
301 }
302
305 delete newP;
307
309}
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL 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, G4int mod=-1)
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
G4DynamicParticle * ReturnTargetParticle() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * Proton()