Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RPGTwoCluster.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27
28#include <iostream>
29#include <signal.h>
30
31#include "G4RPGTwoCluster.hh"
32#include "G4Log.hh"
33#include "G4Pow.hh"
35#include "G4SystemOfUnits.hh"
36#include "Randomize.hh"
37#include "G4Poisson.hh"
39
41 : G4RPGReaction() {}
42
43
45ReactionStage(const G4HadProjectile* originalIncident,
46 G4ReactionProduct& modifiedOriginal,
47 G4bool& incidentHasChanged,
48 const G4DynamicParticle* originalTarget,
49 G4ReactionProduct& targetParticle,
50 G4bool& targetHasChanged,
51 const G4Nucleus& targetNucleus,
52 G4ReactionProduct& currentParticle,
54 G4int& vecLen,
55 G4bool leadFlag,
56 G4ReactionProduct& leadingStrangeParticle)
57{
58 // Derived from H. Fesefeldt's FORTRAN code TWOCLU
59 //
60 // A simple two cluster model is used to generate x- and pt- values for
61 // incident, target, and all secondary particles.
62 // This should be sufficient for low energy interactions.
63
64 G4int i;
70 G4bool veryForward = false;
71
72 const G4double protonMass = aProton->GetPDGMass()/MeV;
73 const G4double ekOriginal = modifiedOriginal.GetKineticEnergy()/GeV;
74 const G4double etOriginal = modifiedOriginal.GetTotalEnergy()/GeV;
75 const G4double mOriginal = modifiedOriginal.GetMass()/GeV;
76 const G4double pOriginal = modifiedOriginal.GetMomentum().mag()/GeV;
77 G4double targetMass = targetParticle.GetDefinition()->GetPDGMass()/GeV;
78 G4double centerofmassEnergy = std::sqrt(mOriginal*mOriginal +
79 targetMass*targetMass +
80 2.0*targetMass*etOriginal); // GeV
81 G4double currentMass = currentParticle.GetMass()/GeV;
82 targetMass = targetParticle.GetMass()/GeV;
83
84 if (currentMass == 0.0 && targetMass == 0.0) {
85 G4double ek = currentParticle.GetKineticEnergy();
86 G4ThreeVector mom = currentParticle.GetMomentum();
87 currentParticle = *vec[0];
88 targetParticle = *vec[1];
89 for (i = 0; i < (vecLen-2); ++i) *vec[i] = *vec[i+2];
90 if (vecLen < 2) {
91 for (G4int j = 0; j < vecLen; j++) delete vec[j];
92 vecLen = 0;
93 throw G4HadReentrentException(__FILE__, __LINE__,
94 "G4RPGTwoCluster::ReactionStage : Negative number of particles");
95 }
96 delete vec[vecLen-1];
97 delete vec[vecLen-2];
98 vecLen -= 2;
99 currentMass = currentParticle.GetMass()/GeV;
100 targetMass = targetParticle.GetMass()/GeV;
101 incidentHasChanged = true;
102 targetHasChanged = true;
103 currentParticle.SetKineticEnergy(ek);
104 currentParticle.SetMomentum(mom);
105 veryForward = true;
106 }
107
108 const G4double atomicWeight = targetNucleus.GetA_asInt();
109 const G4double atomicNumber = targetNucleus.GetZ_asInt();
110
111 // particles have been distributed in forward and backward hemispheres
112 // in center of mass system of the hadron nucleon interaction
113
114 // Incident particle always in forward hemisphere
115
116 G4int forwardCount = 1; // number of particles in forward hemisphere
117 currentParticle.SetSide( 1 );
118 G4double forwardMass = currentParticle.GetMass()/GeV;
119 G4double cMass = forwardMass;
120
121 // Target particle always in backward hemisphere
122 G4int backwardCount = 1; // number of particles in backward hemisphere
123 targetParticle.SetSide( -1 );
124 G4double backwardMass = targetParticle.GetMass()/GeV;
125 G4double bMass = backwardMass;
126
127 // G4int backwardNucleonCount = 1; // number of nucleons in backward hemisphere
128 for (i = 0; i < vecLen; ++i) {
129 if (vec[i]->GetSide() < 0) vec[i]->SetSide(-1); // to take care of
130 // case where vec has been preprocessed by GenerateXandPt
131 // and some of them have been set to -2 or -3
132 if (vec[i]->GetSide() == -1) {
133 ++backwardCount;
134 backwardMass += vec[i]->GetMass()/GeV;
135 } else {
136 ++forwardCount;
137 forwardMass += vec[i]->GetMass()/GeV;
138 }
139 }
140
141 // Add nucleons and some pions from intra-nuclear cascade
142 G4double term1 = G4Log(centerofmassEnergy*centerofmassEnergy);
143 if(term1 < 0) term1 = 0.0001; // making sure xtarg<0;
144 const G4double afc = 0.312 + 0.2 * G4Log(term1);
145 G4double xtarg;
146 G4double a13 = G4Pow::GetInstance()->A13(atomicWeight); // A**(1/3)
147 if( centerofmassEnergy < 2.0+G4UniformRand() ) // added +2 below, JLC 4Jul97
148 xtarg = afc * (a13-1.0) * (2*backwardCount+vecLen+2)/2.0;
149 else
150 xtarg = afc * (a13-1.0) * (2*backwardCount);
151
152 if( xtarg <= 0.0 )xtarg = 0.01;
153 G4int nuclearExcitationCount = G4Poisson( xtarg );
154
155 if(atomicWeight<1.0001) nuclearExcitationCount = 0;
156 // G4int extraNucleonCount = 0;
157 // G4double extraMass = 0.0;
158 // G4double extraNucleonMass = 0.0;
159 if( nuclearExcitationCount > 0 )
160 {
161 G4int momentumBin = std::min( 4, G4int(pOriginal/3.0) );
162 const G4double nucsup[] = { 1.0, 0.8, 0.6, 0.5, 0.4 };
163 //
164 // NOTE: in TWOCLU, these new particles were given negative codes
165 // here we use NewlyAdded = true instead
166 //
167 for( i=0; i<nuclearExcitationCount; ++i )
168 {
170 if( G4UniformRand() < nucsup[momentumBin] ) // add proton or neutron
171 {
172 if( G4UniformRand() > 1.0-atomicNumber/atomicWeight )
173 pVec->SetDefinition( aProton );
174 else
175 pVec->SetDefinition( aNeutron );
176 // Not used ++backwardNucleonCount;
177 // Not used ++extraNucleonCount;
178 // Not used extraNucleonMass += pVec->GetMass()/GeV;
179 }
180 else
181 { // add a pion
182 G4double ran = G4UniformRand();
183 if( ran < 0.3181 )
184 pVec->SetDefinition( aPiPlus );
185 else if( ran < 0.6819 )
186 pVec->SetDefinition( aPiZero );
187 else
188 pVec->SetDefinition( aPiMinus );
189
190 // DHW: add following two lines to correct energy balance
191 // ++backwardCount;
192 // backwardMass += pVec->GetMass()/GeV;
193 }
194 pVec->SetSide( -2 ); // backside particle
195 // Not used extraMass += pVec->GetMass()/GeV;
196 pVec->SetNewlyAdded( true );
197 vec.SetElement( vecLen++, pVec );
198 }
199 }
200
201 // Masses of particles added from cascade not included in energy balance.
202 // That's correct for nucleons from the intra-nuclear cascade but not for
203 // pions from the cascade.
204
205 G4double forwardEnergy = (centerofmassEnergy-cMass-bMass)/2.0 +cMass - forwardMass;
206 G4double backwardEnergy = (centerofmassEnergy-cMass-bMass)/2.0 +bMass - backwardMass;
207 G4double eAvailable = centerofmassEnergy - (forwardMass+backwardMass);
208 G4bool secondaryDeleted;
209 G4double pMass;
210
211 G4int loop = 0;
213 ed << " While count exceeded " << G4endl;
214 // must eliminate a particle
215 while( eAvailable <= 0.0 ) { /* Loop checking, 01.09.2015, D.Wright */
216 loop++;
217 if (loop > 1000) {
218 G4Exception("G4RPGTwoCluster::ReactionStage()", "HAD_RPG_100", JustWarning, ed);
219 break;
220 }
221
222 secondaryDeleted = false;
223 for( i=(vecLen-1); i>=0; --i )
224 {
225 if( vec[i]->GetSide() == 1 && vec[i]->GetMayBeKilled())
226 {
227 pMass = vec[i]->GetMass()/GeV;
228 for( G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
229 --forwardCount;
230 forwardEnergy += pMass;
231 forwardMass -= pMass;
232 secondaryDeleted = true;
233 break;
234 }
235 else if( vec[i]->GetSide() == -1 && vec[i]->GetMayBeKilled())
236 {
237 pMass = vec[i]->GetMass()/GeV;
238 for( G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
239 --backwardCount;
240 backwardEnergy += pMass;
241 backwardMass -= pMass;
242 secondaryDeleted = true;
243 break;
244 }
245 } // breaks go down to here
246
247 if( secondaryDeleted )
248 {
249 delete vec[vecLen-1];
250 --vecLen;
251 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
252 }
253 else
254 {
255 if( vecLen == 0 ) return false; // all secondaries have been eliminated
256 if( targetParticle.GetSide() == -1 )
257 {
258 pMass = targetParticle.GetMass()/GeV;
259 targetParticle = *vec[0];
260 for( G4int j=0; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
261 --backwardCount;
262 backwardEnergy += pMass;
263 backwardMass -= pMass;
264 secondaryDeleted = true;
265 }
266 else if( targetParticle.GetSide() == 1 )
267 {
268 pMass = targetParticle.GetMass()/GeV;
269 targetParticle = *vec[0];
270 for( G4int j=0; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
271 --forwardCount;
272 forwardEnergy += pMass;
273 forwardMass -= pMass;
274 secondaryDeleted = true;
275 }
276
277 if( secondaryDeleted )
278 {
279 delete vec[vecLen-1];
280 --vecLen;
281 }
282 else
283 {
284 if( currentParticle.GetSide() == -1 )
285 {
286 pMass = currentParticle.GetMass()/GeV;
287 currentParticle = *vec[0];
288 for( G4int j=0; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
289 --backwardCount;
290 backwardEnergy += pMass;
291 backwardMass -= pMass;
292 secondaryDeleted = true;
293 }
294 else if( currentParticle.GetSide() == 1 )
295 {
296 pMass = currentParticle.GetMass()/GeV;
297 currentParticle = *vec[0];
298 for( G4int j=0; j<(vecLen-1); ++j )*vec[j] = *vec[j+1]; // shift up
299 --forwardCount;
300 forwardEnergy += pMass;
301 forwardMass -= pMass;
302 secondaryDeleted = true;
303 }
304 if( secondaryDeleted )
305 {
306 delete vec[vecLen-1];
307 --vecLen;
308 }
309 else break;
310
311 } // secondary not deleted
312 } // secondary not deleted
313
314 eAvailable = centerofmassEnergy - (forwardMass+backwardMass);
315 } // while
316
317 //
318 // This is the start of the TwoCluster function
319 // Choose multi-particle resonance masses by sampling
320 // P(M) = gc[g(M-M0)]**(c-1) *exp[-(g(M-M0))**c]
321 // for M > M0
322 //
323 // Use for the forward and backward clusters, but not
324 // the cascade cluster
325
326 const G4double cpar[] = { 1.60, 1.35, 1.15, 1.10 };
327 const G4double gpar[] = { 2.60, 1.80, 1.30, 1.20 };
328 G4int ntc = 0;
329
330 if (forwardCount < 1 || backwardCount < 1) return false; // array bounds protection
331
332 G4double rmc = forwardMass;
333 if (forwardCount > 1) {
334 ntc = std::min(3,forwardCount-2);
335 rmc += std::pow(-G4Log(1.0-G4UniformRand()),1./cpar[ntc])/gpar[ntc];
336 }
337 G4double rmd = backwardMass;
338 if( backwardCount > 1 ) {
339 ntc = std::min(3,backwardCount-2);
340 rmd += std::pow(-G4Log(1.0-G4UniformRand()),1./cpar[ntc])/gpar[ntc];
341 }
342
343 loop = 0;
345 eda << " While count exceeded " << G4endl;
346 while( rmc+rmd > centerofmassEnergy ) { /* Loop checking, 01.09.2015, D.Wright */
347 loop++;
348 if (loop > 1000) {
349 G4Exception("G4RPGTwoCluster::ReactionStage()", "HAD_RPG_100", JustWarning, eda);
350 break;
351 }
352
353 if( (rmc <= forwardMass) && (rmd <= backwardMass) )
354 {
355 G4double temp = 0.999*centerofmassEnergy/(rmc+rmd);
356 rmc *= temp;
357 rmd *= temp;
358 }
359 else
360 {
361 rmc = 0.1*forwardMass + 0.9*rmc;
362 rmd = 0.1*backwardMass + 0.9*rmd;
363 }
364 }
365
366 G4ReactionProduct pseudoParticle[8];
367 for( i=0; i<8; ++i )pseudoParticle[i].SetZero();
368
369 pseudoParticle[1].SetMass( mOriginal*GeV );
370 pseudoParticle[1].SetTotalEnergy( etOriginal*GeV );
371 pseudoParticle[1].SetMomentum( 0.0, 0.0, pOriginal*GeV );
372
373 pseudoParticle[2].SetMass( protonMass*MeV );
374 pseudoParticle[2].SetTotalEnergy( protonMass*MeV );
375 pseudoParticle[2].SetMomentum( 0.0, 0.0, 0.0 );
376 //
377 // transform into center of mass system
378 //
379 pseudoParticle[0] = pseudoParticle[1] + pseudoParticle[2];
380 pseudoParticle[1].Lorentz( pseudoParticle[1], pseudoParticle[0] );
381 pseudoParticle[2].Lorentz( pseudoParticle[2], pseudoParticle[0] );
382
383 // Calculate cm momentum for forward and backward masses
384 // W = sqrt(pf*pf + rmc*rmc) + sqrt(pf*pf + rmd*rmd)
385 // Solve for pf
386
387 const G4double pfMin = 0.0001;
388 G4double pf = (centerofmassEnergy*centerofmassEnergy+rmd*rmd-rmc*rmc);
389 pf *= pf;
390 pf -= 4*centerofmassEnergy*centerofmassEnergy*rmd*rmd;
391 pf = std::sqrt( std::max(pf,pfMin) )/(2.0*centerofmassEnergy);
392 //
393 // set final state masses and energies in centre of mass system
394 //
395 pseudoParticle[3].SetMass( rmc*GeV );
396 pseudoParticle[3].SetTotalEnergy( std::sqrt(pf*pf+rmc*rmc)*GeV );
397
398 pseudoParticle[4].SetMass( rmd*GeV );
399 pseudoParticle[4].SetTotalEnergy( std::sqrt(pf*pf+rmd*rmd)*GeV );
400
401 //
402 // Get cm scattering angle by sampling t from tmin to tmax
403 //
404 const G4double bMin = 0.01;
405 const G4double b1 = 4.0;
406 const G4double b2 = 1.6;
407 G4double pin = pseudoParticle[1].GetMomentum().mag()/GeV;
408 G4double dtb = 4.0*pin*pf*std::max( bMin, b1+b2*G4Log(pOriginal) );
409 G4double factor = 1.0 - G4Exp(-dtb);
410 G4double costheta = 1.0 + 2.0*G4Log(1.0 - G4UniformRand()*factor) / dtb;
411
412 costheta = std::max(-1.0, std::min(1.0, costheta));
413 G4double sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
414 G4double phi = G4UniformRand() * twopi;
415 //
416 // calculate final state momenta in centre of mass system
417 //
418 pseudoParticle[3].SetMomentum( pf*sintheta*std::cos(phi)*GeV,
419 pf*sintheta*std::sin(phi)*GeV,
420 pf*costheta*GeV );
421 pseudoParticle[4].SetMomentum( -pseudoParticle[3].GetMomentum());
422
423 // Backward cluster of nucleons and pions from intra-nuclear cascade
424 // Set up in lab system and transform to cms
425
426 G4double pp, pp1;
427 if( nuclearExcitationCount > 0 )
428 {
429 const G4double ga = 1.2;
430 G4double ekit1 = 0.04;
431 G4double ekit2 = 0.6; // Max KE of cascade particle
432 if( ekOriginal <= 5.0 )
433 {
434 ekit1 *= ekOriginal*ekOriginal/25.0;
435 ekit2 *= ekOriginal*ekOriginal/25.0;
436 }
437 G4double scale = std::pow(ekit2/ekit1, 1.0-ga) - 1.0;
438 for( i=0; i<vecLen; ++i )
439 {
440 if( vec[i]->GetSide() == -2 )
441 {
442 G4double kineticE = ekit1*std::pow((1.0 + G4UniformRand()*scale), 1.0/(1.0-ga) );
443 vec[i]->SetKineticEnergy( kineticE*GeV );
444 G4double vMass = vec[i]->GetMass()/MeV;
445 G4double totalE = kineticE*GeV + vMass;
446 pp = std::sqrt( std::abs(totalE*totalE-vMass*vMass) );
447 G4double cost = std::min( 1.0, std::max( -1.0, G4Log(2.23*G4UniformRand()+0.383)/0.96 ) );
448 G4double sint = std::sqrt(1.0-cost*cost);
449 phi = twopi*G4UniformRand();
450 vec[i]->SetMomentum( pp*sint*std::cos(phi)*MeV,
451 pp*sint*std::sin(phi)*MeV,
452 pp*cost*MeV );
453 vec[i]->Lorentz( *vec[i], pseudoParticle[0] );
454 }
455 }
456 }
457
458 //
459 // Fragmentation of forward and backward clusters
460 //
461
462 currentParticle.SetMomentum( pseudoParticle[3].GetMomentum() );
463 currentParticle.SetTotalEnergy( pseudoParticle[3].GetTotalEnergy() );
464
465 targetParticle.SetMomentum( pseudoParticle[4].GetMomentum() );
466 targetParticle.SetTotalEnergy( pseudoParticle[4].GetTotalEnergy() );
467
468 pseudoParticle[5].SetMomentum( pseudoParticle[3].GetMomentum() * (-1.0) );
469 pseudoParticle[5].SetMass( pseudoParticle[3].GetMass() );
470 pseudoParticle[5].SetTotalEnergy( pseudoParticle[3].GetTotalEnergy() );
471
472 pseudoParticle[6].SetMomentum( pseudoParticle[4].GetMomentum() * (-1.0) );
473 pseudoParticle[6].SetMass( pseudoParticle[4].GetMass() );
474 pseudoParticle[6].SetTotalEnergy( pseudoParticle[4].GetTotalEnergy() );
475
476 G4double wgt;
477 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
478 if( forwardCount > 1 ) // tempV will contain the forward particles
479 {
481 tempV.Initialize( forwardCount );
482 G4bool constantCrossSection = true;
483 G4int tempLen = 0;
484 if( currentParticle.GetSide() == 1 )
485 tempV.SetElement( tempLen++, &currentParticle );
486 if( targetParticle.GetSide() == 1 )
487 tempV.SetElement( tempLen++, &targetParticle );
488 for( i=0; i<vecLen; ++i )
489 {
490 if( vec[i]->GetSide() == 1 )
491 {
492 if( tempLen < 18 )
493 tempV.SetElement( tempLen++, vec[i] );
494 else
495 {
496 vec[i]->SetSide( -1 );
497 continue;
498 }
499 }
500 }
501 if( tempLen >= 2 )
502 {
503// wgt = GenerateNBodyEvent( pseudoParticle[3].GetMass()/MeV,
504// constantCrossSection, tempV, tempLen );
505// DHW: wgt is not used before it is overwritten; remove it here
506 GenerateNBodyEvent(pseudoParticle[3].GetMass()/MeV, constantCrossSection,
507 tempV, tempLen);
508
509 if( currentParticle.GetSide() == 1 )
510 currentParticle.Lorentz( currentParticle, pseudoParticle[5] );
511 if( targetParticle.GetSide() == 1 )
512 targetParticle.Lorentz( targetParticle, pseudoParticle[5] );
513 for( i=0; i<vecLen; ++i )
514 {
515 if( vec[i]->GetSide() == 1 )vec[i]->Lorentz( *vec[i], pseudoParticle[5] );
516 }
517 }
518 }
519 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
520 if( backwardCount > 1 ) // tempV will contain the backward particles,
521 { // but not those created from the intranuclear cascade
523 tempV.Initialize( backwardCount );
524 G4bool constantCrossSection = true;
525 G4int tempLen = 0;
526 if( currentParticle.GetSide() == -1 )
527 tempV.SetElement( tempLen++, &currentParticle );
528 if( targetParticle.GetSide() == -1 )
529 tempV.SetElement( tempLen++, &targetParticle );
530 for( i=0; i<vecLen; ++i )
531 {
532 if( vec[i]->GetSide() == -1 )
533 {
534 if( tempLen < 18 )
535 tempV.SetElement( tempLen++, vec[i] );
536 else
537 {
538 vec[i]->SetSide( -2 );
539 vec[i]->SetKineticEnergy( 0.0 );
540 vec[i]->SetMomentum( 0.0, 0.0, 0.0 );
541 continue;
542 }
543 }
544 }
545 if( tempLen >= 2 )
546 {
547 wgt = GenerateNBodyEvent( pseudoParticle[4].GetMass()/MeV,
548 constantCrossSection, tempV, tempLen );
549 if( currentParticle.GetSide() == -1 )
550 currentParticle.Lorentz( currentParticle, pseudoParticle[6] );
551 if( targetParticle.GetSide() == -1 )
552 targetParticle.Lorentz( targetParticle, pseudoParticle[6] );
553 for( i=0; i<vecLen; ++i )
554 {
555 if( vec[i]->GetSide() == -1 )vec[i]->Lorentz( *vec[i], pseudoParticle[6] );
556 }
557 }
558 }
559
560 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
561 //
562 // Lorentz transformation in lab system
563 //
564 currentParticle.Lorentz( currentParticle, pseudoParticle[2] );
565 targetParticle.Lorentz( targetParticle, pseudoParticle[2] );
566 for( i=0; i<vecLen; ++i ) vec[i]->Lorentz( *vec[i], pseudoParticle[2] );
567
568 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
569 //
570 // sometimes the leading strange particle is lost, set it back
571 //
572 G4bool dum = true;
573 if( leadFlag )
574 {
575 // leadFlag will be true
576 // iff original particle is strange AND if incident particle is strange
577 // leadFlag is set to the incident particle
578 // or
579 // target particle is strange leadFlag is set to the target particle
580
581 if( currentParticle.GetDefinition() == leadingStrangeParticle.GetDefinition() )
582 dum = false;
583 else if( targetParticle.GetDefinition() == leadingStrangeParticle.GetDefinition() )
584 dum = false;
585 else
586 {
587 for( i=0; i<vecLen; ++i )
588 {
589 if( vec[i]->GetDefinition() == leadingStrangeParticle.GetDefinition() )
590 {
591 dum = false;
592 break;
593 }
594 }
595 }
596 if( dum )
597 {
598 G4double leadMass = leadingStrangeParticle.GetMass()/MeV;
599 G4double ekin;
600 if( ((leadMass < protonMass) && (targetParticle.GetMass()/MeV < protonMass)) ||
601 ((leadMass >= protonMass) && (targetParticle.GetMass()/MeV >= protonMass)) )
602 {
603 ekin = targetParticle.GetKineticEnergy()/GeV;
604 pp1 = targetParticle.GetMomentum().mag()/MeV; // old momentum
605 targetParticle.SetDefinition( leadingStrangeParticle.GetDefinition() );
606 targetParticle.SetKineticEnergy( ekin*GeV );
607 pp = targetParticle.GetTotalMomentum()/MeV; // new momentum
608 if( pp1 < 1.0e-3 ) {
609 G4ThreeVector iso = Isotropic(pp);
610 targetParticle.SetMomentum( iso.x(), iso.y(), iso.z() );
611 } else {
612 targetParticle.SetMomentum( targetParticle.GetMomentum() * (pp/pp1) );
613 }
614 targetHasChanged = true;
615 }
616 else
617 {
618 ekin = currentParticle.GetKineticEnergy()/GeV;
619 pp1 = currentParticle.GetMomentum().mag()/MeV;
620 currentParticle.SetDefinition( leadingStrangeParticle.GetDefinition() );
621 currentParticle.SetKineticEnergy( ekin*GeV );
622 pp = currentParticle.GetTotalMomentum()/MeV;
623 if( pp1 < 1.0e-3 ) {
624 G4ThreeVector iso = Isotropic(pp);
625 currentParticle.SetMomentum( iso.x(), iso.y(), iso.z() );
626 } else {
627 currentParticle.SetMomentum( currentParticle.GetMomentum() * (pp/pp1) );
628 }
629 incidentHasChanged = true;
630 }
631 }
632 } // end of if( leadFlag )
633
634 // Get number of final state nucleons and nucleons remaining in
635 // target nucleus
636
637 std::pair<G4int, G4int> finalStateNucleons =
638 GetFinalStateNucleons(originalTarget, vec, vecLen);
639
640 G4int protonsInFinalState = finalStateNucleons.first;
641 G4int neutronsInFinalState = finalStateNucleons.second;
642
643 G4int numberofFinalStateNucleons =
644 protonsInFinalState + neutronsInFinalState;
645
646 if (currentParticle.GetDefinition()->GetBaryonNumber() == 1 &&
647 targetParticle.GetDefinition()->GetBaryonNumber() == 1 &&
648 originalIncident->GetDefinition()->GetPDGMass() <
650 numberofFinalStateNucleons++;
651
652 numberofFinalStateNucleons = std::max(1, numberofFinalStateNucleons);
653
654 G4int PinNucleus = std::max(0,
655 G4int(targetNucleus.GetZ_asInt()) - protonsInFinalState);
656 G4int NinNucleus = std::max(0,
657 G4int(targetNucleus.GetA_asInt()-targetNucleus.GetZ_asInt()) - neutronsInFinalState);
658 //
659 // for various reasons, the energy balance is not sufficient,
660 // check that, energy balance, angle of final system, etc.
661 //
662 pseudoParticle[4].SetMass( mOriginal*GeV );
663 pseudoParticle[4].SetTotalEnergy( etOriginal*GeV );
664 pseudoParticle[4].SetMomentum( 0.0, 0.0, pOriginal*GeV );
665
666 const G4ParticleDefinition* aOrgDef = modifiedOriginal.GetDefinition();
667 G4int diff = 0;
668 if(aOrgDef == G4Proton::Proton() || aOrgDef == G4Neutron::Neutron() ) diff = 1;
669 if(numberofFinalStateNucleons == 1) diff = 0;
670 pseudoParticle[5].SetMomentum( 0.0, 0.0, 0.0 );
671 pseudoParticle[5].SetMass( protonMass*(numberofFinalStateNucleons-diff)*MeV);
672 pseudoParticle[5].SetTotalEnergy( protonMass*(numberofFinalStateNucleons-diff)*MeV);
673
674 G4double theoreticalKinetic =
675 pseudoParticle[4].GetTotalEnergy()/GeV + pseudoParticle[5].GetTotalEnergy()/GeV;
676
677 pseudoParticle[6] = pseudoParticle[4] + pseudoParticle[5];
678 pseudoParticle[4].Lorentz( pseudoParticle[4], pseudoParticle[6] );
679 pseudoParticle[5].Lorentz( pseudoParticle[5], pseudoParticle[6] );
680
681 if( vecLen < 16 )
682 {
683 G4ReactionProduct tempR[130];
684 tempR[0] = currentParticle;
685 tempR[1] = targetParticle;
686 for( i=0; i<vecLen; ++i )tempR[i+2] = *vec[i];
687
689 tempV.Initialize( vecLen+2 );
690 G4bool constantCrossSection = true;
691 G4int tempLen = 0;
692 for( i=0; i<vecLen+2; ++i )tempV.SetElement( tempLen++, &tempR[i] );
693
694 if( tempLen >= 2 )
695 {
696 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
697 wgt = GenerateNBodyEvent( pseudoParticle[4].GetTotalEnergy()/MeV +
698 pseudoParticle[5].GetTotalEnergy()/MeV,
699 constantCrossSection, tempV, tempLen );
700 if (wgt == -1) {
701 G4double Qvalue = 0;
702 for (i = 0; i < tempLen; i++) Qvalue += tempV[i]->GetMass();
703 wgt = GenerateNBodyEvent( Qvalue/MeV,
704 constantCrossSection, tempV, tempLen );
705 }
706 theoreticalKinetic = 0.0;
707 for( i=0; i<vecLen+2; ++i )
708 {
709 pseudoParticle[7].SetMomentum( tempV[i]->GetMomentum() );
710 pseudoParticle[7].SetMass( tempV[i]->GetMass() );
711 pseudoParticle[7].SetTotalEnergy( tempV[i]->GetTotalEnergy() );
712 pseudoParticle[7].Lorentz( pseudoParticle[7], pseudoParticle[5] );
713 theoreticalKinetic += pseudoParticle[7].GetKineticEnergy()/GeV;
714 }
715 }
716 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
717 }
718 else
719 {
720 theoreticalKinetic -=
721 ( currentParticle.GetMass()/GeV + targetParticle.GetMass()/GeV );
722 for( i=0; i<vecLen; ++i )theoreticalKinetic -= vec[i]->GetMass()/GeV;
723 }
724 G4double simulatedKinetic =
725 currentParticle.GetKineticEnergy()/GeV + targetParticle.GetKineticEnergy()/GeV;
726 for( i=0; i<vecLen; ++i )simulatedKinetic += vec[i]->GetKineticEnergy()/GeV;
727
728 // make sure that kinetic energies are correct
729 // the backward nucleon cluster is not produced within proper kinematics!!!
730
731 if( simulatedKinetic != 0.0 )
732 {
733 wgt = (theoreticalKinetic)/simulatedKinetic;
734 currentParticle.SetKineticEnergy( wgt*currentParticle.GetKineticEnergy() );
735 pp = currentParticle.GetTotalMomentum()/MeV;
736 pp1 = currentParticle.GetMomentum().mag()/MeV;
737 if( pp1 < 0.001*MeV ) {
738 G4ThreeVector iso = Isotropic(pp);
739 currentParticle.SetMomentum( iso.x(), iso.y(), iso.z() );
740 } else {
741 currentParticle.SetMomentum( currentParticle.GetMomentum() * (pp/pp1) );
742 }
743
744 targetParticle.SetKineticEnergy( wgt*targetParticle.GetKineticEnergy() );
745 pp = targetParticle.GetTotalMomentum()/MeV;
746 pp1 = targetParticle.GetMomentum().mag()/MeV;
747 if( pp1 < 0.001*MeV ) {
748 G4ThreeVector iso = Isotropic(pp);
749 targetParticle.SetMomentum( iso.x(), iso.y(), iso.z() );
750 } else {
751 targetParticle.SetMomentum( targetParticle.GetMomentum() * (pp/pp1) );
752 }
753
754 for( i=0; i<vecLen; ++i )
755 {
756 vec[i]->SetKineticEnergy( wgt*vec[i]->GetKineticEnergy() );
757 pp = vec[i]->GetTotalMomentum()/MeV;
758 pp1 = vec[i]->GetMomentum().mag()/MeV;
759 if( pp1 < 0.001 ) {
760 G4ThreeVector iso = Isotropic(pp);
761 vec[i]->SetMomentum( iso.x(), iso.y(), iso.z() );
762 } else {
763 vec[i]->SetMomentum( vec[i]->GetMomentum() * (pp/pp1) );
764 }
765 }
766 }
767 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
768
769 Rotate( numberofFinalStateNucleons, pseudoParticle[4].GetMomentum(),
770 modifiedOriginal, originalIncident, targetNucleus,
771 currentParticle, targetParticle, vec, vecLen );
772
773 // Add black track particles
774 // the total number of particles produced is restricted to 198
775 // this may have influence on very high energies
776
777 if( atomicWeight >= 1.5 )
778 {
779 // npnb is number of proton/neutron black track particles
780 // ndta is the number of deuterons, tritons, and alphas produced
781 // epnb is the kinetic energy available for proton/neutron black track
782 // particles
783 // edta is the kinetic energy available for deuteron/triton/alpha
784 // particles
785
786 G4int npnb = 0;
787 G4int ndta = 0;
788
789 G4double epnb, edta;
790 if (veryForward) {
791 epnb = targetNucleus.GetAnnihilationPNBlackTrackEnergy();
792 edta = targetNucleus.GetAnnihilationDTABlackTrackEnergy();
793 } else {
794 epnb = targetNucleus.GetPNBlackTrackEnergy();
795 edta = targetNucleus.GetDTABlackTrackEnergy();
796 }
797
798 const G4double pnCutOff = 0.001; // GeV
799 const G4double dtaCutOff = 0.001; // GeV
800 // const G4double kineticMinimum = 1.e-6;
801 // const G4double kineticFactor = -0.005;
802
803 // G4double sprob = 0.0; // sprob = probability of self-absorption in
804 // heavy molecules
805 // Not currently used (DHW 9 June 2008) const G4double ekIncident = originalIncident->GetKineticEnergy()/GeV;
806 // if( ekIncident >= 5.0 )sprob = std::min( 1.0, 0.6*std::log(ekIncident-4.0) );
807
808 if( epnb >= pnCutOff )
809 {
810 npnb = G4Poisson((1.5+1.25*numberofFinalStateNucleons)*epnb/(epnb+edta));
811 if( numberofFinalStateNucleons + npnb > atomicWeight )
812 npnb = G4int(atomicWeight - numberofFinalStateNucleons);
813 npnb = std::min( npnb, 127-vecLen );
814 }
815 if( edta >= dtaCutOff )
816 {
817 ndta = G4Poisson( (1.5+1.25*numberofFinalStateNucleons)*edta/(epnb+edta) );
818 ndta = std::min( ndta, 127-vecLen );
819 }
820 if (npnb == 0 && ndta == 0) npnb = 1;
821
822 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
823
824 AddBlackTrackParticles(epnb, npnb, edta, ndta, modifiedOriginal,
825 PinNucleus, NinNucleus, targetNucleus,
826 vec, vecLen );
827 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
828 }
829
830 //if( centerofmassEnergy <= (4.0+G4UniformRand()) )
831 // MomentumCheck( modifiedOriginal, currentParticle, targetParticle, vec, vecLen );
832 //
833 // calculate time delay for nuclear reactions
834 //
835 if( (atomicWeight >= 1.5) && (atomicWeight <= 230.0) && (ekOriginal <= 0.2) )
836 currentParticle.SetTOF( 1.0-500.0*G4Exp(-ekOriginal/0.04)*G4Log(G4UniformRand()) );
837 else
838 currentParticle.SetTOF( 1.0 );
839
840 return true;
841}
842
843 /* end of file */
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
G4double G4Log(G4double x)
Definition: G4Log.hh:226
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:50
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
#define G4UniformRand()
Definition: Randomize.hh:52
double z() const
double x() const
double y() const
double mag() const
void SetElement(G4int anIndex, Type *anElement)
Definition: G4FastVector.hh:72
void Initialize(G4int items)
Definition: G4FastVector.hh:59
const G4ParticleDefinition * GetDefinition() const
static G4Lambda * Lambda()
Definition: G4Lambda.cc:107
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
G4double GetAnnihilationPNBlackTrackEnergy() const
Definition: G4Nucleus.hh:156
G4double GetPNBlackTrackEnergy() const
Definition: G4Nucleus.hh:150
G4double GetAnnihilationDTABlackTrackEnergy() const
Definition: G4Nucleus.hh:159
G4double GetDTABlackTrackEnergy() const
Definition: G4Nucleus.hh:153
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:97
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:97
static G4PionZero * PionZero()
Definition: G4PionZero.cc:107
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double A13(G4double A) const
Definition: G4Pow.cc:120
static G4Proton * Proton()
Definition: G4Proton.cc:92
void Rotate(const G4double numberofFinalStateNucleons, const G4ThreeVector &temp, const G4ReactionProduct &modifiedOriginal, const G4HadProjectile *originalIncident, const G4Nucleus &targetNucleus, G4ReactionProduct &currentParticle, G4ReactionProduct &targetParticle, G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen)
std::pair< G4int, G4int > GetFinalStateNucleons(const G4DynamicParticle *originalTarget, const G4FastVector< G4ReactionProduct, 256 > &vec, const G4int &vecLen)
void AddBlackTrackParticles(const G4double, const G4int, const G4double, const G4int, const G4ReactionProduct &, G4int, G4int, const G4Nucleus &, G4FastVector< G4ReactionProduct, 256 > &, G4int &)
G4double GenerateNBodyEvent(const G4double totalEnergy, const G4bool constantCrossSection, G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen)
G4ThreeVector Isotropic(const G4double &)
G4bool ReactionStage(const G4HadProjectile *, G4ReactionProduct &, G4bool &, const G4DynamicParticle *, G4ReactionProduct &, G4bool &, const G4Nucleus &, G4ReactionProduct &, G4FastVector< G4ReactionProduct, 256 > &, G4int &, G4bool, G4ReactionProduct &)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalMomentum() const
G4double GetKineticEnergy() const
const G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
void SetNewlyAdded(const G4bool f)
G4ThreeVector GetMomentum() const
void SetSide(const G4int sid)
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
void SetTOF(const G4double t)
G4double GetMass() const
void SetMass(const G4double mas)