81{
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 if (vecLen == 0) return false;
97
103
105 G4bool veryForward =
false;
106
112 G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
113 targetMass*targetMass +
114 2.0*targetMass*etOriginal );
116 targetMass = targetParticle.
GetMass()/GeV;
117
118
119
120
121 for (i=0; i<vecLen; ++i) {
124 *vec[itemp] = *vec[i];
125 *vec[i] = pTemp;
126 }
127
128 if (currentMass == 0.0 && targetMass == 0.0) {
129
130
131
134 currentParticle = *vec[0];
136 targetParticle = *vec[1];
138 for( i=0; i<(vecLen-2); ++i )*vec[i] = *vec[i+2];
140 delete temp;
141 temp = vec[vecLen-2];
142 delete temp;
143 vecLen -= 2;
144 currentMass = currentParticle.
GetMass()/GeV;
145 targetMass = targetParticle.
GetMass()/GeV;
146 incidentHasChanged = true;
147 targetHasChanged = true;
150 veryForward = true;
151 }
155
159 currentParticle = targetParticle;
160 targetParticle = temp;
161 incidentHasChanged = true;
162 targetHasChanged = true;
163 currentMass = currentParticle.
GetMass()/GeV;
164 targetMass = targetParticle.
GetMass()/GeV;
165 }
166 const G4double afc = std::min( 0.75,
167 0.312+0.200*
G4Log(
G4Log(centerofmassEnergy*centerofmassEnergy))+
168 std::pow(centerofmassEnergy*centerofmassEnergy,1.5)/6000.0 );
169
170 G4double freeEnergy = centerofmassEnergy-currentMass-targetMass;
171 G4double forwardEnergy = freeEnergy/2.;
172 G4int forwardCount = 1;
173
174 G4double backwardEnergy = freeEnergy/2.;
175 G4int backwardCount = 1;
176
177 if(veryForward) {
178 if(currentParticle.
GetSide()==-1)
179 {
180 forwardEnergy += currentMass;
181 forwardCount --;
182 backwardEnergy -= currentMass;
183 backwardCount ++;
184 }
185 if(targetParticle.
GetSide()!=-1)
186 {
187 backwardEnergy += targetMass;
188 backwardCount --;
189 forwardEnergy -= targetMass;
190 forwardCount ++;
191 }
192 }
193
194 for (i=0; i<vecLen; ++i) {
195 if( vec[i]->GetSide() == -1 )
196 {
197 ++backwardCount;
198 backwardEnergy -= vec[i]->GetMass()/GeV;
199 } else {
200 ++forwardCount;
201 forwardEnergy -= vec[i]->GetMass()/GeV;
202 }
203 }
204
205
206
207
208
209 if (backwardEnergy < 0.0) {
210 for (i = 0; i < vecLen; ++i) {
211 if (vec[i]->GetSide() == -1) {
212 backwardEnergy += vec[i]->GetMass()/GeV;
213 --backwardCount;
214 vec[i]->SetSide(1);
215 forwardEnergy -= vec[i]->GetMass()/GeV;
216 ++forwardCount;
217 if (backwardEnergy > 0.0) break;
218 }
219 }
220 }
221
222 if (forwardEnergy < 0.0) {
223 for (i = 0; i < vecLen; ++i) {
224 if (vec[i]->GetSide() == 1) {
225 forwardEnergy += vec[i]->GetMass()/GeV;
226 --forwardCount;
227 vec[i]->SetSide(-1);
228 backwardEnergy -= vec[i]->GetMass()/GeV;
229 ++backwardCount;
230 if (forwardEnergy > 0.0) break;
231 }
232 }
233 }
234
235
236
237
238 if (forwardEnergy > 0.0 && backwardEnergy < 0.0) {
239 forwardEnergy += backwardEnergy;
240 backwardEnergy = 0;
241 }
242
243
244 if (forwardEnergy + backwardEnergy < 0.0) return false;
245
246
247
248
249
250
251
252
253
254
255
256
257
258
262 xtarg = afc * (a13-1.0) * (2.0*backwardCount+vecLen+2)/2.0;
263 else
264 xtarg = afc * (a13-1.0) * (2.0*backwardCount);
265
266 if( xtarg <= 0.0 )xtarg = 0.01;
268
269
270 if(atomicWeight<1.0001) nuclearExcitationCount = 0;
271 G4int extraNucleonCount = 0;
273
274 if (nuclearExcitationCount > 0) {
275 const G4double nucsup[] = { 1.00, 0.7, 0.5, 0.4, 0.35, 0.3 };
276 const G4double psup[] = { 3., 6., 20., 50., 100., 1000. };
277 G4int momentumBin = 0;
278
281 ed <<
" While count exceeded " <<
G4endl;
282 while( (momentumBin < 6) &&
284 ++momentumBin;
285 loop++;
286 if (loop > 1000) {
288 break;
289 }
290 }
291
292 momentumBin = std::min( 5, momentumBin );
293
294
295
296
297
298 for (i = 0; i < nuclearExcitationCount; ++i) {
301
304 else
306
307
308
310 ++extraNucleonCount;
311 extraNucleonMass += pVec->
GetMass()/GeV;
312
315 ++backwardCount;
316
317 } else {
318
320 if( ran < 0.3181 )
322 else if( ran < 0.6819 )
324 else
326
327 if (backwardEnergy > pVec->
GetMass()/GeV) {
328 backwardEnergy -= pVec->
GetMass()/GeV;
329 ++backwardCount;
333 }
334
335
336
337 }
338 }
339 }
340
341
342
343
345 for (i = 0; i < 8; ++i) pseudoParticle[i].SetZero();
346
347 pseudoParticle[0].
SetMass( mOriginal*GeV );
348 pseudoParticle[0].
SetMomentum( 0.0, 0.0, pOriginal*GeV );
350 std::sqrt( pOriginal*pOriginal + mOriginal*mOriginal )*GeV );
351
352 pseudoParticle[1].
SetMass(protonMass);
354
355 pseudoParticle[3].
SetMass(protonMass*(1+extraNucleonCount) );
356 pseudoParticle[3].
SetTotalEnergy(protonMass*(1+extraNucleonCount) );
357
358 pseudoParticle[2] = pseudoParticle[0] + pseudoParticle[1];
359 pseudoParticle[3] = pseudoParticle[3] + pseudoParticle[0];
360
361 pseudoParticle[0].
Lorentz( pseudoParticle[0], pseudoParticle[2] );
362 pseudoParticle[1].Lorentz( pseudoParticle[1], pseudoParticle[2] );
363
364
365
366
368 G4int innerCounter, outerCounter;
369 G4bool eliminateThisParticle, resetEnergies, constantCrossSection;
370
373
374
375
376
377
378
379 G4int backwardNucleonCount = 0;
380 G4double totalEnergy, kineticEnergy, vecMass;
382
383 for (i = vecLen-1; i >= 0; --i) {
384
385 if (vec[i]->GetNewlyAdded()) {
386 if (vec[i]->GetSide() == -2) {
387 if (backwardNucleonCount < 18) {
388 if (vec[i]->GetDefinition()->GetParticleSubType() == "pi") {
389 for (
G4int j = 0; j < vecLen; j++)
delete vec[j];
390 vecLen = 0;
392 "G4RPGFragmentation::ReactionStage : a pion has been counted as a backward nucleon");
393 }
394 vec[i]->SetSide(-3);
395 ++backwardNucleonCount;
396 continue;
397
398
399 }
400 }
401 }
402
403
404
405
406 vecMass = vec[i]->GetMass()/GeV;
408
409 if (vec[i]->GetSide() == -2) {
410 aspar = 0.20;
411 pt = std::sqrt( std::pow( ran, 1.2 ) );
412
413 } else {
414 if (vec[i]->GetDefinition()->GetParticleSubType() == "pi") {
415 aspar = 0.75;
416 pt = std::sqrt( std::pow( ran, 1.7 ) );
417 } else if (vec[i]->GetDefinition()->GetParticleSubType() == "kaon") {
418 aspar = 0.70;
419 pt = std::sqrt( std::pow( ran, 1.7 ) );
420 } else {
421 aspar = 0.65;
422 pt = std::sqrt( std::pow( ran, 1.5 ) );
423 }
424 }
425
426 pt = std::max( 0.001, pt );
428 vec[i]->SetMomentum( pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV );
429 if (vec[i]->GetSide() > 0)
430 et = pseudoParticle[0].GetTotalEnergy()/GeV;
431 else
432 et = pseudoParticle[1].GetTotalEnergy()/GeV;
433
434
435
436
437 outerCounter = 0;
438 eliminateThisParticle = true;
439 resetEnergies = true;
440 dndl[0] = 0.0;
441
442 while (++outerCounter < 3) {
443
445 innerCounter = 0;
446 vec[i]->SetMomentum( pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV );
447
448
449
450 while (++innerCounter < 7) {
451
453 l = 1;
454
457 ed <<
" While count exceeded " <<
G4endl;
458 while( ( ran > dndl[l] ) && ( l < 19 ) ) {
459 l++;
460 loop++;
461 if (loop > 1000) {
463 break;
464 }
465 }
466
468 if (vec[i]->GetSide() < 0) x *= -1.;
469 vec[i]->SetMomentum( x*et*GeV );
470 totalEnergy = std::sqrt( x*et*x*et + pt*pt + vecMass*vecMass );
471 vec[i]->SetTotalEnergy( totalEnergy*GeV );
472 kineticEnergy = vec[i]->GetKineticEnergy()/GeV;
473
474 if (vec[i]->GetSide() > 0) {
475 if( (forwardKinetic+kineticEnergy) < 0.95*forwardEnergy ) {
476
477
478 pseudoParticle[4] = pseudoParticle[4] + (*vec[i]);
479 forwardKinetic += kineticEnergy;
480 outerCounter = 2;
481 eliminateThisParticle = false;
482 resetEnergies = false;
483 break;
484 }
485 if( innerCounter > 5 )break;
486 if( backwardEnergy >= vecMass )
487 {
488 vec[i]->SetSide(-1);
489 forwardEnergy += vecMass;
490 backwardEnergy -= vecMass;
491 ++backwardCount;
492 }
493 } else {
494
495
496
498 if (extraNucleonCount < 20) xxx = 0.95+0.05*extraNucleonCount/20.0;
499
500 if ((backwardKinetic+kineticEnergy) < xxx*backwardEnergy) {
501 pseudoParticle[5] = pseudoParticle[5] + (*vec[i]);
502 backwardKinetic += kineticEnergy;
503 outerCounter = 2;
504 eliminateThisParticle = false;
505 resetEnergies = false;
506 break;
507 }
508 if (innerCounter > 5) break;
509 if (forwardEnergy >= vecMass) {
510 vec[i]->SetSide(1);
511 forwardEnergy -= vecMass;
512 backwardEnergy += vecMass;
513 backwardCount--;
514 }
515 }
517 vec[i]->SetMomentum( momentum.
x() * 0.9, momentum.
y() * 0.9 );
518 pt *= 0.9;
519 dndl[19] *= 0.9;
520 }
521
522
523
524
525
526
527 if (resetEnergies)
528 ReduceEnergiesOfSecondaries(i+1, forwardKinetic, backwardKinetic,
529 vec, vecLen,
530 pseudoParticle[4], pseudoParticle[5],
531 pt);
532
533 }
534
535 if (eliminateThisParticle && vec[i]->GetMayBeKilled()) {
536
537
538 if (vec[i]->GetSide() > 0) {
539 --forwardCount;
540 forwardEnergy += vecMass;
541 } else {
542 --backwardCount;
543 if (vec[i]->GetSide() == -2) {
544 --extraNucleonCount;
545 extraNucleonMass -= vecMass;
546 } else {
547 backwardEnergy += vecMass;
548 }
549 }
550
551 for(
G4int j=i; j<(vecLen-1); ++j )*vec[j] = *vec[j+1];
553 delete temp;
554
555
556 if( --vecLen == 0 ){
557 G4cout <<
" FALSE RETURN DUE TO ENERGY BALANCE " <<
G4endl;
558 return false;
559 }
560 }
561 }
562
563
564
565 G4double forwardKEDiff = forwardEnergy - forwardKinetic;
566 G4double backwardKEDiff = backwardEnergy - backwardKinetic;
567
568 if (forwardKEDiff < 0.0 || backwardKEDiff < 0.0) {
569 ReduceEnergiesOfSecondaries(0, forwardKinetic, backwardKinetic,
570 vec, vecLen,
571 pseudoParticle[4], pseudoParticle[5],
572 pt);
573
574 forwardKEDiff = forwardEnergy - forwardKinetic;
575 backwardKEDiff = backwardEnergy - backwardKinetic;
576 if (backwardKEDiff < 0.0) {
577 if (forwardKEDiff + backwardKEDiff > 0.0) {
578 backwardEnergy = backwardKinetic;
579 forwardEnergy += backwardKEDiff;
580 forwardKEDiff = forwardEnergy - forwardKinetic;
581 backwardKEDiff = 0.0;
582 } else {
583 G4cout <<
" False return due to insufficient backward energy " <<
G4endl;
584 return false;
585 }
586 }
587
588 if (forwardKEDiff < 0.0) {
589 if (forwardKEDiff + backwardKEDiff > 0.0) {
590 forwardEnergy = forwardKinetic;
591 backwardEnergy += forwardKEDiff;
592 backwardKEDiff = backwardEnergy - backwardKinetic;
593 forwardKEDiff = 0.0;
594 } else {
595 G4cout <<
" False return due to insufficient forward energy " <<
G4endl;
596 return false;
597 }
598 }
599 }
600
601
602
603
604
605
608 aspar = 0.60;
609 pt = std::sqrt( std::pow( ran/6.0, 1.7 ) );
611 aspar = 0.50;
612 pt = std::sqrt( std::pow( ran/5.0, 1.4 ) );
613 } else {
614 aspar = 0.40;
615 pt = std::sqrt( std::pow( ran/4.0, 1.2 ) );
616 }
617
619 currentParticle.
SetMomentum(pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV);
620 et = pseudoParticle[0].GetTotalEnergy()/GeV;
621 dndl[0] = 0.0;
622 vecMass = currentParticle.
GetMass()/GeV;
623
625
627 l = 1;
628
631 ed <<
" While count exceeded " <<
G4endl;
632 while( ( ran > dndl[l] ) && ( l < 19 ) ) {
633 l++;
634 loop++;
635 if (loop > 1000) {
637 break;
638 }
639 }
640
643
644 if (forwardEnergy < forwardKinetic) {
645 totalEnergy = vecMass + 0.04*std::fabs(
normal());
646 G4cout <<
" Not enough forward energy: forwardEnergy = "
647 << forwardEnergy << " forwardKinetic = "
648 << forwardKinetic << " total energy left = "
649 << backwardKEDiff + forwardKEDiff <<
G4endl;
650 } else {
651 totalEnergy = vecMass + forwardEnergy - forwardKinetic;
652 forwardKinetic = forwardEnergy;
653 }
655 pp = std::sqrt(std::abs( totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
657
658 if (pp1 < 1.0e-6*GeV) {
661 } else {
663 }
664 pseudoParticle[4] = pseudoParticle[4] + currentParticle;
665
666
667
668
669
670 if (backwardNucleonCount < 18) {
672 ++backwardNucleonCount;
673
674 } else {
675
676
677
678 vecMass = targetParticle.
GetMass()/GeV;
680 aspar = 0.40;
681 pt = std::max( 0.001, std::sqrt( std::pow( ran/4.0, 1.2 ) ) );
683 targetParticle.
SetMomentum(pt*std::cos(phi)*GeV, pt*std::sin(phi)*GeV);
684 et = pseudoParticle[1].GetTotalEnergy()/GeV;
685 outerCounter = 0;
686 innerCounter = 0;
687 G4bool marginalEnergy =
true;
688 dndl[0] = 0.0;
690 if( extraNucleonCount < 20 ) xxx = 0.95+0.05*extraNucleonCount/20.0;
692
693 while (++outerCounter < 4) {
695
696 for (innerCounter = 0; innerCounter < 6; innerCounter++) {
698 l = 1;
699
702 eda <<
" While count exceeded " <<
G4endl;
703 while( ( ran > dndl[l] ) && ( l < 19 ) ) {
704 l++;
705 loopa++;
706 if (loopa > 1000) {
708 break;
709 }
710 }
711
714 totalEnergy = std::sqrt(x*et*x*et + pt*pt + vecMass*vecMass);
716
717 if ((backwardKinetic+totalEnergy-vecMass) < xxx*backwardEnergy) {
718 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
719 backwardKinetic += totalEnergy - vecMass;
720 outerCounter = 3;
721 marginalEnergy = false;
722 break;
723 }
725 targetParticle.
SetMomentum(momentum.
x() * 0.9, momentum.
y() * 0.9);
726 pt *= 0.9;
727 dndl[19] *= 0.9;
728 }
729 }
730
731 if (marginalEnergy) {
732 G4cout <<
" Extra backward kinetic energy = "
733 << 0.999*backwardEnergy - backwardKinetic <<
G4endl;
734 totalEnergy = vecMass + 0.999*backwardEnergy - backwardKinetic;
736 pp = std::sqrt(std::abs(totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
737 targetParticle.
SetMomentum(momentum.
x()/0.9, momentum.
y()/0.9);
740 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
741 backwardKinetic = 0.999*backwardEnergy;
742 }
743
744 }
745
746 if (backwardEnergy < backwardKinetic)
747 G4cout <<
" Backward Edif = " << backwardEnergy - backwardKinetic <<
G4endl;
748 if (forwardEnergy != forwardKinetic)
749 G4cout <<
" Forward Edif = " << forwardEnergy - forwardKinetic <<
G4endl;
750
751
752
753
754
755
756
757
758
759 pseudoParticle[6].Lorentz( pseudoParticle[3], pseudoParticle[2] );
760 pseudoParticle[6] = pseudoParticle[6] - pseudoParticle[4];
761 pseudoParticle[6] = pseudoParticle[6] - pseudoParticle[5];
762
763 if (backwardNucleonCount == 1) {
764
765
766
768 std::min(backwardEnergy-backwardKinetic, centerofmassEnergy/2.0-protonMass/GeV);
769
770 if( ekin < 0.04 )ekin = 0.04 * std::fabs(
normal() );
771 vecMass = targetParticle.
GetMass()/GeV;
772 totalEnergy = ekin + vecMass;
774 pp = std::sqrt(std::abs(totalEnergy*totalEnergy - vecMass*vecMass) )*GeV;
775 pp1 = pseudoParticle[6].GetMomentum().mag();
776 if (pp1 < 1.0e-6*GeV) {
779 } else {
780 targetParticle.
SetMomentum( pseudoParticle[6].GetMomentum() * (pp/pp1));
781 }
782 pseudoParticle[5] = pseudoParticle[5] + targetParticle;
783
784 } else if (backwardNucleonCount > 1) {
785
786
788 if (backwardNucleonCount < 5) tempCount = backwardNucleonCount;
789 tempCount -= 2;
790
792 if (targetParticle.
GetSide() == -3)
793 clusterMass = targetParticle.
GetMass()/GeV;
794 for (i = 0; i < vecLen; ++i)
795 if (vec[i]->GetSide() == -3) clusterMass += vec[i]->GetMass()/GeV;
796 clusterMass += backwardEnergy - backwardKinetic;
797
798 totalEnergy = pseudoParticle[6].GetTotalEnergy()/GeV;
799 pseudoParticle[6].SetMass(clusterMass*GeV);
800
801 pp = std::sqrt(std::abs(totalEnergy*totalEnergy -
802 clusterMass*clusterMass) )*GeV;
803 pp1 = pseudoParticle[6].GetMomentum().mag();
804 if (pp1 < 1.0e-6*GeV) {
806 pseudoParticle[6].SetMomentum(iso.
x(), iso.
y(), iso.
z());
807 } else {
808 pseudoParticle[6].SetMomentum(pseudoParticle[6].GetMomentum() * (-pp/pp1));
809 }
810
811 std::vector<G4ReactionProduct*> tempList;
812 if (targetParticle.
GetSide() == -3) tempList.push_back(&targetParticle);
813 for (i = 0; i < vecLen; ++i)
814 if (vec[i]->GetSide() == -3) tempList.push_back(vec[i]);
815
816 constantCrossSection = true;
817
818 if (tempList.size() > 1) {
820
821
822
824 tempList);
825
826 if (targetParticle.
GetSide() == -3) {
827 targetParticle = *tempList[0];
828 targetParticle.
Lorentz(targetParticle, pseudoParticle[6]);
829 n_entry++;
830 }
831
832 for (i = 0; i < vecLen; ++i) {
833 if (vec[i]->GetSide() == -3) {
834 *vec[i] = *tempList[n_entry];
835 vec[i]->Lorentz(*vec[i], pseudoParticle[6]);
836 n_entry++;
837 }
838 }
839 }
840 } else return false;
841
842 if (vecLen == 0) return false;
843
844
845
846 currentParticle.Lorentz( currentParticle, pseudoParticle[1] );
847 targetParticle.
Lorentz( targetParticle, pseudoParticle[1] );
848 for (i = 0; i < vecLen; ++i) vec[i]->Lorentz(*vec[i], pseudoParticle[1]);
849
850
851
852
853
854
855
856
857
858 G4bool leadingStrangeParticleHasChanged =
true;
859 if (leadFlag)
860 {
861 if (currentParticle.GetDefinition() == leadingStrangeParticle.
GetDefinition())
862 leadingStrangeParticleHasChanged = false;
863 if (leadingStrangeParticleHasChanged &&
865 leadingStrangeParticleHasChanged = false;
866 if( leadingStrangeParticleHasChanged )
867 {
868 for( i=0; i<vecLen; i++ )
869 {
870 if( vec[i]->GetDefinition() == leadingStrangeParticle.
GetDefinition() )
871 {
872 leadingStrangeParticleHasChanged = false;
873 break;
874 }
875 }
876 }
877 if( leadingStrangeParticleHasChanged )
878 {
885
886
887
888 if( (leadTest&&targetTest) || !(leadTest||targetTest) )
889 {
891 targetHasChanged = true;
892 }
893 else
894 {
895 currentParticle.SetDefinitionAndUpdateE( leadingStrangeParticle.
GetDefinition() );
896 incidentHasChanged = false;
897 }
898 }
899 }
900
901
902
903
904 std::pair<G4int, G4int> finalStateNucleons =
906
907 G4int protonsInFinalState = finalStateNucleons.first;
908 G4int neutronsInFinalState = finalStateNucleons.second;
909
910 G4int numberofFinalStateNucleons =
911 protonsInFinalState + neutronsInFinalState;
912
913 if (currentParticle.GetDefinition()->GetBaryonNumber() == 1 &&
917 numberofFinalStateNucleons++;
918
919 numberofFinalStateNucleons = std::max(1, numberofFinalStateNucleons);
920
921 G4int PinNucleus = std::max(0,
923 G4int NinNucleus = std::max(0,
925
926 pseudoParticle[3].SetMomentum( 0.0, 0.0, pOriginal*GeV );
927 pseudoParticle[3].SetMass( mOriginal*GeV );
928 pseudoParticle[3].SetTotalEnergy(
929 std::sqrt( pOriginal*pOriginal + mOriginal*mOriginal )*GeV );
930
934 if(numberofFinalStateNucleons == 1) diff = 0;
935 pseudoParticle[4].SetMomentum( 0.0, 0.0, 0.0 );
936 pseudoParticle[4].SetMass( protonMass*(numberofFinalStateNucleons-diff) );
937 pseudoParticle[4].SetTotalEnergy( protonMass*(numberofFinalStateNucleons-diff) );
938
940 pseudoParticle[3].GetTotalEnergy() + pseudoParticle[4].GetTotalEnergy() -
941 currentParticle.GetMass() - targetParticle.
GetMass();
942 for (i = 0; i < vecLen; ++i) theoreticalKinetic -= vec[i]->GetMass();
943
946 for (i = 0; i < vecLen; ++i)
947 simulatedKinetic += vec[i]->GetKineticEnergy();
948
949 pseudoParticle[5] = pseudoParticle[3] + pseudoParticle[4];
950 pseudoParticle[3].Lorentz( pseudoParticle[3], pseudoParticle[5] );
951 pseudoParticle[4].Lorentz( pseudoParticle[4], pseudoParticle[5] );
952
953 pseudoParticle[7].SetZero();
954 pseudoParticle[7] = pseudoParticle[7] + currentParticle;
955 pseudoParticle[7] = pseudoParticle[7] + targetParticle;
956 for (i = 0; i < vecLen; ++i)
957 pseudoParticle[7] = pseudoParticle[7] + *vec[i];
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002 if (simulatedKinetic != 0.0) {
1003 wgt = theoreticalKinetic/simulatedKinetic;
1005 simulatedKinetic = theoreticalKinetic;
1006 currentParticle.SetKineticEnergy(theoreticalKinetic);
1007 pp = currentParticle.GetTotalMomentum();
1008 pp1 = currentParticle.GetMomentum().mag();
1009 if (pp1 < 1.0e-6*GeV) {
1011 currentParticle.SetMomentum( iso.
x(), iso.
y(), iso.
z() );
1012 } else {
1013 currentParticle.SetMomentum(currentParticle.GetMomentum() * (pp/pp1));
1014 }
1015
1016 theoreticalKinetic = targetParticle.GetKineticEnergy() * wgt;
1017 targetParticle.SetKineticEnergy(theoreticalKinetic);
1018 simulatedKinetic += theoreticalKinetic;
1019 pp = targetParticle.GetTotalMomentum();
1020 pp1 = targetParticle.GetMomentum().mag();
1021
1022 if (pp1 < 1.0e-6*GeV) {
1024 targetParticle.SetMomentum(iso.
x(), iso.
y(), iso.
z() );
1025 } else {
1026 targetParticle.SetMomentum(targetParticle.GetMomentum() * (pp/pp1) );
1027 }
1028
1029 for (i = 0; i < vecLen; ++i ) {
1030 theoreticalKinetic = vec[i]->GetKineticEnergy() * wgt;
1031 simulatedKinetic += theoreticalKinetic;
1032 vec[i]->SetKineticEnergy(theoreticalKinetic);
1033 pp = vec[i]->GetTotalMomentum();
1034 pp1 = vec[i]->GetMomentum().mag();
1035 if( pp1 < 1.0e-6*GeV ) {
1037 vec[i]->SetMomentum(iso.
x(), iso.
y(), iso.
z() );
1038 } else {
1039 vec[i]->SetMomentum(vec[i]->GetMomentum() * (pp/pp1) );
1040 }
1041 }
1042 }
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052 if( atomicWeight >= 1.5 )
1053 {
1054
1055
1056
1057
1058
1059
1062
1064 if (veryForward) {
1067 } else {
1070 }
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1086
1087
1088
1089
1090
1091
1092 if (epnb > pnCutOff)
1093 {
1094 npnb =
G4Poisson((1.5+1.25*numberofFinalStateNucleons)*epnb/(epnb+edta));
1095 if (numberofFinalStateNucleons + npnb > atomicWeight)
1096 npnb =
G4int(atomicWeight+0.00001 - numberofFinalStateNucleons);
1097 npnb = std::min( npnb, 127-vecLen );
1098 }
1099 if( edta >= dtaCutOff )
1100 {
1101 ndta =
G4Poisson((1.5+1.25*numberofFinalStateNucleons)*edta/(epnb+edta));
1102 ndta = std::min( ndta, 127-vecLen );
1103 }
1104 if (npnb == 0 && ndta == 0) npnb = 1;
1105
1107 PinNucleus, NinNucleus, targetNucleus,
1108 vec, vecLen);
1109 }
1110
1111
1112
1113
1114
1115
1116
1117
1118 if( (atomicWeight >= 1.5) && (atomicWeight <= 230.0) && (ekOriginal <= 0.2) )
1119 currentParticle.SetTOF(
1121 else
1122 currentParticle.SetTOF( 1.0 );
1123 return true;
1124
1125}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
G4long G4Poisson(G4double mean)
G4GLOB_DLL 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 G4Pow * GetInstance()
G4double A13(G4double A) const
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
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 SetDefinitionAndUpdateE(const G4ParticleDefinition *aParticleDefinition)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
void SetMass(const G4double mas)