89{
91 auto Z =
static_cast<G4int>(massCode / 1000);
92 auto A =
static_cast<G4int>(massCode - 1000 * Z);
93
94 if (massCode == 0) {
96 }
100 }
104 }
107 }
110 if (Z == 2) result->SetDefinition(
G4He3::He3());
111 }
115 }
116 else {
118 "G4ParticleHPDiscreteTwoBody: Unknown ion case 2");
119 }
120
121
124 for (i = 0; i < nEnergy; i++) {
125 it = i;
126 if (theCoeff[i].GetEnergy() > anEnergy) break;
127 }
128 if (it == 0 || it == nEnergy - 1) {
129 if (theCoeff[it].GetRepresentation() == 0) {
130
132 theStore.SetCoeff(0, theCoeff);
133 theStore.SetManager(theManager);
134
135
136 cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
137 }
138 else if (theCoeff[it].GetRepresentation() == 12)
139 {
142 aManager.
Init(
LINLIN, theCoeff[it].GetNumberOfPoly() / 2);
145
146
147
148 theStore.
SetX(i / 2, theCoeff[it].GetCoeff(i));
149 theStore.
SetY(i / 2, theCoeff[it].GetCoeff(i + 1));
150 }
151 cosTh = theStore.
Sample();
152 }
153 else if (theCoeff[it].GetRepresentation() == 14)
154 {
157 aManager.
Init(
LOGLIN, theCoeff[it].GetNumberOfPoly() / 2);
160
161
162
163 theStore.
SetX(i / 2, theCoeff[it].GetCoeff(i));
164 theStore.
SetY(i / 2, theCoeff[it].GetCoeff(i + 1));
165 }
166 cosTh = theStore.
Sample();
167 }
168 else {
170 "unknown representation type in Two-body scattering");
171 }
172 }
173 else {
174 if (!bCheckDiffCoeffRepr
175 || theCoeff[it].GetRepresentation() == theCoeff[it - 1].GetRepresentation())
176 {
177 if (theCoeff[it].GetRepresentation() == 0) {
178
180 theStore.SetCoeff(0, &(theCoeff[it - 1]));
181 theStore.SetCoeff(1, &(theCoeff[it]));
184 theStore.SetManager(aManager);
185
186 cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
187 }
188 else if (theCoeff[it].GetRepresentation() == 12)
189 {
192 aManager1.
Init(
LINLIN, theCoeff[it - 1].GetNumberOfPoly() / 2);
195
196 theBuff1.
SetX(i / 2, theCoeff[it - 1].GetCoeff(i));
197 theBuff1.
SetY(i / 2, theCoeff[it - 1].GetCoeff(i + 1));
198 }
201 aManager2.
Init(
LINLIN, theCoeff[it].GetNumberOfPoly() / 2);
204 theBuff2.
SetX(i / 2, theCoeff[it].GetCoeff(i));
205 theBuff2.
SetY(i / 2, theCoeff[it].GetCoeff(i + 1));
206 }
207
212
218
219
221 mu = theBuff1.
GetX(i);
222 y1 = theBuff1.
GetY(i);
223 y2 = theBuff2.
GetY(mu);
226 }
228 mu = theBuff2.
GetX(i);
229 y1 = theBuff2.
GetY(i);
230 y2 = theBuff1.
GetY(mu);
233 }
234 theStore.
Merge(&theStore1, &theStore2);
235 cosTh = theStore.
Sample();
236 }
237 else if (theCoeff[it].GetRepresentation() == 14)
238 {
241 aManager1.
Init(
LOGLIN, theCoeff[it - 1].GetNumberOfPoly() / 2);
244
245 theBuff1.
SetX(i / 2, theCoeff[it - 1].GetCoeff(i));
246 theBuff1.
SetY(i / 2, theCoeff[it - 1].GetCoeff(i + 1));
247 }
248
251 aManager2.
Init(
LOGLIN, theCoeff[it].GetNumberOfPoly() / 2);
254
255 theBuff2.
SetX(i / 2, theCoeff[it].GetCoeff(i));
256 theBuff2.
SetY(i / 2, theCoeff[it].GetCoeff(i + 1));
257 }
258
263
269
270
272 mu = theBuff1.
GetX(i);
273 y1 = theBuff1.
GetY(i);
274 y2 = theBuff2.
GetY(mu);
277 }
279 mu = theBuff2.
GetX(i);
280 y1 = theBuff2.
GetY(i);
281 y2 = theBuff1.
GetY(mu);
284 }
285 theStore.
Merge(&theStore1, &theStore2);
286 cosTh = theStore.
Sample();
287 }
288 else {
290 "Two neighbouring distributions with different interpolation");
291 }
292 }
293 else {
294 G4cout <<
" theCoeff[it].GetRepresent MEM " << it <<
" " << &theCoeff[it] <<
" "
295 << &theCoeff[it - 1] <<
G4endl;
298
300 "unknown representation type in Two-body scattering, case 2");
301 }
302 }
303
304
305
306
307
308
309
310
311
312
313
316
317
319 G4double kinE = (A1 + 1 - A1prim) / (A1 + 1) / (A1 + 1) * (A1 * E1 + (1 + A1) *
GetQValue());
320
321 result->SetKineticEnergy(kinE);
322 if (cosTh > 1.0) { cosTh = 1.0; }
323 else if(cosTh < -1.0) { cosTh = -1.0; }
325 G4double sinth = std::sqrt((1.0 + cosTh)*(1.0 - cosTh));
326 G4double mtot = result->GetTotalMomentum();
327 G4ThreeVector tempVector(mtot * sinth * std::cos(phi), mtot * sinth * std::sin(phi),
328 mtot * cosTh);
329 result->SetMomentum(tempVector);
330 return result;
331}
G4GLOB_DLL std::ostream G4cout
static G4Deuteron * Deuteron()
static G4Electron * Electron()
G4InterpolationScheme GetScheme(G4int index) const
static G4Neutron * Neutron()
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4int GetRepresentation()
void SetY(G4int i, G4double x)
void SetX(G4int i, G4double e)
void SetData(G4int i, G4double x, G4double y)
void SetInterpolationManager(const G4InterpolationManager &aManager)
G4double GetY(G4double x)
G4double GetX(G4int i) const
void Merge(G4ParticleHPVector *active, G4ParticleHPVector *passive)
G4int GetVectorLength() const
static G4Positron * Positron()
static G4Proton * Proton()
static G4Triton * Triton()
G4ReactionProduct * GetTarget() const
G4double GetQValue() const
G4ReactionProduct * GetProjectileRP() const