55       G4cout << 
"G4RPGAntiProtonInelastic::ApplyYourself called" << 
G4endl;
 
   57       G4cout << 
"target material = " << targetMaterial->
GetName() << 
", ";
 
   68     modifiedOriginal = *originalIncident;
 
   74     G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
 
   88     p = std::sqrt( std::abs((et-amas)*(et+amas)) );
 
   97     targetParticle = *originalTarget;
 
  100     G4bool incidentHasChanged = 
false;
 
  101     G4bool targetHasChanged = 
false;
 
  102     G4bool quasiElastic = 
false;
 
  112       Cascade( vec, vecLen,
 
  113                originalIncident, currentParticle, targetParticle,
 
  114                incidentHasChanged, targetHasChanged, quasiElastic );
 
  119                       originalIncident, originalTarget, modifiedOriginal,
 
  120                       targetNucleus, currentParticle, targetParticle,
 
  121                       incidentHasChanged, targetHasChanged, quasiElastic );
 
  124                  currentParticle, targetParticle,
 
  125                  incidentHasChanged );
 
  127   delete originalTarget;
 
  132 void G4RPGAntiProtonInelastic::Cascade(
 
  138    G4bool &incidentHasChanged,
 
  155   G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
 
  156                                       targetMass*targetMass +
 
  157                                       2.0*targetMass*etOriginal );
 
  158   G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
 
  160     static G4bool first = 
true;
 
  161     const G4int numMul = 1200;
 
  162     const G4int numMulA = 400;
 
  163     const G4int numSec = 60;
 
  164     static G4double protmul[numMul], protnorm[numSec]; 
 
  165     static G4double neutmul[numMul], neutnorm[numSec]; 
 
  166     static G4double protmulA[numMulA], protnormA[numSec]; 
 
  167     static G4double neutmulA[numMulA], neutnormA[numSec]; 
 
  169     G4int counter, 
nt=0, np=0, nneg=0, nz=0;
 
  177       for( i=0; i<numMul; ++i )protmul[i] = 0.0;
 
  178       for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
 
  180       for( np=0; np<(numSec/3); ++np )
 
  182         for( nneg=std::max(0,np-1); nneg<=(np+1); ++nneg )
 
  184           for( nz=0; nz<numSec/3; ++nz )
 
  186             if( ++counter < numMul )
 
  189               if( nt>0 && nt<=numSec )
 
  191                 protmul[counter] = 
Pmltpc(np,nneg,nz,nt,b[0],c);
 
  192                 protnorm[nt-1] += protmul[counter];
 
  198       for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
 
  199       for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
 
  201       for( np=0; np<numSec/3; ++np )
 
  203         for( nneg=np; nneg<=(np+2); ++nneg )
 
  205           for( nz=0; nz<numSec/3; ++nz )
 
  207             if( ++counter < numMul )
 
  210               if( (nt>0) && (nt<=numSec) )
 
  212                 neutmul[counter] = 
Pmltpc(np,nneg,nz,nt,b[1],c);
 
  213                 neutnorm[nt-1] += neutmul[counter];
 
  219       for( i=0; i<numSec; ++i )
 
  221         if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
 
  222         if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
 
  227       for( i=0; i<numMulA; ++i )protmulA[i] = 0.0;
 
  228       for( i=0; i<numSec; ++i )protnormA[i] = 0.0;
 
  230       for( np=0; np<(numSec/3); ++np )
 
  233         for( nz=0; nz<numSec/3; ++nz )
 
  235           if( ++counter < numMulA )
 
  238             if( nt>1 && nt<=numSec )
 
  240               protmulA[counter] = 
Pmltpc(np,nneg,nz,nt,b[0],c);
 
  241               protnormA[nt-1] += protmulA[counter];
 
  246       for( i=0; i<numMulA; ++i )neutmulA[i] = 0.0;
 
  247       for( i=0; i<numSec; ++i )neutnormA[i] = 0.0;
 
  249       for( np=0; np<numSec/3; ++np )
 
  252         for( nz=0; nz<numSec/3; ++nz )
 
  254           if( ++counter < numMulA )
 
  257             if( (nt>1) && (nt<=numSec) )
 
  259               neutmulA[counter] = 
