44   outFile << 
"G4HEPionPlusInelastic is one of the High Energy\n" 
   45           << 
"Parameterized (HEP) models used to implement inelastic\n" 
   46           << 
"pi+ scattering from nuclei.  It is a re-engineered\n" 
   47           << 
"version of the GHEISHA code of H. Fesefeldt.  It divides the\n" 
   48           << 
"initial collision products into backward- and forward-going\n" 
   49           << 
"clusters which are then decayed into final state hadrons.\n" 
   50           << 
"The model does not conserve energy on an event-by-event\n" 
   51           << 
"basis.  It may be applied to pi+ with initial energies\n" 
   76   G4double incidentKineticEnergy = incidentTotalEnergy - incidentMass;
 
   78   if (incidentKineticEnergy < 1.)
 
   79     G4cout << 
"G4HEPionPlusInelastic: incident energy < 1 GeV" << 
G4endl;
 
   82     G4cout << 
"G4HEPionPlusInelastic::ApplyYourself" << 
G4endl;
 
   84            << 
"mass "              << incidentMass
 
   85            << 
"kinetic energy "    << incidentKineticEnergy
 
   87     G4cout << 
"target material with (A,Z) = ("  
   88            << atomicWeight << 
"," << atomicNumber << 
")" << 
G4endl;
 
   92                                               atomicWeight, atomicNumber);
 
   94     G4cout << 
"nuclear inelasticity = " << inelasticity << 
G4endl;
 
   96   incidentKineticEnergy -= inelasticity;
 
  102                                           atomicWeight, atomicNumber,
 
  104                                           excitationEnergyDTA);
 
  106     G4cout << 
"nuclear excitation = " << excitation << excitationEnergyGNP 
 
  107            << excitationEnergyDTA << 
G4endl;             
 
  109   incidentKineticEnergy -= excitation;
 
  110   incidentTotalEnergy = incidentKineticEnergy + incidentMass;
 
  123   G4double centerOfMassEnergy = std::sqrt(incidentMass*incidentMass
 
  124                                         + targetMass*targetMass
 
  125                                         + 2.0*targetMass*incidentTotalEnergy);
 
  126   G4double availableEnergy = centerOfMassEnergy - targetMass - incidentMass;
 
  133     G4cout << 
"ApplyYourself: CallFirstIntInCascade for particle " 
  134            << incidentCode << 
G4endl;
 
  136   G4bool successful = 
false; 
 
  139                         incidentParticle, targetParticle, atomicWeight);
 
  142     G4cout << 
"ApplyYourself::StrangeParticlePairProduction" << 
G4endl;
 
  144   if ((
vecLength > 0) && (availableEnergy > 1.)) 
 
  147                                   incidentParticle, targetParticle);
 
  150                       excitationEnergyGNP, excitationEnergyDTA,
 
  151                       incidentParticle, targetParticle,
 
  152                       atomicWeight, atomicNumber);
 
  155                                 excitationEnergyGNP, excitationEnergyDTA,
 
  156                                 incidentParticle, targetParticle,
 
  157                                 atomicWeight, atomicNumber);
 
  160                           excitationEnergyGNP, excitationEnergyDTA, 
 
  161                           incidentParticle, targetParticle,
 
  162                           atomicWeight, atomicNumber);
 
  166                                   excitationEnergyGNP, excitationEnergyDTA,       
 
  167                                   incidentParticle, targetParticle,
 
  168                                   atomicWeight, atomicNumber);
 
  171                            excitationEnergyGNP, excitationEnergyDTA,
 
  172                            incidentParticle, targetParticle, 
 
  173                            atomicWeight, atomicNumber);
 
  177                       atomicWeight, atomicNumber);
 
  180     G4cout << 
"GHEInelasticInteraction::ApplyYourself fails to produce final state particles"  
  208   static const G4double expxl = -expxu;  
 
  214   static const G4int numMul = 1200;
 
  215   static const G4int numSec = 60;
 
  224   static G4bool first = 
true;
 
  225   static G4double protmul[numMul], protnorm[numSec];  
 
  226   static G4double neutmul[numMul], neutnorm[numSec];  
 
  231   G4int i, counter, 
