43   outFile << 
"G4HEXiZeroInelastic is one of the High Energy\n" 
   44           << 
"Parameterized (HEP) models used to implement inelastic\n" 
   45           << 
"Xi0 scattering from nuclei.  It is a re-engineered\n" 
   46           << 
"version of the GHEISHA code of H. Fesefeldt.  It divides the\n" 
   47           << 
"initial collision products into backward- and forward-going\n" 
   48           << 
"clusters which are then decayed into final state hadrons.\n" 
   49           << 
"The model does not conserve energy on an event-by-event\n" 
   50           << 
"basis.  It may be applied to Xi0 with initial energies\n" 
   75   G4double incidentKineticEnergy = incidentTotalEnergy - incidentMass;
 
   77   if (incidentKineticEnergy < 1.)
 
   78     G4cout << 
"GHEXiZeroInelastic: incident energy < 1 GeV" << 
G4endl;
 
   81     G4cout << 
"G4HEXiZeroInelastic::ApplyYourself" << 
G4endl;
 
   83            << 
"mass "              << incidentMass
 
   84            << 
"kinetic energy "    << incidentKineticEnergy
 
   86     G4cout << 
"target material with (A,Z) = ("  
   87            << atomicWeight << 
"," << atomicNumber << 
")" << 
G4endl;
 
   91                                               atomicWeight, atomicNumber);
 
   93     G4cout << 
"nuclear inelasticity = " << inelasticity << 
G4endl;
 
   95   incidentKineticEnergy -= inelasticity;
 
  101                                           atomicWeight, atomicNumber,
 
  103                                           excitationEnergyDTA);
 
  105     G4cout << 
"nuclear excitation = " << excitation << excitationEnergyGNP 
 
  106            << excitationEnergyDTA << 
G4endl;             
 
  108   incidentKineticEnergy -= excitation;
 
  109   incidentTotalEnergy = incidentKineticEnergy + incidentMass;
 
  122   G4double centerOfMassEnergy = std::sqrt(incidentMass*incidentMass
 
  123                                          + targetMass*targetMass
 
  124                                          + 2.0*targetMass*incidentTotalEnergy);
 
  125   G4double availableEnergy = centerOfMassEnergy - targetMass - incidentMass;
 
  131     G4cout << 
"ApplyYourself: CallFirstIntInCascade for particle " 
  132            << incidentCode << 
G4endl;
 
  134   G4bool successful = 
false; 
 
  137                       incidentParticle, targetParticle, atomicWeight);
 
  140     G4cout << 
"ApplyYourself::StrangeParticlePairProduction" << 
G4endl;
 
  142   if ((
vecLength > 0) && (availableEnergy > 1.)) 
 
  145                                   incidentParticle, targetParticle);
 
  148                       excitationEnergyGNP, excitationEnergyDTA,
 
  149                       incidentParticle, targetParticle,
 
  150                       atomicWeight, atomicNumber);
 
  153                                 excitationEnergyGNP, excitationEnergyDTA,
 
  154                                 incidentParticle, targetParticle,
 
  155                                 atomicWeight, atomicNumber);
 
  158                           excitationEnergyGNP, excitationEnergyDTA, 
 
  159                           incidentParticle, targetParticle,
 
  160                           atomicWeight, atomicNumber);
 
  164                                   excitationEnergyGNP, excitationEnergyDTA,       
 
  165                                   incidentParticle, targetParticle,
 
  166                                   atomicWeight, atomicNumber);
 
  169                            excitationEnergyGNP, excitationEnergyDTA,
 
  170                            incidentParticle, targetParticle, 
 
  171                            atomicWeight, atomicNumber);
 
  175                       atomicWeight, atomicNumber);
 
  178     G4cout << 
"GHEInelasticInteraction::ApplyYourself fails to produce final state particles" 
  206   static const G4double expxl = -expxu;  
 
  212   static const G4int numMul = 1200;
 
  213   static const G4int numSec = 60;
 
  219   static G4bool first = 
true;
 
  220   static G4double protmul[numMul], protnorm[numSec];  
 
  221   static G4double neutmul[numMul], neutnorm[numSec];  
 
  226   G4int i, counter, 
