Problem 2167

Summary: G4ParticleHPPhotonDist::GetPhotons() looses all but one continuum photons
Product: Geant4 Reporter: Artem Zontikov <zontikov.a>
Component: processes/hadronic/models/neutron_hpAssignee: dennis.herbert.wright
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.5   
Hardware: All   
OS: All   

Description Artem Zontikov 2019-06-12 16:18:35 CEST

    
Comment 1 Artem Zontikov 2019-06-12 16:38:48 CEST
Line #399 in G4ParticlePhotonDist.cc replaces the first element of thePhotons at each iteration because variable "count" is not incremented and the else-block starting at line #394 is ended with "break".
The "break" statement could not be removed since all of the continuum photons must be tested together against "maximumE".
I would propose something like this at line #394: 

else
{
   size_t sz = 0;
   for ( std::vector< G4double >::iterator 
       it = photons_e.begin() ; it < photons_e.end() ; it++ ) 
   {
      thePhotons->operator[](sz)->SetKineticEnergy( *it );
      sz++;
   }  
   //G4cout << "OK " << actualMult[0] << " j " << j << " total photons E  " 
   //          << std::accumulate( photons_e.begin() , photons_e.end() , 0.0 )/eV << " ratio " << std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) / maximumE 
   //          << G4endl;
   
   break;
}

The behaviour could be reproduced shooting 14MeV neutrons into Mg target. The (n,p) and (n,a) reactions generate a number of photons but only one of them has a non-zero energy.
Comment 2 dennis.herbert.wright 2019-06-21 22:49:29 CEST
Thanks again for your bug fix.  It has been implemented.