47 G4cout <<
"G4RPGKZeroInelastic::ApplyYourself called" <<
G4endl;
49 G4cout <<
"target material = " << targetMaterial->
GetName() <<
", ";
60 modifiedOriginal = *originalIncident;
66 G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
80 p = std::sqrt( std::abs((et-amas)*(et+amas)) );
89 targetParticle = *originalTarget;
92 G4bool incidentHasChanged =
false;
93 G4bool targetHasChanged =
false;
94 G4bool quasiElastic =
false;
101 Cascade( vec, vecLen,
102 originalIncident, currentParticle, targetParticle,
103 incidentHasChanged, targetHasChanged, quasiElastic );
106 originalIncident, originalTarget, modifiedOriginal,
107 targetNucleus, currentParticle, targetParticle,
108 incidentHasChanged, targetHasChanged, quasiElastic );
111 currentParticle, targetParticle,
112 incidentHasChanged );
114 delete originalTarget;
118void G4RPGKZeroInelastic::Cascade(
124 G4bool &incidentHasChanged,
141 G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
142 targetMass*targetMass +
143 2.0*targetMass*etOriginal );
144 G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
150 static G4bool first =
true;
151 const G4int numMul = 1200;
152 const G4int numSec = 60;
153 static G4double protmul[numMul], protnorm[numSec];
154 static G4double neutmul[numMul], neutnorm[numSec];
156 G4int counter, nt=0, np=0, nneg=0, nz=0;
163 for( i=0; i<numMul; ++i )protmul[i] = 0.0;
164 for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
166 for( np=0; np<(numSec/3); ++np )
168 for( nneg=std::max(0,np-1); nneg<=(np+1); ++nneg )
170 for( nz=0; nz<numSec/3; ++nz )
172 if( ++counter < numMul )
175 if( nt>0 && nt<=numSec )
177 protmul[counter] =
Pmltpc(np,nneg,nz,nt,b[0],c);
178 protnorm[nt-1] += protmul[counter];
184 for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
185 for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
187 for( np=0; np<numSec/3; ++np )
189 for( nneg=std::max(0,np-2); nneg<=np; ++nneg )
191 for( nz=0; nz<numSec/3; ++nz )
193 if( ++counter < numMul )
196 if( nt>0 && nt<=numSec )
198 neutmul[counter] =
Pmltpc(np,nneg,nz,nt,b[1],c);
199 neutnorm[nt-1] += neutmul[counter];
205 for( i=0; i<numSec; ++i )
207 if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
208 if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
219 G4int ieab =
static_cast<G4int>(5.0*availableEnergy*MeV/GeV);
220 const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
222 if( (availableEnergy*MeV/GeV < 2.0) && (
G4UniformRand() >= supp[ieab]) )
231 test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
233 test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
242 test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
245 test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[1])*(-1.0+b[1])/(2.0*c*c) ) ) );
252 else if( ran < wp/wt )
267 for( np=0; np<numSec/3 && ran>=excs; ++np )
269 for( nneg=std::max(0,np-1); nneg<=(np+1) && ran>=excs; ++nneg )
271 for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
273 if( ++counter < numMul )
276 if( nt>0 && nt<=numSec )
278 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
279 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
280 if( std::fabs(dum) < 1.0 )
282 if( test >= 1.0e-10 )excs += dum*test;
301 for( np=0; np<numSec/3 && ran>=excs; ++np )
303 for( nneg=std::max(0,np-2); nneg<=np && ran>=excs; ++nneg )
305 for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
307 if( ++counter < numMul )
310 if( nt>0 && nt<=numSec )
312 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
313 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
314 if( std::fabs(dum) < 1.0 )
316 if( test >= 1.0e-10 )excs += dum*test;
342 incidentHasChanged =
true;
343 targetHasChanged =
true;
348 targetHasChanged =
true;
352 targetHasChanged =
true;
364 incidentHasChanged =
true;
369 targetHasChanged =
true;
374 incidentHasChanged =
true;
376 targetHasChanged =
true;
386 incidentHasChanged =
true;
393 targetHasChanged =
true;
G4DLLIMPORT std::ostream G4cout
G4ParticleDefinition * GetDefinition() const
void Initialize(G4int items)
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4HadFinalState theParticleChange
static G4KaonPlus * KaonPlus()
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
const G4String & GetName() const
static G4Neutron * Neutron()
G4double EvaporationEffects(G4double kineticEnergy)
G4double Cinema(G4double kineticEnergy)
G4DynamicParticle * ReturnTargetParticle() const
G4double GetPDGMass() const
const G4String & GetParticleName() const
static G4PionPlus * PionPlus()
static G4Proton * Proton()
void SetUpPions(const G4int np, const G4int nm, const G4int nz, G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen)
void GetNormalizationConstant(const G4double availableEnergy, G4double &n, G4double &anpn)
void CalculateMomenta(G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen, const G4HadProjectile *originalIncident, const G4DynamicParticle *originalTarget, G4ReactionProduct &modifiedOriginal, G4Nucleus &targetNucleus, G4ReactionProduct ¤tParticle, G4ReactionProduct &targetParticle, G4bool &incidentHasChanged, G4bool &targetHasChanged, G4bool quasiElastic)
void SetUpChange(G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen, G4ReactionProduct ¤tParticle, G4ReactionProduct &targetParticle, G4bool &incidentHasChanged)
G4double Pmltpc(G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetKineticEnergy() const
G4ThreeVector GetMomentum() const
void SetSide(const G4int sid)
void SetDefinitionAndUpdateE(G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
G4ParticleDefinition * GetDefinition() const