Changeset 961 for trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedCompton.cc
- Timestamp:
- Apr 6, 2009, 12:21:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedCompton.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4LowEnergyPolarizedCompton.cc,v 1.2 2 2006/06/29 19:40:25 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4LowEnergyPolarizedCompton.cc,v 1.25 2008/05/02 19:23:38 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // ------------------------------------------------------------ … … 110 110 rangeTest = new G4RangeTest; 111 111 112 // For Doppler broadening 113 shellData.SetOccupancyData(); 114 115 112 116 if (verboseLevel > 0) 113 117 { … … 139 143 delete meanFreePathTable; 140 144 meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials(); 145 146 // For Doppler broadening 147 G4String file = "/doppler/shell-doppler"; 148 shellData.LoadData(file); 149 141 150 } 142 151 … … 327 336 G4double dirz = cosTheta ; 328 337 338 339 // oneCosT , eom 340 341 342 343 // Doppler broadening - Method based on: 344 // Y. Namito, S. Ban and H. Hirayama, 345 // "Implementation of the Doppler Broadening of a Compton-Scattered Photon Into the EGS4 Code" 346 // NIM A 349, pp. 489-494, 1994 347 348 // Maximum number of sampling iterations 349 350 G4int maxDopplerIterations = 1000; 351 G4double bindingE = 0.; 352 G4double photonEoriginal = epsilon * gammaEnergy0; 353 G4double photonE = -1.; 354 G4int iteration = 0; 355 G4double eMax = gammaEnergy0; 356 357 do 358 { 359 iteration++; 360 // Select shell based on shell occupancy 361 G4int shell = shellData.SelectRandomShell(Z); 362 bindingE = shellData.BindingEnergy(Z,shell); 363 364 eMax = gammaEnergy0 - bindingE; 365 366 // Randomly sample bound electron momentum (memento: the data set is in Atomic Units) 367 G4double pSample = profileData.RandomSelectMomentum(Z,shell); 368 // Rescale from atomic units 369 G4double pDoppler = pSample * fine_structure_const; 370 G4double pDoppler2 = pDoppler * pDoppler; 371 G4double var2 = 1. + onecost * E0_m; 372 G4double var3 = var2*var2 - pDoppler2; 373 G4double var4 = var2 - pDoppler2 * cosTheta; 374 G4double var = var4*var4 - var3 + pDoppler2 * var3; 375 if (var > 0.) 376 { 377 G4double varSqrt = std::sqrt(var); 378 G4double scale = gammaEnergy0 / var3; 379 // Random select either root 380 if (G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale; 381 else photonE = (var4 + varSqrt) * scale; 382 } 383 else 384 { 385 photonE = -1.; 386 } 387 } while ( iteration <= maxDopplerIterations && 388 (photonE < 0. || photonE > eMax || photonE < eMax*G4UniformRand()) ); 389 390 // End of recalculation of photon energy with Doppler broadening 391 // Revert to original if maximum number of iterations threshold has been reached 392 if (iteration >= maxDopplerIterations) 393 { 394 photonE = photonEoriginal; 395 bindingE = 0.; 396 } 397 398 gammaEnergy1 = photonE; 399 400 // G4cout << "--> PHOTONENERGY1 = " << photonE/keV << G4endl; 401 402 403 /// Doppler Broadeing 404 405 406 407 329 408 // 330 409 // update G4VParticleChange for the scattered photon 331 410 // 332 411 333 gammaEnergy1 = epsilon*gammaEnergy0; 412 // gammaEnergy1 = epsilon*gammaEnergy0; 413 334 414 335 415 // New polarization … … 365 445 // 366 446 367 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 ; 447 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE; 448 368 449 369 450 // Generate the electron only if with large enough range w.r.t. cuts and safety 370 451 371 452 G4double safety = aStep.GetPostStepPoint()->GetSafety(); 453 372 454 373 455 if (rangeTest->Escape(G4Electron::Electron(),couple,ElecKineEnergy,safety)) … … 379 461 aParticleChange.SetNumberOfSecondaries(1); 380 462 aParticleChange.AddSecondary(electron); 381 aParticleChange.ProposeLocalEnergyDeposit(0.); 463 // aParticleChange.ProposeLocalEnergyDeposit(0.); 464 aParticleChange.ProposeLocalEnergyDeposit(bindingE); 382 465 } 383 466 else 384 467 { 385 468 aParticleChange.SetNumberOfSecondaries(0); 386 aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy );469 aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy+bindingE); 387 470 } 388 471 … … 492 575 // G4double sinsqrphi = sinPhi*sinPhi; 493 576 G4double normalisation = std::sqrt(1. - cosSqrPhi*sinSqrTh); 494 577 495 578 496 579 // Determination of Theta 497 580 498 G4double thetaProbability; 581 // ---- MGP ---- Commented out the following 3 lines to avoid compilation 582 // warnings (unused variables) 583 // G4double thetaProbability; 499 584 G4double theta; 500 G4double a, b; 501 G4double cosTheta; 502 585 // G4double a, b; 586 // G4double cosTheta; 587 588 /* 589 590 depaola method 591 503 592 do 504 593 { 505 594 rand1 = G4UniformRand(); 506 595 rand2 = G4UniformRand(); … … 515 604 516 605 G4double cosBeta = cosTheta; 606 607 */ 608 609 610 // Dan Xu method (IEEE TNS, 52, 1160 (2005)) 611 612 rand1 = G4UniformRand(); 613 rand2 = G4UniformRand(); 614 615 if (rand1<(epsilon+1.0/epsilon-2)/(2.0*(epsilon+1.0/epsilon)-4.0*sinSqrTh*cosSqrPhi)) 616 { 617 if (rand2<0.5) 618 theta = pi/2.0; 619 else 620 theta = 3.0*pi/2.0; 621 } 622 else 623 { 624 if (rand2<0.5) 625 theta = 0; 626 else 627 theta = pi; 628 } 629 G4double cosBeta = std::cos(theta); 517 630 G4double sinBeta = std::sqrt(1-cosBeta*cosBeta); 518 631
Note: See TracChangeset
for help on using the changeset viewer.