1417 G4cout <<
" >>> G4NucleiModel::initializeCascad(bullet,target,output)" 1421 const G4double max_a_for_cascad = 5.0;
1423 const G4double small_ekin = 1.0e-6;
1424 const G4double r_large2for3 = 62.0;
1427 const G4double r_large2for4 = 69.14;
1430 const G4int itry_max = 100;
1433 std::vector<G4CascadParticle>& casparticles = output.first;
1434 std::vector<G4InuclElementaryParticle>& particles = output.second;
1436 casparticles.clear();
1447 if (ab < max_a_for_cascad) {
1451 G4double ben = benb < bent ? bent : benb;
1457 while (casparticles.size() == 0 && itryg < itry_max) {
1475 while (bad && itry < itry_max) {
1477 p = 456.0 * inuclRndm();
1479 if (p * p / (p * p + 2079.36) / (p * p + 2079.36) > 1.2023
e-4 * inuclRndm() &&
1480 p * r > 312.0) bad =
false;
1483 if (itry == itry_max)
1485 G4cout <<
" deutron bullet generation-> itry = " << itry_max <<
G4endl;
1507 while (badco && itry < itry_max) {
1512 for (i = 0; i < 2; i++) {
1517 while (itry1 < itry_max) {
1519 ss = -
G4Log(inuclRndm());
1520 u = fmax * inuclRndm();
1521 rho = std::sqrt(ss) *
G4Exp(-ss);
1523 if (rho > u && ss < s3max) {
1524 ss = r0forAeq3 * std::sqrt(ss);
1525 coord1 = generateWithRandomAngles(ss).vect();
1535 if (itry1 == itry_max) {
1536 coord1.
set(10000.,10000.,10000.);
1547 coordinates.push_back(coord1);
1549 G4bool large_dist =
false;
1551 for (i = 0; i < 2; i++) {
1552 for (
G4int j = i+1; j < 3; j++) {
1553 G4double r2 = (coordinates[i]-coordinates[j]).mag2();
1556 G4cout <<
" i " << i <<
" j " << j <<
" r2 " << r2 <<
G4endl;
1559 if (r2 > r_large2for3) {
1566 if (large_dist)
break;
1569 if(!large_dist) badco =
false;
1576 G4double u = b1 + std::sqrt(b1 * b1 + b);
1579 while (badco && itry < itry_max) {
1581 if (itry > 0) coordinates.clear();
1585 for (i = 0; i < ab-1; i++) {
1589 while (itry1 < itry_max) {
1591 ss = -
G4Log(inuclRndm());
1592 u = fmax * inuclRndm();
1594 if (std::sqrt(ss) *
G4Exp(-ss) * (1.0 + ss/b) > u
1596 ss = r0forAeq4 * std::sqrt(ss);
1597 coord1 = generateWithRandomAngles(ss).vect();
1598 coordinates.push_back(coord1);
1608 if (itry1 == itry_max) {
1609 coord1.
set(10000.,10000.,10000.);
1610 coordinates.push_back(coord1);
1616 for(
G4int j = 0; j < ab -1; j++) coord1 -= coordinates[j];
1618 coordinates.push_back(coord1);
1624 G4bool large_dist =
false;
1626 for (i = 0; i < ab-1; i++) {
1627 for (
G4int j = i+1; j <
ab; j++) {
1629 G4double r2 = (coordinates[i]-coordinates[j]).mag2();
1632 G4cout <<
" i " << i <<
" j " << j <<
" r2 " << r2 <<
G4endl;
1635 if (r2 > r_large2for4) {
1642 if (large_dist)
break;
1645 if (!large_dist) badco =
false;
1650 G4cout <<
" can not generate the nucleons coordinates for a " 1653 casparticles.clear();
1662 for (
G4int i = 0; i < ab - 1; i++) {
1665 while(itry2 < itry_max) {
1667 u = -
G4Log(0.879853 - 0.8798502 * inuclRndm());
1670 if(x > inuclRndm()) {
1671 p = std::sqrt(0.01953 * u);
1672 mom = generateWithRandomAngles(p, massb);
1679 if(itry2 == itry_max) {
1680 G4cout <<
" can not generate proper momentum for a " 1683 casparticles.clear();
1703 for(i = 0; i <
G4int(coordinates.size()); i++) {
1704 G4double rp = coordinates[i].mag2();
1706 if(rp > rb) rb = rp;
1710 G4double s1 = std::sqrt(inuclRndm());
1713 G4ThreeVector global_pos(rz*std::cos(phi), rz*std::sin(phi),
1716 for (i = 0; i <
G4int(coordinates.size()); i++) {
1717 coordinates[i] += global_pos;
1723 for (
G4int ipa = 0; ipa <
ab; ipa++) {
1724 G4int knd = ipa < zb ? 1 : 2;
1730 toTheBulletRestFrame.toTheTargetRestFrame();
1735 ipart->setMomentum(toTheBulletRestFrame.backToTheLab(ipart->getMomentum()));
1745 - coordinates[ip].mag2();
1752 if(std::fabs(t1) <= std::fabs(t2)) {
1754 if(coordinates[ip].
z() + mom.
z() * t1 / pmod <= 0.0) tr =
t1;
1757 if(tr < 0.0 && t2 > 0.0) {
1759 if(coordinates[ip].
z() + mom.
z() * t2 / pmod <= 0.0) tr =
t2;
1765 if(coordinates[ip].
z() + mom.
z() * t2 / pmod <= 0.0) tr =
t2;
1768 if(tr < 0.0 && t1 > 0.0) {
1769 if(coordinates[ip].
z() + mom.
z() * t1 / pmod <= 0.0) tr =
t1;
1776 coordinates[ip] += mom.
vect()*tr / pmod;
1787 if(casparticles.size() == 0) {
1790 G4cout <<
" can not generate proper distribution for " << itry_max
1799 G4cout <<
" cascad particles: " << casparticles.size() <<
G4endl;
1800 for(ip = 0; ip <
G4int(casparticles.size()); ip++)
1801 G4cout << casparticles[ip] << G4endl;
1803 G4cout <<
" outgoing particles: " << particles.size() <<
G4endl;
1804 for(ip = 0; ip <
G4int(particles.size()); ip++)
1805 G4cout << particles[ip] << G4endl;
void set(double x, double y, double z)
static const G4double large
G4GLOB_DLL std::ostream G4cout
std::vector< G4LorentzVector > momentums
std::vector< G4ThreeVector > coordinates
G4double G4Log(G4double x)
double dot(const Hep3Vector &) const
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double getKineticEnergy() const
std::vector< G4InuclElementaryParticle > raw_particles
std::vector< G4InuclElementaryParticle >::iterator particleIterator
void setVect(const Hep3Vector &)
G4double getEnergy() const