52{
55
62
69 G4cout <<
"G4LEpp:ApplyYourself: incident particle: "
71 G4cout <<
"P = " << P/GeV <<
" GeV/c"
72 << ", Px = " << Px/GeV << " GeV/c"
73 << ", Py = " << Py/GeV << " GeV/c"
74 <<
", Pz = " << Pz/GeV <<
" GeV/c" <<
G4endl;
75 G4cout <<
"E = " << E/GeV <<
" GeV"
76 << ", kinetic energy = " << ek/GeV << " GeV"
77 << ", mass = " << E0/GeV << " GeV"
78 <<
", charge = " << Q <<
G4endl;
81 << ", Z = " << Z
82 << ", atomic mass "
85
86
87
88 E += proton_mass_c2;
90 E0 = std::sqrt(std::fabs(E02));
91 if (E02 < 0)E0 *= -1;
92 Q += Z;
94 G4cout <<
"E = " << E/GeV <<
" GeV"
95 << ", mass = " << E0/GeV << " GeV"
96 <<
", charge = " << Q <<
G4endl;
97 }
100 if(cost > 1.0) { cost = 1.0; }
101 if(cost <-1.0) { cost =-1.0; }
102 G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
104
106
112 G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
113
114
115
119 G4double p = std::sqrt(px*px + py*py + pz*pz);
120
122 G4cout <<
" E1, M1 (GeV) " << E1/GeV <<
" " << M1/GeV <<
G4endl;
123 G4cout <<
" E2, M2 (GeV) " << E2/GeV <<
" " << M2/GeV <<
G4endl;
124 G4cout <<
" particle 1 momentum in CM " << px/GeV
125 << " " << py/GeV << " "
126 << pz/GeV <<
" " << p/GeV <<
G4endl;
127 }
128
129
130 G4double pxnew = p*sint*std::cos(phi);
131 G4double pynew = p*sint*std::sin(phi);
133
134
135 if (px*px + py*py > 0) {
137 cost = pz/p;
138 sint = (std::sqrt((1-cost)*(1+cost)) + std::sqrt(px*px+py*py)/p)/2;
139 py < 0 ? ph = 3*halfpi : ph = halfpi;
140 if (std::fabs(px) > 0.000001*GeV) ph = std::atan2(py,px);
141 cosp = std::cos(ph);
142 sinp = std::sin(ph);
143 px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
144 py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
145 pz = (-sint*pxnew + cost*pznew);
146 }
147 else {
148 px = pxnew;
149 py = pynew;
150 pz = pznew;
151 }
152
155 G4cout <<
" particle 1 momentum in CM " << px/GeV <<
" " << py/GeV <<
" "
156 << pz/GeV <<
" " << p/GeV <<
G4endl;
157 }
158
159
160
166 G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
167
169 G4cout <<
" betaCM " << betaCMx <<
" " << betaCMy <<
" "
170 << betaCMz <<
" " << betaCM <<
G4endl;
172 }
173
174
175
177 BETA[1] = -betaCMx;
178 BETA[2] = -betaCMy;
179 BETA[3] = -betaCMz;
180 BETA[4] = gammaCM;
181
182
183
184 PA[1] = px;
185 PA[2] = py;
186 PA[3] = pz;
187 PA[4] = std::sqrt(M1*M1 + p*p);
188
189 G4double BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
190 G4double BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
191
192 PB[1] = PA[1] + BPGAM * BETA[1];
193 PB[2] = PA[2] + BPGAM * BETA[2];
194 PB[3] = PA[3] + BPGAM * BETA[3];
195 PB[4] = (PA[4] - BETPA) * BETA[4];
196
200
201
202
203 PA[1] = -px;
204 PA[2] = -py;
205 PA[3] = -pz;
206 PA[4] = std::sqrt(M2*M2 + p*p);
207
208 BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
209 BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
210
211 PB[1] = PA[1] + BPGAM * BETA[1];
212 PB[2] = PA[2] + BPGAM * BETA[2];
213 PB[3] = PA[3] + BPGAM * BETA[3];
214 PB[4] = (PA[4] - BETPA) * BETA[4];
215
217
219 G4cout <<
" particle 1 momentum in LAB "
222 G4cout <<
" particle 2 momentum in LAB "
225 G4cout <<
" TOTAL momentum in LAB "
227 << " "
230 }
231
234 delete newP;
235
236
239}
double A(double temperature)
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
G4HadFinalState theParticleChange
G4double SampleInvariantT(const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A) override
G4DynamicParticle * ReturnTargetParticle() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * Proton()