Problem 2167 - G4ParticleHPPhotonDist::GetPhotons() looses all but one continuum photons
Summary: G4ParticleHPPhotonDist::GetPhotons() looses all but one continuum photons
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/neutron_hp (show other problems)
Version: 10.5
Hardware: All All
: P4 minor
Assignee: dennis.herbert.wright
URL:
Depends on:
Blocks:
 
Reported: 2019-06-12 16:18 CEST by Artem Zontikov
Modified: 2019-06-21 22:49 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.