62{
65
72
79 G4cout <<
"G4LEnp:ApplyYourself: incident particle: "
81 G4cout <<
"P = " << P/GeV <<
" GeV/c"
82 << ", Px = " << Px/GeV << " GeV/c"
83 << ", Py = " << Py/GeV << " GeV/c"
84 <<
", Pz = " << Pz/GeV <<
" GeV/c" <<
G4endl;
85 G4cout <<
"E = " << E/GeV <<
" GeV"
86 << ", kinetic energy = " << ek/GeV << " GeV"
87 << ", mass = " << E0/GeV << " GeV"
88 <<
", charge = " << Q <<
G4endl;
91 << ", Z = " << Z
92 << ", atomic mass "
95
96
97
98 E += proton_mass_c2;
100 E0 = std::sqrt(std::abs(E02));
101 if (E02 < 0)E0 *= -1;
102 Q += Z;
104 G4cout <<
"E = " << E/GeV <<
" GeV"
105 << ", mass = " << E0/GeV << " GeV"
106 <<
", charge = " << Q <<
G4endl;
107 }
108
109
110
112 G4int je2 = NENERGY - 1;
113 ek = ek/GeV;
114 do {
115 G4int midBin = (je1 + je2)/2;
116 if (ek < elab[midBin])
117 je2 = midBin;
118 else
119 je1 = midBin;
120 } while (je2 - je1 > 1);
121 G4double delab = elab[je2] - elab[je1];
122
123
124
127 G4int ke2 = NANGLE - 1;
128 G4double dsig = sig[je2][0] - sig[je1][0];
130 G4double b = sig[je1][0] - rc*elab[je1];
133
136 << ke1 << " " << ke2 << " "
137 << sigint1 <<
" " << sigint2 <<
G4endl;
138 }
139 do {
140 G4int midBin = (ke1 + ke2)/2;
141 dsig = sig[je2][midBin] - sig[je1][midBin];
142 rc = dsig/delab;
143 b = sig[je1][midBin] - rc*elab[je1];
145 if (sample < sigint) {
146 ke2 = midBin;
147 sigint2 = sigint;
148 }
149 else {
150 ke1 = midBin;
151 sigint1 = sigint;
152 }
154 G4cout << ke1 <<
" " << ke2 <<
" "
155 << sigint1 <<
" " << sigint2 <<
G4endl;
156 }
157 } while (ke2 - ke1 > 1);
158
159 dsig = sigint2 - sigint1;
160 rc = 1./dsig;
161 b = ke1 - rc*sigint1;
163 G4double theta = (0.5 + kint)*pi/180.;
164
166 G4cout <<
" energy bin " << je1 <<
" energy=" << elab[je1] <<
G4endl;
167 G4cout <<
" angle bin " << kint <<
" angle=" << theta/degree <<
G4endl;
168 }
169
170
171
173
179 G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
180
181
182
186 G4double p = std::sqrt(px*px + py*py + pz*pz);
187
189 G4cout <<
" E1, M1 (GeV) " << E1/GeV <<
" " << M1/GeV <<
G4endl;
190 G4cout <<
" E2, M2 (GeV) " << E2/GeV <<
" " << M2/GeV <<
G4endl;
191 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
192 << pz/GeV <<
" " << p/GeV <<
G4endl;
193 }
194
195
197 G4double pxnew = p*std::sin(theta)*std::cos(phi);
198 G4double pynew = p*std::sin(theta)*std::sin(phi);
200
201
202 if (px*px + py*py > 0) {
203 G4double cost, sint, ph, cosp, sinp;
204 cost = pz/p;
205 sint = (std::sqrt(std::fabs((1-cost)*(1+cost))) + std::sqrt(px*px+py*py)/p)/2;
206 py < 0 ? ph = 3*halfpi : ph = halfpi;
207 if (std::abs(px) > 0.000001*GeV) ph = std::atan2(py,px);
208 cosp = std::cos(ph);
209 sinp = std::sin(ph);
210 px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
211 py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
212 pz = (-sint*pxnew + cost*pznew);
213 }
214 else {
215 px = pxnew;
216 py = pynew;
217 pz = pznew;
218 }
219
222 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
223 << pz/GeV <<
" " << p/GeV <<
G4endl;
224 }
225
226
227
233 G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
234
236 G4cout <<
" betaCM " << betaCMx <<
" " << betaCMy <<
" "
237 << betaCMz <<
" " << betaCM <<
G4endl;
239 }
240
241
242
244 BETA[1] = -betaCMx;
245 BETA[2] = -betaCMy;
246 BETA[3] = -betaCMz;
247 BETA[4] = gammaCM;
248
249
250
251 PA[1] = px;
252 PA[2] = py;
253 PA[3] = pz;
254 PA[4] = std::sqrt(M1*M1 + p*p);
255
256 G4double BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
257 G4double BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
258
259 PB[1] = PA[1] + BPGAM * BETA[1];
260 PB[2] = PA[2] + BPGAM * BETA[2];
261 PB[3] = PA[3] + BPGAM * BETA[3];
262 PB[4] = (PA[4] - BETPA) * BETA[4];
263
267
268
269
270 PA[1] = -px;
271 PA[2] = -py;
272 PA[3] = -pz;
273 PA[4] = std::sqrt(M2*M2 + p*p);
274
275 BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
276 BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
277
278 PB[1] = PA[1] + BPGAM * BETA[1];
279 PB[2] = PA[2] + BPGAM * BETA[2];
280 PB[3] = PA[3] + BPGAM * BETA[3];
281 PB[4] = (PA[4] - BETPA) * BETA[4];
282
284
286 G4cout <<
" particle 1 momentum in LAB "
289 G4cout <<
" particle 2 momentum in LAB "
292 G4cout <<
" TOTAL momentum in LAB "
294 << " "
297 }
298
301 delete newP;
303
305}
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
G4DynamicParticle * ReturnTargetParticle() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * Proton()