Pmltpc(np,nneg,nz,nt,b[1],c);
 
  260               neutnormA[nt-1] += neutmulA[counter];
 
  265       for( i=0; i<numSec; ++i )
 
  267         if( protnormA[i] > 0.0 )protnormA[i] = 1.0/protnormA[i];
 
  268         if( neutnormA[i] > 0.0 )neutnormA[i] = 1.0/neutnormA[i];
 
  282     const G4double anhl[] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.90,
 
  283                              0.6,0.52,0.47,0.44,0.41,0.39,0.37,0.35,0.34,0.24,
 
  284                              0.19,0.15,0.12,0.10,0.09,0.07,0.06,0.05,0.0};
 
  287     if( iplab >  9 )iplab = 
G4int( pOriginal/
GeV ) + 9;
 
  288     if( iplab > 18 )iplab = 
G4int( pOriginal/
GeV/10.0 ) + 18;
 
  289     if( iplab > 27 )iplab = 28;
 
  292       if( availableEnergy <= aPiPlus->GetPDGMass()/
MeV )
 
  298       const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
 
  309           test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
 
  312           test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[1])*(-1.0+b[1])/(2.0*c*c) ) ) );
 
  319           else if( ran < wp/wt )
 
  326           test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
 
  328           test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[0])*(-1.0+b[0])/(2.0*c*c) ) ) );
 
  331           if( ran < w0/(w0+wm) )
 
  346           for( np=0; np<numSec/3 && ran>=excs; ++np )
 
  348             for( nneg=std::max(0,np-1); nneg<=(np+1) && ran>=excs; ++nneg )
 
  350               for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
 
  352                 if( ++counter < numMul )
 
  355                   if( (nt>0) && (nt<=numSec) )
 
  357                     test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  358                     dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
 
  359                     if( std::fabs(dum) < 1.0 )
 
  361                       if( test >= 1.0
e-10 )excs += dum*
test;
 
  379           for( np=0; np<numSec/3 && ran>=excs; ++np )
 
  381             for( nneg=np; nneg<=(np+2) && ran>=excs; ++nneg )
 
  383               for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
 
  385                 if( ++counter < numMul )
 
  388                   if( (nt>0) && (nt<=numSec) )
 
  390                     test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  391                     dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
 
  392                     if( std::fabs(dum) < 1.0 )
 
  394                       if( test >= 1.0
e-10 )excs += dum*
test;
 
  420              incidentHasChanged = 
true;
 
  421              targetHasChanged = 
true;
 
  426            targetHasChanged = 
true;
 
  430            incidentHasChanged = 
true;
 
  442              targetHasChanged = 
true;
 
  447              incidentHasChanged = 
true;
 
  455            incidentHasChanged = 
true;
 
  456            targetHasChanged = 
true;
 
  463       if( centerofmassEnergy <= 2*aPiPlus->GetPDGMass()/
MeV )
 
  478         for( np=0; (np<numSec/3) && (ran>=excs); ++np )
 
  481           for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz )
 
  483             if( ++counter < numMulA )
 
  486               if( (nt>1) && (nt<=numSec) )
 
  488                 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  489                 dum = (
pi/anpn)*nt*protmulA[counter]*protnormA[nt-1]/(2.0*n*n);
 
  490                 if( std::abs(dum) < 1.0 )
 
  492                   if( test >= 1.0
e-10 )excs += dum*
test;
 
  504         for( np=0; (np<numSec/3) && (ran>=excs); ++np )
 
  507           for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz )
 
  509             if( ++counter < numMulA )
 
  512               if( (nt>1) && (nt<=numSec) )
 
  514                 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
 
  515                 dum = (
pi/anpn)*nt*neutmulA[counter]*neutnormA[nt-1]/(2.0*n*n);
 
  516                 if( std::fabs(dum) < 1.0 )
 
  518                   if( test >= 1.0
e-10 )excs += dum*
test;
 
  533       currentParticle.
SetMass( 0.0 );
 
  537   while(np + nneg + nz < 3) nz++;