41 outFile <<
"G4LEKaonZeroInelastic is one of the Low Energy Parameterized\n"
42 <<
"(LEP) models used to implement K0 scattering from nuclei. It\n"
43 <<
"is a re-engineered version of the GHEISHA code of\n"
44 <<
"H. Fesefeldt. It divides the initial collision products\n"
45 <<
"into backward- and forward-going clusters which are then\n"
46 <<
"decayed into final state hadrons. The model does not conserve\n"
47 <<
"energy on an event-by-event basis. It may be applied to\n"
48 <<
"K0s with initial energies between 0 and 25 GeV.\n";
63 G4cout <<
"G4LEKaonZeroInelastic::ApplyYourself called" <<
G4endl;
65 G4cout <<
"target material = " << targetMaterial->
GetName() <<
", ";
75 modifiedOriginal = *originalIncident;
81 G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
93 p = std::sqrt( std::abs((et-amas)*(et+amas)) );
101 targetParticle = *originalTarget;
104 G4bool incidentHasChanged =
false;
105 G4bool targetHasChanged =
false;
106 G4bool quasiElastic =
false;
113 Cascade(vec, vecLen, originalIncident, currentParticle, targetParticle,
114 incidentHasChanged, targetHasChanged, quasiElastic);
116 CalculateMomenta(vec, vecLen, originalIncident, originalTarget, modifiedOriginal,
117 targetNucleus, currentParticle, targetParticle,
118 incidentHasChanged, targetHasChanged, quasiElastic);
120 SetUpChange(vec, vecLen, currentParticle, targetParticle, incidentHasChanged);
124 delete originalTarget;
129 void G4LEKaonZeroInelastic::Cascade(
135 G4bool& incidentHasChanged,
152 G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
153 targetMass*targetMass +
154 2.0*targetMass*etOriginal );
155 G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
161 static G4bool first =
true;
162 const G4int numMul = 1200;
163 const G4int numSec = 60;
164 static G4double protmul[numMul], protnorm[numSec];
165 static G4double neutmul[numMul], neutnorm[numSec];
167 G4int counter,
nt=0, npos=0, nneg=0, nzero=0;
174 for( i=0; i<numMul; ++i )protmul[i] = 0.0;
175 for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
177 for( npos=0; npos<(numSec/3); ++npos )
179 for( nneg=std::max(0,npos-1); nneg<=(npos+1); ++nneg )
181 for( nzero=0; nzero<numSec/3; ++nzero )
183 if( ++counter < numMul )
185 nt = npos+nneg+nzero;
186 if( nt>0 && nt<=numSec )
188 protmul[counter] =
Pmltpc(npos,nneg,nzero,nt,b[0],c);
189 protnorm[nt-1] += protmul[counter];
195 for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
196 for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
198 for( npos=0; npos<numSec/3; ++npos )
200 for( nneg=std::max(0,npos-2); nneg<=npos; ++nneg )
202 for( nzero=0; nzero<numSec/3; ++nzero )
204 if( ++counter < numMul )
206 nt = npos+nneg+nzero;
207 if( nt>0 && nt<=numSec )
209 neutmul[counter] =
Pmltpc(npos,nneg,nzero,nt,b[1],c);
210 neutnorm[nt-1] += neutmul[counter];
216 for( i=0; i<numSec; ++i )
218 if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
219 if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
231 const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
239 nneg = npos = nzero = 0;
242 test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
244 test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
253 test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
256 test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[1])*(-1.0+b[1])/(2.0*c*c) ) ) );
263 else if( ran < wp/wt )
278 for( npos=0; npos<numSec/3 && ran>=excs; ++npos )
280 for( nneg=std::max(0,npos-1); nneg<=(npos+1) && ran>=excs; ++nneg )
282 for( nzero=0; nzero<numSec/3 && ran>=excs; ++nzero )
284 if( ++counter < numMul )
286 nt = npos+nneg+nzero;
287 if( nt>0 && nt<=numSec )
289 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
290 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
291 if( std::fabs(dum) < 1.0 )
293 if( test >= 1.0
e-10 )excs += dum*
test;
307 npos--; nneg--; nzero--;
312 for( npos=0; npos<numSec/3 && ran>=excs; ++npos )
314 for( nneg=std::max(0,npos-2); nneg<=npos && ran>=excs; ++nneg )
316 for( nzero=0; nzero<numSec/3 && ran>=excs; ++nzero )
318 if( ++counter < numMul )
320 nt = npos+nneg+nzero;
321 if( nt>0 && nt<=numSec )
323 test = std::exp( std::min( expxu, std::max( expxl, -(
pi/4.0)*(nt*nt)/(n*n) ) ) );
324 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
325 if( std::fabs(dum) < 1.0 )
327 if( test >= 1.0
e-10 )excs += dum*
test;
341 npos--; nneg--; nzero--;
353 incidentHasChanged =
true;
354 targetHasChanged =
true;
359 targetHasChanged =
true;
363 targetHasChanged =
true;
375 incidentHasChanged =
true;
380 targetHasChanged =
true;
385 incidentHasChanged =
true;
387 targetHasChanged =
true;
398 incidentHasChanged =
true;
406 targetHasChanged =
true;