80{
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 if (vecLen == 0) return false;
96
102
104 G4bool veryForward =
false;
105
111 G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
112 targetMass*targetMass +
113 2.0*targetMass*etOriginal );
115 targetMass = targetParticle.
GetMass()/GeV;
116
117
118
119
120 for (i=0; i<vecLen; ++i) {
123 *vec[itemp] = *vec[i];
124 *vec[i] = pTemp;
125 }
126
127 if (currentMass == 0.0 && targetMass == 0.0) {
128
129
130
133 currentParticle = *vec[0];
135 targetParticle = *vec[1];
137 for( i=0; i<(vecLen-2); ++i )*vec[i] = *vec[i+2];
139 delete temp;
140 temp = vec[vecLen-2];
141 delete temp;
142 vecLen -= 2;
143 currentMass = currentParticle.
GetMass()/GeV;
144 targetMass = targetParticle.
GetMass()/GeV;
145 incidentHasChanged = true;
146 targetHasChanged = true;
149 veryForward = true;
150 }
154
158 currentParticle = targetParticle;
159 targetParticle = temp;
160 incidentHasChanged = true;
161 targetHasChanged = true;
162 currentMass = currentParticle.
GetMass()/GeV;
163 targetMass = targetParticle.
GetMass()/GeV;
164 }
165 const G4double afc = std::min( 0.75,
166 0.312+0.200*std::log(std::log(centerofmassEnergy*centerofmassEnergy))+
167 std::pow(centerofmassEnergy*centerofmassEnergy,1.5)/6000.0 );
168
169 G4double freeEnergy = centerofmassEnergy-currentMass-targetMass;
170 G4double forwardEnergy = freeEnergy/2.;
171 G4int forwardCount = 1;
172
173 G4double backwardEnergy = freeEnergy/2.;
174 G4int backwardCount = 1;
175
176 if(veryForward) {
177 if(currentParticle.
GetSide()==-1)
178 {
179 forwardEnergy += currentMass;
180 forwardCount --;
181 backwardEnergy -= currentMass;
182 backwardCount ++;
183 }
184 if(targetParticle.
GetSide()!=-1)
185 {
186 backwardEnergy += targetMass;
187 backwardCount --;
188 forwardEnergy -= targetMass;
189 forwardCount ++;
190 }
191 }
192
193 for (i=0; i<vecLen; ++i) {
194 if( vec[i]->GetSide() == -1 )
195 {
196 ++backwardCount;
197 backwardEnergy -= vec[i]->GetMass()/GeV;
198 } else {
199 ++forwardCount;
200 forwardEnergy -= vec[i]->GetMass()/GeV;
201 }
202 }
203
204
205
206
207
208 if (backwardEnergy < 0.0) {
209 for (i = 0; i < vecLen; ++i) {
210 if (vec[i]->GetSide() == -1) {
211 backwardEnergy += vec[i]->GetMass()/GeV;
212 --backwardCount;
213 vec[i]->SetSide(1);
214 forwardEnergy -= vec[i]->GetMass()/GeV;
215 ++forwardCount;
216 if (backwardEnergy > 0.0) break;
217 }
218 }
219 }
220
221 if (forwardEnergy < 0.0) {
222 for (i = 0; i < vecLen; ++i) {
223 if (vec[i]->GetSide() == 1) {
224 forwardEnergy += vec[i]->GetMass()/GeV;
225 --forwardCount;
226 vec[i]->SetSide(-1);
227 backwardEnergy -= vec[i]->GetMass()/GeV;
228 ++backwardCount;
229 if (forwardEnergy > 0.0) break;
230 }
231 }
232 }
233
234
235
236
237 if (forwardEnergy > 0.0 && backwardEnergy < 0.0) {
238 forwardEnergy += backwardEnergy;
239 backwardEnergy = 0;
240 }
241
242
243 if (forwardEnergy + backwardEnergy < 0.0) return false;
244
245
246
247
248
249
250
251
252
253
254
255
256
257
260 xtarg = afc * (std::pow(atomicWeight,0.33)-1.0) * (2.0*backwardCount+vecLen+2)/2.0;
261 else
262 xtarg = afc * (std::pow(atomicWeight,0.33)-1.0) * (2.0*backwardCount);
263 if( xtarg <= 0.0 )xtarg = 0.01;
265
266
267 if(atomicWeight<1.0001) nuclearExcitationCount = 0;
268 G4int extraNucleonCount = 0;
270
271 if (nuclearExcitationCount > 0) {
272 const G4double nucsup[] = { 1.00, 0.7, 0.5, 0.4, 0.35, 0.3 };
273 const G4double psup[] = { 3., 6., 20., 50., 100., 1000. };
274 G4int momentumBin = 0;
275 while( (momentumBin < 6) &&
277 ++momentumBin;
278 momentumBin = std::min( 5, momentumBin );
279
280
281
282
283
284 for (i = 0; i < nuclearExcitationCount; ++i) {
287
290 else
292
293
294
296 ++extraNucleonCount;
297 extraNucleonMass += pVec->
GetMass()/GeV;
298
301 ++backwardCount;
302
303 } else {
304
306 if( ran < 0.3181 )
308 else if( ran < 0.6819 )
310 else
312
313 if (backwardEnergy > pVec->
GetMass()/GeV) {
314 backwardEnergy -= pVec->
GetMass()/GeV;
315 ++backwardCount;
319 }
320
321
322
323 }
324 }
325 }
326
327
328
329
331 for (i = 0; i < 8; ++i) pseudoParticle[i].SetZero();
332
333 pseudoParticle[0].
SetMass( mOriginal*GeV );
334 pseudoParticle[0].
SetMomentum( 0.0, 0.0, pOriginal*GeV );
336 std::sqrt( pOriginal*pOriginal + mOriginal*mOriginal )*GeV );
337
338 pseudoParticle[1].
SetMass(protonMass);
340
341 pseudoParticle[3].
SetMass(protonMass*(1+extraNucleonCount) );
342 pseudoParticle[3].
SetTotalEnergy(protonMass*(1+extraNucleonCount) );
343
344 pseudoParticle[2] = pseudoParticle[0] + pseudoParticle[1];
345 pseudoParticle[3] = pseudoParticle[3] + pseudoParticle[0];
346
347 pseudoParticle[0].
Lorentz( pseudoParticle[0], pseudoParticle[2] );
348 pseudoParticle[1].Lorentz( pseudoParticle[1], pseudoParticle[2] );
349
350
351
352
354 G4int innerCounter, outerCounter;
355 G4bool eliminateThisParticle, resetEnergies, constantCrossSection;
356
359
360
361
362
363
364
365 G4int backwardNucleonCount = 0;
366 G4double totalEnergy, kineticEnergy, vecMass;
368
369 for (i = vecLen-1; i >= 0; --i) {
370
371 if (vec[i]->GetNewlyAdded()) {
372 if (vec[i]->GetSide() == -2) {
373 if (backwardNucleonCount < 18) {
374 if (vec[i]->GetDefinition()->GetParticleSubType() == "pi") {
375 for (
G4int j = 0; j < vecLen; j++)
delete vec[j];
376 vecLen = 0;
378 "G4RPGFragmentation::ReactionStage : a pion has been counted as a backward nucleon");
379 }
380 vec[i]->SetSide(-3);
381 ++backwardNucleonCount;
382 continue;
383
384
385 }
386 }
387 }
388
389
390
391
392 vecMass = vec[i]->GetMass()/GeV;
394
395 if (vec[i]->GetSide() == -2) {
396 aspar = 0.20;
397 pt = std::sqrt( std::pow( ran, 1.2 ) );
398
399 } else {
400 if (vec[i]->GetDefinition()->GetParticleSubType() == "pi") {
401 aspar = 0.75;
402 pt = std::sqrt( std::pow( ran, 1.7 ) );
403 } else if (vec[i]->GetDefinition()->GetParticleSubType() == "kaon") {
404 aspar = 0.70;
405 pt = std::sqrt( std::pow( ran, 1.7 ) );
406 } else {
407 aspar = 0.65;
408 pt = std::sqrt( std::pow( ran, 1.5 ) );
409 }
410 }
411
412 pt = std::max( 0.001, pt );
414 vec[i]->SetMomentum( pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV );
415 if (vec[i]->GetSide() > 0)
416 et = pseudoParticle[0].GetTotalEnergy()/GeV;
417 else
418 et = pseudoParticle[1].GetTotalEnergy()/GeV;
419
420
421
422
423 outerCounter = 0;
424 eliminateThisParticle = true;
425 resetEnergies = true;
426 dndl[0] = 0.0;
427
428 while (++outerCounter < 3) {
429
431 innerCounter = 0;
432 vec[i]->SetMomentum( pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV );
433
434
435
436 while (++innerCounter < 7) {
437
439 l = 1;
440 while( ( ran > dndl[l] ) && ( l < 19 ) ) l++;
442 if (vec[i]->GetSide() < 0) x *= -1.;
443 vec[i]->SetMomentum( x*et*GeV );
444 totalEnergy = std::sqrt( x*et*x*et + pt*pt + vecMass*vecMass );
445 vec[i]->SetTotalEnergy( totalEnergy*GeV );
446 kineticEnergy = vec[i]->GetKineticEnergy()/GeV;
447
448 if (vec[i]->GetSide() > 0) {
449 if( (forwardKinetic+kineticEnergy) < 0.95*forwardEnergy ) {
450
451
452 pseudoParticle[4] = pseudoParticle[4] + (*vec[i]);
453 forwardKinetic += kineticEnergy;
454 outerCounter = 2;
455 eliminateThisParticle = false;
456 resetEnergies = false;
457 break;
458 }
459 if( innerCounter > 5 )break;
460 if( backwardEnergy >= vecMass )
461 {
462 vec[i]->SetSide(-1);
463 forwardEnergy += vecMass;
464 backwardEnergy -= vecMass;
465 ++backwardCount;
466 }
467 } else {
468
469
470
472 if (extraNucleonCount < 20) xxx = 0.95+0.05*extraNucleonCount/20.0;
473
474 if ((backwardKinetic+kineticEnergy) < xxx*backwardEnergy) {
475 pseudoParticle[5] = pseudoParticle[5] + (*vec[i]);
476 backwardKinetic += kineticEnergy;
477 outerCounter = 2;
478 eliminateThisParticle = false;
479 resetEnergies = false;
480 break;
481 }
482 if (innerCounter > 5) break;
483 if (forwardEnergy >= vecMass) {
484 vec[i]->SetSide(1);
485 forwardEnergy -= vecMass;
486 backwardEnergy += vecMass;
487 backwardCount--;
488 }
489 }
491 vec[i]->SetMomentum( momentum.
x() * 0.9, momentum.
y() * 0.9 );
492 pt *= 0.9;
493 dndl[19] *= 0.9;
494 }
495
496
497
498
499
500
501 if (resetEnergies)
502 ReduceEnergiesOfSecondaries(i+1, forwardKinetic, backwardKinetic,
503 vec, vecLen,
504 pseudoParticle[4], pseudoParticle[5],
505 pt);
506
507 }
508
509 if (eliminateThisParticle && vec[i]->GetMayBeKilled()) {
510
511
512 if (vec[i]->GetSide() > 0) {
513 --forwardCount;
514 forwardEnergy += vecMass;
515 } else {
516 --backwardCount;
517 if (vec[i]->GetSide() == -2) {
518 --extraNucleonCount;
519 extraNucleonMass -= vecMass;
520 } else {
521 backwardEnergy += vecMass;
522 }
523 }
524
525 for(
G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1];
527 delete temp;
528
529
530 if( --vecLen == 0 ){
531 G4cout <<
" FALSE RETURN DUE TO ENERGY BALANCE " <<
G4endl;
532 return false;
533 }
534 }
535 }
536
537
538
539 G4double forwardKEDiff = forwardEnergy - forwardKinetic;
540 G4double backwardKEDiff = backwardEnergy - backwardKinetic;
541
542 if (forwardKEDiff < 0.0 || backwardKEDiff < 0.0) {
543 ReduceEnergiesOfSecondaries(0, forwardKinetic, backwardKinetic,
544 vec, vecLen,
545 pseudoParticle[4], pseudoParticle[5],
546 pt);
547
548 forwardKEDiff = forwardEnergy - forwardKinetic;
549 backwardKEDiff = backwardEnergy - backwardKinetic;
550 if (backwardKEDiff < 0.0) {
551 if (forwardKEDiff + backwardKEDiff > 0.0) {
552 backwardEnergy = backwardKinetic;
553 forwardEnergy += backwardKEDiff;
554 forwardKEDiff = forwardEnergy - forwardKinetic;
555 backwardKEDiff = 0.0;
556 } else {
557 G4cout <<
" False return due to insufficient backward energy " <<
G4endl;
558 return false;
559 }
560 }
561
562 if (forwardKEDiff < 0.0) {
563 if (forwardKEDiff + backwardKEDiff > 0.0) {
564 forwardEnergy = forwardKinetic;
565 backwardEnergy += forwardKEDiff;
566 backwardKEDiff = backwardEnergy - backwardKinetic;
567 forwardKEDiff = 0.0;
568 } else {
569 G4cout <<
" False return due to insufficient forward energy " <<
G4endl;
570 return false;
571 }
572 }
573 }
574
575
576
577
578
579
582 aspar = 0.60;
583 pt = std::sqrt( std::pow( ran/6.0, 1.7 ) );
585 aspar = 0.50;
586 pt = std::sqrt( std::pow( ran/5.0, 1.4 ) );
587 } else {
588 aspar = 0.40;
589 pt = std::sqrt( std::pow( ran/4.0, 1.2 ) );
590 }
591
593 currentParticle.
SetMomentum(pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV);
594 et = pseudoParticle[0].GetTotalEnergy()/GeV;
595 dndl[0] = 0.0;
596 vecMass = currentParticle.
GetMass()/GeV;
597
599
601 l = 1;
602 while( ( ran > dndl[l] ) && ( l < 19 ) ) l++;
605
606 if (forwardEnergy < forwardKinetic) {
607 totalEnergy = vecMass + 0.04*std::fabs(
normal());
608 G4cout <<
" Not enough forward energy: forwardEnergy = "
609 << forwardEnergy << " forwardKinetic = "
610 << forwardKinetic << " total energy left = "
611 << backwardKEDiff + forwardKEDiff <<
G4endl;
612 } else {
613 totalEnergy = vecMass + forwardEnergy - forwardKinetic;
614 forwardKinetic = forwardEnergy;
615 }
617 pp = std::sqrt(std::abs( totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
619
620 if (pp1 < 1.0e-6*GeV) {
623 } else {
625 }
626 pseudoParticle[4] = pseudoParticle[4] + currentParticle;
627
628
629
630
631
632 if (backwardNucleonCount < 18) {
634 ++backwardNucleonCount;
635
636 } else {
637
638
639
640 vecMass = targetParticle.
GetMass()/GeV;
642 aspar = 0.40;
643 pt = std::max( 0.001, std::sqrt( std::pow( ran/4.0, 1.2 ) ) );
645 targetParticle.
SetMomentum(pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV);
646 et = pseudoParticle[1].GetTotalEnergy()/GeV;
647 outerCounter = 0;
648 innerCounter = 0;
649 G4bool marginalEnergy =
true;
650 dndl[0] = 0.0;
652 if( extraNucleonCount < 20 ) xxx = 0.95+0.05*extraNucleonCount/20.0;
654
655 while (++outerCounter < 4) {
657
658 for (innerCounter = 0; innerCounter < 6; innerCounter++) {
660 l = 1;
661 while( ( ran > dndl[l] ) && ( l < 19 ) ) l++;
664 totalEnergy = std::sqrt(x*et*x*et + pt*pt + vecMass*vecMass);
666
667 if ((backwardKinetic+totalEnergy-vecMass) < xxx*backwardEnergy) {
668 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
669 backwardKinetic += totalEnergy - vecMass;
670 outerCounter = 3;
671 marginalEnergy = false;
672 break;
673 }
675 targetParticle.
SetMomentum(momentum.
x() * 0.9, momentum.
y() * 0.9);
676 pt *= 0.9;
677 dndl[19] *= 0.9;
678 }
679 }
680
681 if (marginalEnergy) {
682 G4cout <<
" Extra backward kinetic energy = "
683 << 0.999*backwardEnergy - backwardKinetic <<
G4endl;
684 totalEnergy = vecMass + 0.999*backwardEnergy - backwardKinetic;
686 pp = std::sqrt(std::abs(totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
687 targetParticle.
SetMomentum(momentum.
x()/0.9, momentum.
y()/0.9);
690 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
691 backwardKinetic = 0.999*backwardEnergy;
692 }
693
694 }
695
696 if (backwardEnergy < backwardKinetic)
697 G4cout <<
" Backward Edif = " << backwardEnergy - backwardKinetic <<
G4endl;
698 if (forwardEnergy != forwardKinetic)
699 G4cout <<
" Forward Edif = " << forwardEnergy - forwardKinetic <<
G4endl;
700
701
702
703
704
705
706
707
708
709 pseudoParticle[6].Lorentz( pseudoParticle[3], pseudoParticle[2] );
710 pseudoParticle[6] = pseudoParticle[6] - pseudoParticle[4];
711 pseudoParticle[6] = pseudoParticle[6] - pseudoParticle[5];
712
713 if (backwardNucleonCount == 1) {
714
715
716
718 std::min(backwardEnergy-backwardKinetic, centerofmassEnergy/2.0-protonMass/GeV);
719
720 if( ekin < 0.04 )ekin = 0.04 * std::fabs(
normal() );
721 vecMass = targetParticle.
GetMass()/GeV;
722 totalEnergy = ekin + vecMass;
724 pp = std::sqrt(std::abs(totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
725 pp1 = pseudoParticle[6].GetMomentum().mag();
726 if (pp1 < 1.0e-6*GeV) {
729 } else {
730 targetParticle.
SetMomentum( pseudoParticle[6].GetMomentum() * (pp/pp1));
731 }
732 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
733
734 } else if (backwardNucleonCount > 1) {
735
736
738 if (backwardNucleonCount < 5) tempCount = backwardNucleonCount;
739 tempCount -= 2;
740
742 if (targetParticle.
GetSide() == -3)
743 clusterMass = targetParticle.
GetMass()/GeV;
744 for (i = 0; i < vecLen; ++i)
745 if (vec[i]->GetSide() == -3) clusterMass += vec[i]->GetMass()/GeV;
746 clusterMass += backwardEnergy - backwardKinetic;
747
748 totalEnergy = pseudoParticle[6].GetTotalEnergy()/GeV;
749 pseudoParticle[6].SetMass(clusterMass*GeV);
750
751 pp = std::sqrt(std::abs(totalEnergy*totalEnergy -
752 clusterMass*clusterMass) )*GeV;
753 pp1 = pseudoParticle[6].GetMomentum().mag();
754 if (pp1 < 1.0e-6*GeV) {
756 pseudoParticle[6].SetMomentum(iso.
x(), iso.
y(), iso.
z());
757 } else {
758 pseudoParticle[6].SetMomentum(pseudoParticle[6].GetMomentum() * (-pp/pp1));
759 }
760
761 std::vector<G4ReactionProduct*> tempList;
762 if (targetParticle.
GetSide() == -3) tempList.push_back(&targetParticle);
763 for (i = 0; i < vecLen; ++i)
764 if (vec[i]->GetSide() == -3) tempList.push_back(vec[i]);
765
766 constantCrossSection = true;
767
768 if (tempList.size() > 1) {
771 constantCrossSection, tempList);
772
773 if (targetParticle.
GetSide() == -3) {
774 targetParticle = *tempList[0];
775 targetParticle.
Lorentz(targetParticle, pseudoParticle[6]);
776 n_entry++;
777 }
778
779 for (i = 0; i < vecLen; ++i) {
780 if (vec[i]->GetSide() == -3) {
781 *vec[i] = *tempList[n_entry];
782 vec[i]->Lorentz(*vec[i], pseudoParticle[6]);
783 n_entry++;
784 }
785 }
786 }
787 } else return false;
788
789 if (vecLen == 0) return false;
790
791
792
793 currentParticle.Lorentz( currentParticle, pseudoParticle[1] );
794 targetParticle.
Lorentz( targetParticle, pseudoParticle[1] );
795 for (i = 0; i < vecLen; ++i) vec[i]->Lorentz(*vec[i], pseudoParticle[1]);
796
797
798
799
800
801
802
803
804
805 G4bool leadingStrangeParticleHasChanged =
true;
806 if (leadFlag)
807 {
808 if (currentParticle.GetDefinition() == leadingStrangeParticle.
GetDefinition())
809 leadingStrangeParticleHasChanged = false;
810 if (leadingStrangeParticleHasChanged &&
812 leadingStrangeParticleHasChanged = false;
813 if( leadingStrangeParticleHasChanged )
814 {
815 for( i=0; i<vecLen; i++ )
816 {
817 if( vec[i]->GetDefinition() == leadingStrangeParticle.
GetDefinition() )
818 {
819 leadingStrangeParticleHasChanged = false;
820 break;
821 }
822 }
823 }
824 if( leadingStrangeParticleHasChanged )
825 {
832
833
834
835 if( (leadTest&&targetTest) || !(leadTest||targetTest) )
836 {
838 targetHasChanged = true;
839 }
840 else
841 {
842 currentParticle.SetDefinitionAndUpdateE( leadingStrangeParticle.
GetDefinition() );
843 incidentHasChanged = false;
844 }
845 }
846 }
847
848
849
850
851 std::pair<G4int, G4int> finalStateNucleons =
853
854 G4int protonsInFinalState = finalStateNucleons.first;
855 G4int neutronsInFinalState = finalStateNucleons.second;
856
857 G4int numberofFinalStateNucleons =
858 protonsInFinalState + neutronsInFinalState;
859
860 if (currentParticle.GetDefinition()->GetBaryonNumber() == 1 &&
864 numberofFinalStateNucleons++;
865
866 numberofFinalStateNucleons = std::max(1, numberofFinalStateNucleons);
867
868 G4int PinNucleus = std::max(0,
870 G4int NinNucleus = std::max(0,
872
873 pseudoParticle[3].SetMomentum( 0.0, 0.0, pOriginal*GeV );
874 pseudoParticle[3].SetMass( mOriginal*GeV );
875 pseudoParticle[3].SetTotalEnergy(
876 std::sqrt( pOriginal*pOriginal + mOriginal*mOriginal )*GeV );
877
881 if(numberofFinalStateNucleons == 1) diff = 0;
882 pseudoParticle[4].SetMomentum( 0.0, 0.0, 0.0 );
883 pseudoParticle[4].SetMass( protonMass*(numberofFinalStateNucleons-diff) );
884 pseudoParticle[4].SetTotalEnergy( protonMass*(numberofFinalStateNucleons-diff) );
885
887 pseudoParticle[3].GetTotalEnergy() + pseudoParticle[4].GetTotalEnergy() -
888 currentParticle.GetMass() - targetParticle.
GetMass();
889 for (i = 0; i < vecLen; ++i) theoreticalKinetic -= vec[i]->GetMass();
890
893 for (i = 0; i < vecLen; ++i)
894 simulatedKinetic += vec[i]->GetKineticEnergy();
895
896 pseudoParticle[5] = pseudoParticle[3] + pseudoParticle[4];
897 pseudoParticle[3].Lorentz( pseudoParticle[3], pseudoParticle[5] );
898 pseudoParticle[4].Lorentz( pseudoParticle[4], pseudoParticle[5] );
899
900 pseudoParticle[7].SetZero();
901 pseudoParticle[7] = pseudoParticle[7] + currentParticle;
902 pseudoParticle[7] = pseudoParticle[7] + targetParticle;
903 for (i = 0; i < vecLen; ++i)
904 pseudoParticle[7] = pseudoParticle[7] + *vec[i];
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949 if (simulatedKinetic != 0.0) {
950 wgt = theoreticalKinetic/simulatedKinetic;
952 simulatedKinetic = theoreticalKinetic;
953 currentParticle.SetKineticEnergy(theoreticalKinetic);
954 pp = currentParticle.GetTotalMomentum();
955 pp1 = currentParticle.GetMomentum().mag();
956 if (pp1 < 1.0e-6*GeV) {
958 currentParticle.SetMomentum( iso.
x(), iso.
y(), iso.
z() );
959 } else {
960 currentParticle.SetMomentum(currentParticle.GetMomentum() * (pp/pp1));
961 }
962
963 theoreticalKinetic = targetParticle.GetKineticEnergy() * wgt;
964 targetParticle.SetKineticEnergy(theoreticalKinetic);
965 simulatedKinetic += theoreticalKinetic;
966 pp = targetParticle.GetTotalMomentum();
967 pp1 = targetParticle.GetMomentum().mag();
968
969 if (pp1 < 1.0e-6*GeV) {
971 targetParticle.SetMomentum(iso.
x(), iso.
y(), iso.
z() );
972 } else {
973 targetParticle.SetMomentum(targetParticle.GetMomentum() * (pp/pp1) );
974 }
975
976 for (i = 0; i < vecLen; ++i ) {
977 theoreticalKinetic = vec[i]->GetKineticEnergy() * wgt;
978 simulatedKinetic += theoreticalKinetic;
979 vec[i]->SetKineticEnergy(theoreticalKinetic);
980 pp = vec[i]->GetTotalMomentum();
981 pp1 = vec[i]->GetMomentum().mag();
982 if( pp1 < 1.0e-6*GeV ) {
984 vec[i]->SetMomentum(iso.
x(), iso.
y(), iso.
z() );
985 } else {
986 vec[i]->SetMomentum(vec[i]->GetMomentum() * (pp/pp1) );
987 }
988 }
989 }
990
991
992
993
994
995
996
997
998
999 if( atomicWeight >= 1.5 )
1000 {
1001
1002
1003
1004
1005
1006
1009
1011 if (veryForward) {
1014 } else {
1017 }
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1033
1034
1035
1036
1037
1038
1039 if (epnb > pnCutOff)
1040 {
1041 npnb =
G4Poisson((1.5+1.25*numberofFinalStateNucleons)*epnb/(epnb+edta));
1042 if (numberofFinalStateNucleons + npnb > atomicWeight)
1043 npnb =
G4int(atomicWeight+0.00001 - numberofFinalStateNucleons);
1044 npnb = std::min( npnb, 127-vecLen );
1045 }
1046 if( edta >= dtaCutOff )
1047 {
1048 ndta =
G4Poisson((1.5+1.25*numberofFinalStateNucleons)*edta/(epnb+edta));
1049 ndta = std::min( ndta, 127-vecLen );
1050 }
1051 if (npnb == 0 && ndta == 0) npnb = 1;
1052
1054 PinNucleus, NinNucleus, targetNucleus,
1055 vec, vecLen);
1056 }
1057
1058
1059
1060
1061
1062
1063
1064
1065 if( (atomicWeight >= 1.5) && (atomicWeight <= 230.0) && (ekOriginal <= 0.2) )
1066 currentParticle.SetTOF(
1067 1.0-500.0*std::exp(-ekOriginal/0.04)*std::log(
G4UniformRand()) );
1068 else
1069 currentParticle.SetTOF( 1.0 );
1070 return true;
1071
1072}
G4long G4Poisson(G4double mean)
G4DLLIMPORT std::ostream G4cout
void SetElement(G4int anIndex, Type *anElement)
const G4ParticleDefinition * GetDefinition() const
static G4Lambda * Lambda()
static G4Neutron * Neutron()
G4double GetAnnihilationPNBlackTrackEnergy() const
G4double GetPNBlackTrackEnergy() const
G4double GetAnnihilationDTABlackTrackEnergy() const
G4double GetDTABlackTrackEnergy() const
G4double GetPDGMass() const
G4int GetBaryonNumber() const
const G4String & GetParticleSubType() const
static G4PionMinus * PionMinus()
static G4PionPlus * PionPlus()
static G4PionZero * PionZero()
static G4Proton * Proton()
void FragmentationIntegral(G4double, G4double, G4double, G4double)
G4double GenerateNBodyEventT(const G4double totalEnergy, const G4bool constantCrossSection, std::vector< G4ReactionProduct * > &list)
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 &)
G4ThreeVector Isotropic(const G4double &)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalMomentum() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
void SetNewlyAdded(const G4bool f)
G4ThreeVector GetMomentum() const
void SetSide(const G4int sid)
void SetDefinitionAndUpdateE(G4ParticleDefinition *aParticleDefinition)
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetKineticEnergy(const G4double en)
G4ParticleDefinition * GetDefinition() const
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
void SetMass(const G4double mas)