[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
[1347] | 26 | // $Id: G4HEAntiProtonInelastic.cc,v 1.16 2010/11/29 05:44:44 dennis Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
[819] | 28 | // |
---|
| 29 | |
---|
| 30 | #include "globals.hh" |
---|
| 31 | #include "G4ios.hh" |
---|
| 32 | |
---|
| 33 | // G4 Process: Gheisha High Energy Collision model. |
---|
| 34 | // This includes the high energy cascading model, the two-body-resonance model |
---|
[1347] | 35 | // and the low energy two-body model. Not included are the low energy stuff |
---|
| 36 | // like nuclear reactions, nuclear fission without any cascading and all |
---|
| 37 | // processes for particles at rest. |
---|
[819] | 38 | // First work done by J.L.Chuma and F.W.Jones, TRIUMF, June 96. |
---|
| 39 | // H. Fesefeldt, RWTH-Aachen, 23-October-1996 |
---|
| 40 | // Last modified: 29-July-1998 |
---|
| 41 | |
---|
| 42 | #include "G4HEAntiProtonInelastic.hh" |
---|
| 43 | |
---|
[1347] | 44 | G4HadFinalState* |
---|
| 45 | G4HEAntiProtonInelastic::ApplyYourself(const G4HadProjectile& aTrack, |
---|
| 46 | G4Nucleus& targetNucleus) |
---|
| 47 | { |
---|
| 48 | G4HEVector* pv = new G4HEVector[MAXPART]; |
---|
| 49 | const G4HadProjectile* aParticle = &aTrack; |
---|
| 50 | const G4double atomicWeight = targetNucleus.GetN(); |
---|
| 51 | const G4double atomicNumber = targetNucleus.GetZ(); |
---|
| 52 | G4HEVector incidentParticle(aParticle); |
---|
[819] | 53 | |
---|
[1347] | 54 | G4int incidentCode = incidentParticle.getCode(); |
---|
| 55 | G4double incidentMass = incidentParticle.getMass(); |
---|
| 56 | G4double incidentTotalEnergy = incidentParticle.getEnergy(); |
---|
| 57 | G4double incidentTotalMomentum = incidentParticle.getTotalMomentum(); |
---|
| 58 | G4double incidentKineticEnergy = incidentTotalEnergy - incidentMass; |
---|
[819] | 59 | |
---|
[1347] | 60 | if (incidentKineticEnergy < 1.) |
---|
| 61 | G4cout << "GHEAntiProtonInelastic: incident energy < 1 GeV" << G4endl; |
---|
[819] | 62 | |
---|
[1347] | 63 | if (verboseLevel > 1) { |
---|
| 64 | G4cout << "G4HEAntiProtonInelastic::ApplyYourself" << G4endl; |
---|
| 65 | G4cout << "incident particle " << incidentParticle.getName() |
---|
| 66 | << "mass " << incidentMass |
---|
| 67 | << "kinetic energy " << incidentKineticEnergy |
---|
| 68 | << G4endl; |
---|
| 69 | G4cout << "target material with (A,Z) = (" |
---|
| 70 | << atomicWeight << "," << atomicNumber << ")" << G4endl; |
---|
| 71 | } |
---|
[819] | 72 | |
---|
[1347] | 73 | G4double inelasticity = NuclearInelasticity(incidentKineticEnergy, |
---|
| 74 | atomicWeight, atomicNumber); |
---|
| 75 | if (verboseLevel > 1) |
---|
| 76 | G4cout << "nuclear inelasticity = " << inelasticity << G4endl; |
---|
| 77 | |
---|
| 78 | incidentKineticEnergy -= inelasticity; |
---|
[819] | 79 | |
---|
[1347] | 80 | G4double excitationEnergyGNP = 0.; |
---|
| 81 | G4double excitationEnergyDTA = 0.; |
---|
[819] | 82 | |
---|
[1347] | 83 | G4double excitation = NuclearExcitation(incidentKineticEnergy, |
---|
| 84 | atomicWeight, atomicNumber, |
---|
| 85 | excitationEnergyGNP, |
---|
| 86 | excitationEnergyDTA); |
---|
| 87 | if (verboseLevel > 1) |
---|
| 88 | G4cout << "nuclear excitation = " << excitation << excitationEnergyGNP |
---|
[819] | 89 | << excitationEnergyDTA << G4endl; |
---|
| 90 | |
---|
| 91 | |
---|
[1347] | 92 | incidentKineticEnergy -= excitation; |
---|
| 93 | incidentTotalEnergy = incidentKineticEnergy + incidentMass; |
---|
| 94 | incidentTotalMomentum = std::sqrt( (incidentTotalEnergy-incidentMass) |
---|
| 95 | *(incidentTotalEnergy+incidentMass)); |
---|
[819] | 96 | |
---|
[1347] | 97 | G4HEVector targetParticle; |
---|
| 98 | if (G4UniformRand() < atomicNumber/atomicWeight) { |
---|
| 99 | targetParticle.setDefinition("Proton"); |
---|
| 100 | } else { |
---|
| 101 | targetParticle.setDefinition("Neutron"); |
---|
| 102 | } |
---|
[819] | 103 | |
---|
[1347] | 104 | G4double targetMass = targetParticle.getMass(); |
---|
| 105 | G4double centerOfMassEnergy = std::sqrt(incidentMass*incidentMass |
---|
| 106 | + targetMass*targetMass |
---|
| 107 | + 2.0*targetMass*incidentTotalEnergy); |
---|
| 108 | G4double availableEnergy = centerOfMassEnergy - targetMass - incidentMass; |
---|
[819] | 109 | |
---|
[1347] | 110 | G4bool inElastic = true; |
---|
| 111 | vecLength = 0; |
---|
[819] | 112 | |
---|
[1347] | 113 | if (verboseLevel > 1) |
---|
| 114 | G4cout << "ApplyYourself: CallFirstIntInCascade for particle " |
---|
[819] | 115 | << incidentCode << G4endl; |
---|
| 116 | |
---|
[1347] | 117 | G4bool successful = false; |
---|
[819] | 118 | |
---|
[1347] | 119 | FirstIntInCasAntiProton(inElastic, availableEnergy, pv, vecLength, |
---|
| 120 | incidentParticle, targetParticle, atomicWeight); |
---|
[819] | 121 | |
---|
[1347] | 122 | if (verboseLevel > 1) |
---|
| 123 | G4cout << "ApplyYourself::StrangeParticlePairProduction" << G4endl; |
---|
[819] | 124 | |
---|
[1347] | 125 | if ((vecLength > 0) && (availableEnergy > 1.)) |
---|
| 126 | StrangeParticlePairProduction(availableEnergy, centerOfMassEnergy, |
---|
| 127 | pv, vecLength, |
---|
| 128 | incidentParticle, targetParticle); |
---|
| 129 | HighEnergyCascading(successful, pv, vecLength, |
---|
| 130 | excitationEnergyGNP, excitationEnergyDTA, |
---|
| 131 | incidentParticle, targetParticle, |
---|
| 132 | atomicWeight, atomicNumber); |
---|
| 133 | if (!successful) |
---|
| 134 | HighEnergyClusterProduction(successful, pv, vecLength, |
---|
| 135 | excitationEnergyGNP, excitationEnergyDTA, |
---|
| 136 | incidentParticle, targetParticle, |
---|
| 137 | atomicWeight, atomicNumber); |
---|
| 138 | if (!successful) |
---|
| 139 | MediumEnergyCascading(successful, pv, vecLength, |
---|
| 140 | excitationEnergyGNP, excitationEnergyDTA, |
---|
| 141 | incidentParticle, targetParticle, |
---|
| 142 | atomicWeight, atomicNumber); |
---|
[819] | 143 | |
---|
[1347] | 144 | if (!successful) |
---|
| 145 | MediumEnergyClusterProduction(successful, pv, vecLength, |
---|
| 146 | excitationEnergyGNP, excitationEnergyDTA, |
---|
| 147 | incidentParticle, targetParticle, |
---|
| 148 | atomicWeight, atomicNumber); |
---|
| 149 | if (!successful) |
---|
| 150 | QuasiElasticScattering(successful, pv, vecLength, |
---|
| 151 | excitationEnergyGNP, excitationEnergyDTA, |
---|
| 152 | incidentParticle, targetParticle, |
---|
| 153 | atomicWeight, atomicNumber); |
---|
| 154 | if (!successful) |
---|
| 155 | ElasticScattering(successful, pv, vecLength, |
---|
| 156 | incidentParticle, |
---|
| 157 | atomicWeight, atomicNumber); |
---|
[819] | 158 | |
---|
[1347] | 159 | if (!successful) |
---|
| 160 | G4cout << "GHEInelasticInteraction::ApplyYourself fails to produce final state particles" |
---|
| 161 | << G4endl; |
---|
[819] | 162 | |
---|
[1347] | 163 | FillParticleChange(pv, vecLength); |
---|
| 164 | delete [] pv; |
---|
| 165 | theParticleChange.SetStatusChange(stopAndKill); |
---|
| 166 | return & theParticleChange; |
---|
| 167 | } |
---|
[819] | 168 | |
---|
[1347] | 169 | |
---|
[819] | 170 | void |
---|
[1347] | 171 | G4HEAntiProtonInelastic::FirstIntInCasAntiProton(G4bool& inElastic, |
---|
| 172 | const G4double availableEnergy, |
---|
| 173 | G4HEVector pv[], |
---|
| 174 | G4int& vecLen, |
---|
| 175 | const G4HEVector& incidentParticle, |
---|
| 176 | const G4HEVector& targetParticle, |
---|
| 177 | const G4double atomicWeight) |
---|
[819] | 178 | |
---|
| 179 | // AntiProton undergoes interaction with nucleon within a nucleus. Check if it is |
---|
| 180 | // energetically possible to produce pions/kaons. In not, assume nuclear excitation |
---|
| 181 | // occurs and input particle is degraded in energy. No other particles are produced. |
---|
| 182 | // If reaction is possible, find the correct number of pions/protons/neutrons |
---|
| 183 | // produced using an interpolation to multiplicity data. Replace some pions or |
---|
| 184 | // protons/neutrons by kaons or strange baryons according to the average |
---|
| 185 | // multiplicity per inelastic reaction. |
---|
[1347] | 186 | { |
---|
| 187 | static const G4double expxu = std::log(MAXFLOAT); // upper bound for arg. of exp |
---|
| 188 | static const G4double expxl = -expxu; // lower bound for arg. of exp |
---|
[819] | 189 | |
---|
[1347] | 190 | static const G4double protb = 0.7; |
---|
| 191 | static const G4double neutb = 0.7; |
---|
| 192 | static const G4double c = 1.25; |
---|
[819] | 193 | |
---|
[1347] | 194 | static const G4int numMul = 1200; |
---|
| 195 | static const G4int numMulAn = 400; |
---|
| 196 | static const G4int numSec = 60; |
---|
[819] | 197 | |
---|
[1347] | 198 | G4int neutronCode = Neutron.getCode(); |
---|
| 199 | G4int protonCode = Proton.getCode(); |
---|
[819] | 200 | |
---|
[1347] | 201 | G4int targetCode = targetParticle.getCode(); |
---|
| 202 | G4double incidentTotalMomentum = incidentParticle.getTotalMomentum(); |
---|
[819] | 203 | |
---|
[1347] | 204 | static G4bool first = true; |
---|
| 205 | static G4double protmul[numMul], protnorm[numSec]; // proton constants |
---|
| 206 | static G4double protmulAn[numMulAn],protnormAn[numSec]; |
---|
| 207 | static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants |
---|
| 208 | static G4double neutmulAn[numMulAn],neutnormAn[numSec]; |
---|
[819] | 209 | |
---|
[1347] | 210 | // misc. local variables |
---|
| 211 | // np = number of pi+, nm = number of pi-, nz = number of pi0 |
---|
[819] | 212 | |
---|
[1347] | 213 | G4int i, counter, nt, np, nm, nz; |
---|
[819] | 214 | |
---|
| 215 | if( first ) |
---|
[1347] | 216 | { // compute normalization constants, this will only be done once |
---|
[819] | 217 | first = false; |
---|
| 218 | for( i=0; i<numMul ; i++ ) protmul[i] = 0.0; |
---|
| 219 | for( i=0; i<numSec ; i++ ) protnorm[i] = 0.0; |
---|
| 220 | counter = -1; |
---|
| 221 | for( np=0; np<(numSec/3); np++ ) |
---|
| 222 | { |
---|
| 223 | for( nm=Imax(0,np-1); nm<=(np+1); nm++ ) |
---|
| 224 | { |
---|
| 225 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 226 | { |
---|
| 227 | if( ++counter < numMul ) |
---|
| 228 | { |
---|
| 229 | nt = np+nm+nz; |
---|
| 230 | if( (nt>0) && (nt<=numSec) ) |
---|
| 231 | { |
---|
| 232 | protmul[counter] = pmltpc(np,nm,nz,nt,protb,c); |
---|
| 233 | protnorm[nt-1] += protmul[counter]; |
---|
| 234 | } |
---|
| 235 | } |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | for( i=0; i<numMul; i++ )neutmul[i] = 0.0; |
---|
| 240 | |
---|
| 241 | for( i=0; i<numSec; i++ )neutnorm[i] = 0.0; |
---|
| 242 | counter = -1; |
---|
| 243 | for( np=0; np<numSec/3; np++ ) |
---|
| 244 | { |
---|
| 245 | for( nm=np; nm<=(np+2); nm++ ) |
---|
| 246 | { |
---|
| 247 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 248 | { |
---|
| 249 | if( ++counter < numMul ) |
---|
| 250 | { |
---|
| 251 | nt = np+nm+nz; |
---|
| 252 | if( (nt>0) && (nt<=numSec) ) |
---|
| 253 | { |
---|
| 254 | neutmul[counter] = pmltpc(np,nm,nz,nt,neutb,c); |
---|
| 255 | neutnorm[nt-1] += neutmul[counter]; |
---|
| 256 | } |
---|
| 257 | } |
---|
| 258 | } |
---|
| 259 | } |
---|
| 260 | } |
---|
| 261 | for( i=0; i<numSec; i++ ) |
---|
| 262 | { |
---|
| 263 | if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i]; |
---|
| 264 | if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i]; |
---|
| 265 | } |
---|
| 266 | // annihilation |
---|
| 267 | for( i=0; i<numMulAn ; i++ ) protmulAn[i] = 0.0; |
---|
| 268 | for( i=0; i<numSec ; i++ ) protnormAn[i] = 0.0; |
---|
| 269 | counter = -1; |
---|
| 270 | for( np=1; np<(numSec/3); np++ ) |
---|
| 271 | { |
---|
| 272 | nm = np; |
---|
| 273 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 274 | { |
---|
| 275 | if( ++counter < numMulAn ) |
---|
| 276 | { |
---|
| 277 | nt = np+nm+nz; |
---|
| 278 | if( (nt>0) && (nt<=numSec) ) |
---|
| 279 | { |
---|
| 280 | protmulAn[counter] = pmltpc(np,nm,nz,nt,protb,c); |
---|
| 281 | protnormAn[nt-1] += protmulAn[counter]; |
---|
| 282 | } |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | } |
---|
| 286 | for( i=0; i<numMulAn; i++ ) neutmulAn[i] = 0.0; |
---|
| 287 | for( i=0; i<numSec; i++ ) neutnormAn[i] = 0.0; |
---|
| 288 | counter = -1; |
---|
| 289 | for( np=1; np<numSec/3; np++ ) |
---|
| 290 | { |
---|
| 291 | nm = np+1; |
---|
| 292 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 293 | { |
---|
| 294 | if( ++counter < numMulAn ) |
---|
| 295 | { |
---|
| 296 | nt = np+nm+nz; |
---|
| 297 | if( (nt>0) && (nt<=numSec) ) |
---|
| 298 | { |
---|
| 299 | neutmulAn[counter] = pmltpc(np,nm,nz,nt,neutb,c); |
---|
| 300 | neutnormAn[nt-1] += neutmulAn[counter]; |
---|
| 301 | } |
---|
| 302 | } |
---|
| 303 | } |
---|
| 304 | } |
---|
| 305 | for( i=0; i<numSec; i++ ) |
---|
| 306 | { |
---|
| 307 | if( protnormAn[i] > 0.0 )protnormAn[i] = 1.0/protnormAn[i]; |
---|
| 308 | if( neutnormAn[i] > 0.0 )neutnormAn[i] = 1.0/neutnormAn[i]; |
---|
| 309 | } |
---|
| 310 | } // end of initialization |
---|
| 311 | |
---|
| 312 | |
---|
| 313 | // initialize the first two places |
---|
| 314 | // the same as beam and target |
---|
| 315 | pv[0] = incidentParticle; |
---|
| 316 | pv[1] = targetParticle; |
---|
| 317 | vecLen = 2; |
---|
| 318 | |
---|
| 319 | if( !inElastic ) |
---|
| 320 | { // pb p --> nb n |
---|
| 321 | if( targetCode == protonCode ) |
---|
| 322 | { |
---|
| 323 | G4double cech[] = {0.14, 0.170, 0.180, 0.180, 0.180, 0.170, 0.170, 0.160, 0.155, 0.145, |
---|
| 324 | 0.11, 0.082, 0.065, 0.050, 0.041, 0.035, 0.028, 0.024, 0.010, 0.000}; |
---|
| 325 | |
---|
| 326 | G4int iplab = G4int( incidentTotalMomentum*10.); |
---|
| 327 | if (iplab > 9) iplab = Imin(19, G4int( incidentTotalMomentum) + 9); |
---|
| 328 | if( G4UniformRand() < cech[iplab]/std::pow(atomicWeight,0.42) ) |
---|
| 329 | { // charge exchange pi+ n -> pi0 p |
---|
| 330 | pv[0] = AntiNeutron; |
---|
| 331 | pv[1] = Neutron; |
---|
| 332 | } |
---|
| 333 | } |
---|
| 334 | return; |
---|
| 335 | } |
---|
| 336 | else if (availableEnergy <= PionPlus.getMass()) |
---|
| 337 | return; |
---|
| 338 | |
---|
| 339 | // inelastic scattering |
---|
| 340 | |
---|
| 341 | np = 0; nm = 0; nz = 0; |
---|
| 342 | G4double anhl[] = {1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.90, |
---|
| 343 | 0.60, 0.52, 0.47, 0.44, 0.41, 0.39, 0.37, 0.35, 0.34, 0.24, |
---|
| 344 | 0.19, 0.15, 0.12, 0.10, 0.09, 0.07, 0.06, 0.05, 0.00}; |
---|
| 345 | G4int iplab = G4int( incidentTotalMomentum*10.); |
---|
| 346 | if ( iplab > 9) iplab = 9 + G4int( incidentTotalMomentum); |
---|
| 347 | if ( iplab > 18) iplab = 18 + G4int( incidentTotalMomentum*10.); |
---|
| 348 | iplab = Imin(28, iplab); |
---|
| 349 | |
---|
| 350 | if ( G4UniformRand() > anhl[iplab] ) |
---|
| 351 | { |
---|
| 352 | |
---|
| 353 | G4double eab = availableEnergy; |
---|
| 354 | G4int ieab = G4int( eab*5.0 ); |
---|
| 355 | |
---|
| 356 | G4double supp[] = {0., 0.4, 0.55, 0.65, 0.75, 0.82, 0.86, 0.90, 0.94, 0.98}; |
---|
| 357 | if( (ieab <= 9) && (G4UniformRand() >= supp[ieab]) ) |
---|
| 358 | { |
---|
| 359 | // suppress high multiplicity events at low momentum |
---|
| 360 | // only one additional pion will be produced |
---|
| 361 | G4double w0, wp, wm, wt, ran; |
---|
| 362 | if( targetCode == neutronCode ) // target is a neutron |
---|
| 363 | { |
---|
| 364 | w0 = - sqr(1.+neutb)/(2.*c*c); |
---|
| 365 | w0 = std::exp(w0); |
---|
| 366 | wm = - sqr(-1.+neutb)/(2.*c*c); |
---|
| 367 | wm = std::exp(wm); |
---|
| 368 | if( G4UniformRand() < w0/(w0+wm) ) |
---|
| 369 | { np = 0; nm = 0; nz = 1; } |
---|
| 370 | else |
---|
| 371 | { np = 0; nm = 1; nz = 0; } |
---|
| 372 | } |
---|
| 373 | else |
---|
| 374 | { // target is a proton |
---|
| 375 | w0 = -sqr(1.+protb)/(2.*c*c); |
---|
| 376 | w0 = std::exp(w0); |
---|
| 377 | wp = w0; |
---|
| 378 | wm = -sqr(-1.+protb)/(2.*c*c); |
---|
| 379 | wm = std::exp(wm); |
---|
| 380 | wt = w0+wp+wm; |
---|
| 381 | wp = w0+wp; |
---|
| 382 | ran = G4UniformRand(); |
---|
| 383 | if( ran < w0/wt) |
---|
| 384 | { np = 0; nm = 0; nz = 1; } |
---|
| 385 | else if( ran < wp/wt) |
---|
| 386 | { np = 1; nm = 0; nz = 0; } |
---|
| 387 | else |
---|
| 388 | { np = 0; nm = 1; nz = 0; } |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | else |
---|
| 392 | { |
---|
| 393 | // number of total particles vs. centre of mass Energy - 2*proton mass |
---|
| 394 | |
---|
| 395 | G4double aleab = std::log(availableEnergy); |
---|
| 396 | G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514 |
---|
| 397 | + aleab*(0.117712+0.0136912*aleab))) - 2.0; |
---|
| 398 | |
---|
| 399 | // normalization constant for kno-distribution. |
---|
| 400 | // calculate first the sum of all constants, check for numerical problems. |
---|
| 401 | G4double test, dum, anpn = 0.0; |
---|
| 402 | |
---|
| 403 | for (nt=1; nt<=numSec; nt++) { |
---|
| 404 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 405 | dum = pi*nt/(2.0*n*n); |
---|
| 406 | if (std::fabs(dum) < 1.0) { |
---|
| 407 | if( test >= 1.0e-10 )anpn += dum*test; |
---|
| 408 | } else { |
---|
| 409 | anpn += dum*test; |
---|
| 410 | } |
---|
| 411 | } |
---|
| 412 | |
---|
| 413 | G4double ran = G4UniformRand(); |
---|
| 414 | G4double excs = 0.0; |
---|
| 415 | if( targetCode == protonCode ) |
---|
| 416 | { |
---|
| 417 | counter = -1; |
---|
| 418 | for( np=0; np<numSec/3; np++ ) |
---|
| 419 | { |
---|
| 420 | for( nm=Imax(0,np-1); nm<=(np+1); nm++ ) |
---|
| 421 | { |
---|
| 422 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 423 | { |
---|
| 424 | if( ++counter < numMul ) |
---|
| 425 | { |
---|
| 426 | nt = np+nm+nz; |
---|
| 427 | if ( (nt>0) && (nt<=numSec) ) { |
---|
| 428 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 429 | dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n); |
---|
| 430 | if (std::fabs(dum) < 1.0) { |
---|
| 431 | if( test >= 1.0e-10 )excs += dum*test; |
---|
| 432 | } else { |
---|
| 433 | excs += dum*test; |
---|
| 434 | } |
---|
| 435 | |
---|
| 436 | if (ran < excs) goto outOfLoop; //-----------------------> |
---|
| 437 | } |
---|
| 438 | } |
---|
| 439 | } |
---|
| 440 | } |
---|
| 441 | } |
---|
| 442 | |
---|
| 443 | // 3 previous loops continued to the end |
---|
| 444 | inElastic = false; // quasi-elastic scattering |
---|
| 445 | return; |
---|
| 446 | } |
---|
| 447 | else |
---|
| 448 | { // target must be a neutron |
---|
| 449 | counter = -1; |
---|
| 450 | for( np=0; np<numSec/3; np++ ) |
---|
| 451 | { |
---|
| 452 | for( nm=np; nm<=(np+2); nm++ ) |
---|
| 453 | { |
---|
| 454 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 455 | { |
---|
| 456 | if( ++counter < numMul ) |
---|
| 457 | { |
---|
| 458 | nt = np+nm+nz; |
---|
| 459 | if ( (nt>=1) && (nt<=numSec) ) { |
---|
| 460 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 461 | dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n); |
---|
| 462 | if (std::fabs(dum) < 1.0) { |
---|
| 463 | if( test >= 1.0e-10 )excs += dum*test; |
---|
| 464 | } else { |
---|
| 465 | excs += dum*test; |
---|
| 466 | } |
---|
| 467 | |
---|
| 468 | if (ran < excs) goto outOfLoop; // --------------------------> |
---|
| 469 | } |
---|
| 470 | } |
---|
| 471 | } |
---|
| 472 | } |
---|
| 473 | } |
---|
| 474 | // 3 previous loops continued to the end |
---|
| 475 | inElastic = false; // quasi-elastic scattering. |
---|
| 476 | return; |
---|
| 477 | } |
---|
| 478 | } |
---|
| 479 | outOfLoop: // <------------------------------------------------------------------------ |
---|
| 480 | |
---|
| 481 | if( targetCode == neutronCode) |
---|
| 482 | { |
---|
| 483 | if( np == nm) |
---|
| 484 | { |
---|
| 485 | } |
---|
| 486 | else if (np == (nm-1)) |
---|
| 487 | { |
---|
| 488 | if( G4UniformRand() < 0.5) |
---|
| 489 | { |
---|
| 490 | pv[1] = Proton; |
---|
| 491 | } |
---|
| 492 | else |
---|
| 493 | { |
---|
| 494 | pv[0] = AntiNeutron; |
---|
| 495 | } |
---|
| 496 | } |
---|
| 497 | else |
---|
| 498 | { |
---|
| 499 | pv[0] = AntiNeutron; |
---|
| 500 | pv[1] = Proton; |
---|
| 501 | } |
---|
| 502 | } |
---|
| 503 | else |
---|
| 504 | { |
---|
| 505 | if( np == nm) |
---|
| 506 | { |
---|
| 507 | if( G4UniformRand() < 0.25) |
---|
| 508 | { |
---|
| 509 | pv[0] = AntiNeutron; |
---|
| 510 | pv[1] = Neutron; |
---|
| 511 | } |
---|
| 512 | else |
---|
| 513 | { |
---|
| 514 | } |
---|
| 515 | } |
---|
| 516 | else if ( np == (1+nm)) |
---|
| 517 | { |
---|
| 518 | pv[1] = Neutron; |
---|
| 519 | } |
---|
| 520 | else |
---|
| 521 | { |
---|
| 522 | pv[0] = AntiNeutron; |
---|
| 523 | } |
---|
| 524 | } |
---|
| 525 | |
---|
| 526 | } |
---|
| 527 | else // annihilation |
---|
| 528 | { |
---|
| 529 | if ( availableEnergy > 2. * PionPlus.getMass() ) |
---|
| 530 | { |
---|
| 531 | |
---|
| 532 | G4double aleab = std::log(availableEnergy); |
---|
| 533 | G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514 |
---|
| 534 | + aleab*(0.117712+0.0136912*aleab))) - 2.0; |
---|
| 535 | |
---|
| 536 | // normalization constant for kno-distribution. |
---|
| 537 | // calculate first the sum of all constants, check for numerical problems. |
---|
| 538 | G4double test, dum, anpn = 0.0; |
---|
| 539 | |
---|
| 540 | for (nt=2; nt<=numSec; nt++) { |
---|
| 541 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 542 | dum = pi*nt/(2.0*n*n); |
---|
| 543 | if (std::fabs(dum) < 1.0) { |
---|
| 544 | if( test >= 1.0e-10 )anpn += dum*test; |
---|
| 545 | } else { |
---|
| 546 | anpn += dum*test; |
---|
| 547 | } |
---|
| 548 | } |
---|
| 549 | |
---|
| 550 | G4double ran = G4UniformRand(); |
---|
| 551 | G4double excs = 0.0; |
---|
| 552 | if( targetCode == protonCode ) |
---|
| 553 | { |
---|
| 554 | counter = -1; |
---|
| 555 | for( np=1; np<numSec/3; np++ ) |
---|
| 556 | { |
---|
| 557 | nm = np; |
---|
| 558 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 559 | { |
---|
| 560 | if( ++counter < numMulAn ) |
---|
| 561 | { |
---|
| 562 | nt = np+nm+nz; |
---|
| 563 | if ( (nt>0) && (nt<=numSec) ) { |
---|
| 564 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 565 | dum = (pi/anpn)*nt*protmulAn[counter]*protnormAn[nt-1]/(2.0*n*n); |
---|
| 566 | if (std::fabs(dum) < 1.0) { |
---|
| 567 | if( test >= 1.0e-10 )excs += dum*test; |
---|
| 568 | } else { |
---|
| 569 | excs += dum*test; |
---|
| 570 | } |
---|
| 571 | |
---|
| 572 | if (ran < excs) goto outOfLoopAn; //-----------------------> |
---|
| 573 | } |
---|
| 574 | } |
---|
| 575 | } |
---|
| 576 | } |
---|
| 577 | // 3 previous loops continued to the end |
---|
| 578 | inElastic = false; // quasi-elastic scattering |
---|
| 579 | return; |
---|
| 580 | } |
---|
| 581 | else |
---|
| 582 | { // target must be a neutron |
---|
| 583 | counter = -1; |
---|
| 584 | for( np=1; np<numSec/3; np++ ) |
---|
| 585 | { |
---|
| 586 | nm = np+1; |
---|
| 587 | for( nz=0; nz<numSec/3; nz++ ) |
---|
| 588 | { |
---|
| 589 | if( ++counter < numMulAn ) |
---|
| 590 | { |
---|
| 591 | nt = np+nm+nz; |
---|
| 592 | if ( (nt>=1) && (nt<=numSec) ) { |
---|
| 593 | test = std::exp( Amin( expxu, Amax( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
| 594 | dum = (pi/anpn)*nt*neutmulAn[counter]*neutnormAn[nt-1]/(2.0*n*n); |
---|
| 595 | if (std::fabs(dum) < 1.0) { |
---|
| 596 | if( test >= 1.0e-10 )excs += dum*test; |
---|
| 597 | } else { |
---|
| 598 | excs += dum*test; |
---|
| 599 | } |
---|
| 600 | |
---|
| 601 | if (ran < excs) goto outOfLoopAn; // --------------------------> |
---|
| 602 | } |
---|
| 603 | } |
---|
| 604 | } |
---|
| 605 | } |
---|
| 606 | inElastic = false; // quasi-elastic scattering. |
---|
| 607 | return; |
---|
| 608 | } |
---|
| 609 | outOfLoopAn: // <------------------------------------------------------------------ |
---|
| 610 | vecLen = 0; |
---|
| 611 | } |
---|
| 612 | } |
---|
| 613 | |
---|
| 614 | nt = np + nm + nz; |
---|
| 615 | while ( nt > 0) |
---|
| 616 | { |
---|
| 617 | G4double ran = G4UniformRand(); |
---|
| 618 | if ( ran < (G4double)np/nt) |
---|
| 619 | { |
---|
| 620 | if( np > 0 ) |
---|
| 621 | { pv[vecLen++] = PionPlus; |
---|
| 622 | np--; |
---|
| 623 | } |
---|
| 624 | } |
---|
| 625 | else if ( ran < (G4double)(np+nm)/nt) |
---|
| 626 | { |
---|
| 627 | if( nm > 0 ) |
---|
| 628 | { |
---|
| 629 | pv[vecLen++] = PionMinus; |
---|
| 630 | nm--; |
---|
| 631 | } |
---|
| 632 | } |
---|
| 633 | else |
---|
| 634 | { |
---|
| 635 | if( nz > 0 ) |
---|
| 636 | { |
---|
| 637 | pv[vecLen++] = PionZero; |
---|
| 638 | nz--; |
---|
| 639 | } |
---|
| 640 | } |
---|
| 641 | nt = np + nm + nz; |
---|
| 642 | } |
---|
| 643 | if (verboseLevel > 1) |
---|
| 644 | { |
---|
| 645 | G4cout << "Particles produced: " ; |
---|
| 646 | G4cout << pv[0].getName() << " " ; |
---|
| 647 | G4cout << pv[1].getName() << " " ; |
---|
| 648 | for (i=2; i < vecLen; i++) |
---|
| 649 | { |
---|
| 650 | G4cout << pv[i].getName() << " " ; |
---|
| 651 | } |
---|
| 652 | G4cout << G4endl; |
---|
| 653 | } |
---|
| 654 | return; |
---|
| 655 | } |
---|
| 656 | |
---|
| 657 | |
---|
| 658 | |
---|
| 659 | |
---|
| 660 | |
---|
| 661 | |
---|
| 662 | |
---|
| 663 | |
---|
| 664 | |
---|