nt, npos, nneg, nzero;
 
  236        for( i=0; i<numMul; i++ )protmul[i]  = 0.0;
 
  237        for( i=0; i<numSec; i++ )protnorm[i] = 0.0;
 
  239        for( npos=0; npos<(numSec/3); npos++ ) 
 
  241             for( nneg=
Imax(0,npos-2); nneg<=npos; nneg++ ) 
 
  243                  for( nzero=0; nzero<numSec/3; nzero++ ) 
 
  245                       if( ++counter < numMul ) 
 
  247                           nt = npos+nneg+nzero;
 
  248                           if( (nt>0) && (nt<=numSec) ) 
 
  251                                     pmltpc(npos,nneg,nzero,nt,protb,c) ;
 
  252                               protnorm[nt-1] += protmul[counter];
 
  258        for( i=0; i<numMul; i++ )neutmul[i]  = 0.0;
 
  259        for( i=0; i<numSec; i++ )neutnorm[i] = 0.0;
 
  261        for( npos=0; npos<numSec/3; npos++ ) 
 
  263             for( nneg=
Imax(0,npos-1); nneg<=(npos+1); nneg++ ) 
 
  265                  for( nzero=0; nzero<numSec/3; nzero++ ) 
 
  267                       if( ++counter < numMul ) 
 
  269                           nt = npos+nneg+nzero;
 
  270                           if( (nt>0) && (nt<=numSec) ) 
 
  273                                       pmltpc(npos,nneg,nzero,nt,neutb,c);
 
  274                                neutnorm[nt-1] += neutmul[counter];
 
  280        for( i=0; i<numSec; i++ ) 
 
  282             if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
 
  283             if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
 
  290    pv[0] = incidentParticle;
 
  291    pv[1] = targetParticle;
 
  296        if( targetCode == neutronCode ) 
 
  298            G4double cech[] = {0.33,0.27,0.29,0.31,0.27,0.18,0.13,0.10,0.09,0.07};
 
  300            if( 
G4UniformRand() < cech[iplab]/std::pow(atomicWeight,0.42) ) 
 
  308    else if (availableEnergy <= pionMass)
 
  313    npos = 0, nneg = 0, nzero = 0;
 
  317    G4double supp[] = {0., 0.2, 0.45, 0.55, 0.65, 0.75, 0.85, 0.90, 0.94, 0.98};
 
  323        if( targetCode == protonCode )                    
 
  325            w0 = - 
sqr(1.+protb)/(2.*c*
c);
 
  326            wp = w0 = std::exp(w0);
 
  328              { npos = 0; nneg = 0; nzero = 1; }
 
  330              { npos = 1; nneg = 0; nzero = 0; }       
 
  334            w0 = -
sqr(1.+neutb)/(2.*c*
c);
 
  335            wp = w0 = std::exp(w0);
 
  336            wm = -
sqr(-1.+neutb)/(2.*c*
c);
 
  342              { npos = 0; nneg = 0; nzero = 1; }       
 
  343            else if( ran < wp/wt)
 
  344              { npos = 1; nneg = 0; nzero = 0; }       
 
  346              { npos = 0; nneg = 1; nzero = 0; }       
 
  353        G4double aleab = std::log(availableEnergy);
 
  354        G4double n     = 3.62567+aleab*(0.665843+aleab*(0.336514
 
  355                     + aleab*(0.117712+0.0136912*aleab))) - 2.0;
 
  361        for (nt=1; nt<=numSec; nt++) {
 
  362          test = std::exp( 
Amin( expxu, 
Amax( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  363          dum = 
pi*nt/(2.0*n*
n);
 
  364          if (std::fabs(dum) < 1.0) { 
 
  365            if( test >= 1.0
e-10 )anpn += dum*
test;
 
  373        if( targetCode == protonCode ) 
 
  376            for (npos=0; npos<numSec/3; npos++) {
 
  377              for (nneg=
Imax(0,npos-2); nneg<=npos; nneg++) {
 
  378                for (nzero=0; nzero<numSec/3; nzero++) {
 
  379                  if (++counter < numMul) {
 
  380                    nt = npos+nneg+nzero;
 
  381                    if ( (nt>0) && (nt<=numSec) ) {
 
  382                      test = std::exp( 
Amin( expxu, 
Amax( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  383                      dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
 
  384                      if (std::fabs(dum) < 1.0) { 
 
  385                        if( test >= 1.0
e-10 )excs += dum*
test;
 
  389                      if (ran < excs) 
goto outOfLoop;      
 
  403            for (npos=0; npos<numSec/3; npos++) {
 
  404              for (nneg=
Imax(0,npos-1); nneg<=(npos+1); nneg++) {
 
  405                for (nzero=0; nzero<numSec/3; nzero++) {
 
  406                  if (++counter < numMul) {
 
  407                    nt = npos+nneg+nzero;
 
  408                    if ( (nt>=1) && (nt<=numSec) ) {
 
  409                      test = std::exp( 
Amin( expxu, 
Amax( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  410                      dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
 
  411                      if (std::fabs(dum) < 1.0) { 
 
  412                        if( test >= 1.0
e-10 )excs += dum*
test;
 
  416                      if (ran < excs) 
goto outOfLoop;  
 
  429    if( targetCode == protonCode)
 
  434        else if (npos == (1+nneg))
 
  464        else if ( npos == (1+nneg))
 
  475    nt = npos + nneg + nzero;
 
  486          else if ( ran < (
G4double)(npos+nneg)/nt)
 
  502          nt = npos + nneg + nzero;
 
  506         G4cout << 
"Particles produced: " ;
 
  509         for (i=2; i < vecLen; i++)