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