Problem 1745

Summary: photon isotropic distribution sampling in G4NeutronHPPhotonDist
Product: Geant4 Reporter: Artem Zontikov <zontikov.a>
Component: processes/hadronic/models/neutron_hpAssignee: dennis.herbert.wright
Status: RESOLVED FIXED    
Severity: trivial CC: dennis.herbert.wright
Priority: P5    
Version: 10.1   
Hardware: All   
OS: All   

Description Artem Zontikov 2015-05-13 15:38:11 CEST
In source/processes/hadronic/models/neutron_hp/src/G4NeutronHPPhotonDist.cc at line #490 theta is sampled uniformly within [0;pi] angle interval while it is assumed to be uniform within [-1;1] cosine interval.

487  if(ii<nIso)
488  {
489  // isotropic distribution
490  G4double theta = pi*G4UniformRand();
491  G4double phi = twopi*G4UniformRand();
492  G4double sinth = std::sin(theta);
493  G4double en = thePhotons->operator[](i)->GetTotalEnergy();
494  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
495  thePhotons->operator[](i)->SetMomentum( tempVector ) ;
496  }

Obvious fix is:
...
G4double cosTheta = -1.0 + 2.0*G4UniformRand();
G4double phi = twopi*G4UniformRand();
G4double sinTheta = std::sqrt(1.0 - cosTheta*cosTheta);
...
G4ThreeVector tempVector(en*sinTheta*std::cos(phi), en*sinTheta*std::sin(phi), en*cosTheta);
...
Comment 1 tkoi 2015-06-08 23:22:03 CEST
Thank you for reporting problem and also providing fix for it.
The fix will be included in future release