nt, npos, nneg, nzero;
 
  231     for (i = 0; i < numMul; i++) protmul[i] = 0.0;
 
  232     for (i = 0; i < numSec; i++) protnorm[i] = 0.0;
 
  234     for (npos = 0; npos < (numSec/3); npos++) {
 
  235       for (nneg = std::max(0,npos-2); nneg <= npos; nneg++) {
 
  236         for (nzero = 0; nzero < numSec/3; nzero++) {
 
  237           if (++counter < numMul) {
 
  238             nt = npos+nneg+nzero;
 
  239             if ((nt>0) && (nt<=numSec) ) {
 
  240               protmul[counter] = 
pmltpc(npos,nneg,nzero,nt,protb,c);
 
  241               protnorm[nt-1] += protmul[counter];
 
  248     for( i=0; i<numMul; i++ )neutmul[i]  = 0.0;
 
  249     for( i=0; i<numSec; i++ )neutnorm[i] = 0.0;
 
  251        for( npos=0; npos<numSec/3; npos++ ) 
 
  253             for( nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++ ) 
 
  255                  for( nzero=0; nzero<numSec/3; nzero++ ) 
 
  257                       if( ++counter < numMul ) 
 
  259                           nt = npos+nneg+nzero;
 
  260                           if( (nt>0) && (nt<=numSec) ) 
 
  262                                neutmul[counter] = 
pmltpc(npos,nneg,nzero,nt,neutb,c);
 
  263                                neutnorm[nt-1] += neutmul[counter];
 
  269     for (i = 0; i < numSec; i++) {
 
  270       if (protnorm[i] > 0.0) protnorm[i] = 1.0/protnorm[i];
 
  271       if (neutnorm[i] > 0.0) neutnorm[i] = 1.0/neutnorm[i];
 
  276   pv[0] = incidentParticle;
 
  277   pv[1] = targetParticle;
 
  282        G4double cech[] = {0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.06, 0.04, 0.005, 0.};
 
  283        G4int iplab = 
G4int( std::min( 9.0, incidentTotalMomentum*2.5 ) );
 
  284        if( 
G4UniformRand() < cech[iplab]/std::pow(atomicWeight,0.42) ) 
 
  287            if( targetCode == protonCode)
 
  371    npos = 0; nneg = 0; nzero = 0;
 
  375    G4double aleab = std::log(availableEnergy);
 
  376    G4double n     = 3.62567+aleab*(0.665843+aleab*(0.336514
 
  377                     + aleab*(0.117712+0.0136912*aleab))) - 2.0;
 
  383    for (nt=1; nt<=numSec; nt++) {
 
  384      test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  385      dum = 
pi*nt/(2.0*n*
n);
 
  386      if (std::fabs(dum) < 1.0) {
 
  387        if (test >= 1.0
e-10) anpn += dum*
test;
 
  395    if( targetCode == protonCode ) 
 
  398        for (npos=0; npos<numSec/3; npos++) {
 
  399          for (nneg=std::max(0,npos-2); nneg<=npos; nneg++) {
 
  400            for (nzero=0; nzero<numSec/3; nzero++) {
 
  401              if (++counter < numMul) {
 
  402                nt = npos+nneg+nzero;
 
  403                if ( (nt>0) && (nt<=numSec) ) {
 
  404                  test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  405                  dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
 
  406                  if (std::fabs(dum) < 1.0) { 
 
  407                    if (test >= 1.0
e-10) excs += dum*
test;
 
  411                  if (ran < excs) 
goto outOfLoop;      
 
  426        for (npos=0; npos<numSec/3; npos++) {
 
  427          for (nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++) {
 
  428            for (nzero=0; nzero<numSec/3; nzero++) {
 
  429              if (++counter < numMul) {
 
  430                nt = npos+nneg+nzero;
 
  431                if ( (nt>=1) && (nt<=numSec) ) {
 
  432                  test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  433                  dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
 
  434                  if (std::fabs(dum) < 1.0) { 
 
  435                    if (test >= 1.0
e-10) excs += dum*
test;
 
  439                  if (ran < excs) 
goto outOfLoop;       
 
  458   if (targetCode == protonCode) {
 
  462        else if (npos == (nneg+1))
 
  490        else if (npos == (nneg-1))
 
  500   nt = npos + nneg + nzero;
 
  508     } 
else if (rnd < (
G4double)(npos+nneg)/nt) {   
 
  519     nt = npos + nneg + nzero;
 
  523     G4cout << 
"Particles produced: " ;
 
  526     for ( i = 2; i < vecLen; i++) 
G4cout << pv[i].getCode() << 
" " ;