39   outFile << 
"G4LESigmaMinusInelastic is one of the Low Energy Parameterized\n" 
   40           << 
"(LEP) models used to implement inelastic Sigma- scattering\n" 
   41           << 
"from nuclei.  It is a re-engineered version of the GHEISHA\n" 
   42           << 
"code of H. Fesefeldt.  It divides the initial collision\n" 
   43           << 
"products into backward- and forward-going clusters which are\n" 
   44           << 
"then decayed into final state hadrons.  The model does not\n" 
   45           << 
"conserve energy on an event-by-event basis.  It may be\n" 
   46           << 
"applied to Sigma- with initial energies between 0 and 25\n" 
   67     G4cout << 
"G4LESigmaMinusInelastic::ApplyYourself called" << 
G4endl;
 
   69     G4cout << 
"target material = " << targetMaterial->
GetName() << 
", ";
 
   79   modifiedOriginal = *originalIncident;
 
   85   G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
 
   97   p = std::sqrt( std::abs((et-amas)*(et+amas)) );
 
  105   targetParticle = *originalTarget;
 
  108   G4bool incidentHasChanged = 
false;
 
  109   G4bool targetHasChanged = 
false;
 
  110   G4bool quasiElastic = 
false;
 
  117     Cascade(vec, vecLen, originalIncident, currentParticle, targetParticle,
 
  118             incidentHasChanged, targetHasChanged, quasiElastic);
 
  121                    modifiedOriginal, targetNucleus, currentParticle,
 
  122                    targetParticle, incidentHasChanged, targetHasChanged,
 
  125   SetUpChange(vec, vecLen, currentParticle, targetParticle, incidentHasChanged);
 
  129   delete originalTarget;
 
  134 void G4LESigmaMinusInelastic::Cascade(
 
  140    G4bool &incidentHasChanged,
 
  157     G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
 
  158                                         targetMass*targetMass +
 
  159                                         2.0*targetMass*etOriginal );
 
  160     G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
 
  166     static G4bool first = 
true;
 
  167     const G4int numMul = 1200;
 
  168     const G4int numSec = 60;
 
  169     static G4double protmul[numMul], protnorm[numSec]; 
 
  170     static G4double neutmul[numMul], neutnorm[numSec]; 
 
  172     G4int counter, 
nt=0, npos=0, nneg=0, nzero=0;
 
  180       for( i=0; i<numMul; ++i )protmul[i] = 0.0;
 
  181       for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
 
  183       for( npos=0; npos<(numSec/3); ++npos )
 
  185         for( nneg=std::max(0,npos-1); nneg<=(npos+1); ++nneg )
 
  187           for( nzero=0; nzero<numSec/3; ++nzero )
 
  189             if( ++counter < numMul )
 
  191               nt = npos+nneg+nzero;
 
  192               if( nt>0 && nt<=numSec )
 
  194                 protmul[counter] = 
Pmltpc(npos,nneg,nzero,nt,b[0],c);
 
  195                 protnorm[nt-1] += protmul[counter];
 
  201       for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
 
  202       for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
 
  204       for( npos=0; npos<numSec/3; ++npos )
 
  206         for( nneg=npos; nneg<=(npos+2); ++nneg )
 
  208           for( nzero=0; nzero<numSec/3; ++nzero )
 
  210             if( ++counter < numMul )
 
  212               nt = npos+nneg+nzero;
 
  213               if( nt>0 && nt<=numSec )
 
  215                 neutmul[counter] = 
Pmltpc(npos,nneg,nzero,nt,b[1],c);
 
  216                 neutnorm[nt-1] += neutmul[counter];
 
  222       for( i=0; i<numSec; ++i )
 
  224         if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
 
  225         if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
 
  245       for( npos=0; npos<numSec/3 && ran>=excs; ++npos )
 
  247         for( nneg=std::max(0,npos-1); nneg<=(npos+1) && ran>=excs; ++nneg )
 
  249           for( nzero=0; nzero<numSec/3 && ran>=excs; ++nzero )
 
  251             if( ++counter < numMul )
 
  253               nt = npos+nneg+nzero;
 
  254               if( nt>0 && nt<=numSec )
 
  256                 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  257                 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
 
  258                 if( std::fabs(dum) < 1.0 )
 
  260                   if( test >= 1.0
e-10 )excs += dum*
test;
 
  274       npos--; nneg--; nzero--;
 
  275       G4int ncht = std::max( 1, npos-nneg+2 );
 
  283          incidentHasChanged = 
true;
 
  292            incidentHasChanged = 
true;
 
  294            targetHasChanged = 
true;
 
  299          targetHasChanged = 
true;
 
  306       for( npos=0; npos<numSec/3 && ran>=excs; ++npos )
 
  308         for( nneg=npos; nneg<=(npos+2) && ran>=excs; ++nneg )
 
  310           for( nzero=0; nzero<numSec/3 && ran>=excs; ++nzero )
 
  312             if( ++counter < numMul )
 
  314               nt = npos+nneg+nzero;
 
  315               if( nt>0 && nt<=numSec )
 
  317                 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  318                 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
 
  319                 if( std::fabs(dum) < 1.0 )
 
  321                   if( test >= 1.0
e-10 )excs += dum*
test;
 
  335       npos--; nneg--; nzero--;
 
  336       G4int ncht = std::max( 1, npos-nneg+3 );
 
  344          incidentHasChanged = 
true;
 
  346          targetHasChanged = 
true;
 
  355            incidentHasChanged = 
true;
 
  360            targetHasChanged = 
true;