Problem 523

Summary: error in G4HadronicProcess::ChooseAandZ()
Product: Geant4 Reporter: hodges
Component: processes/hadronicAssignee: Hans-Peter.Wellisch
Status: RESOLVED FIXED    
Severity: normal CC: John.Apostolakis, Makoto.Asai
Priority: P2    
Version: 5.1   
Hardware: PC   
OS: Linux   

Description hodges 2003-08-23 11:27:31 CEST
There is a serious flaw in the Geant4.5.1 procedure that randomly
choses the target atom for a hadronic interaction.  The net result of
this error is that the last element stored in the element vector is
preferentially selected, regardless of its relative abundance.  In
other words, the material definition implemented in the detector
construction procedure is essentially meaningless for hadronic
processes.

The problem lies in the subroutine G4HadronicProcess::ChooseAandZ()
(in the file G4HadronicProcess.cc), and specifically in the code that
assimilates data in the vector runningSum[].  As programmed is version
4.5.1 the value of runningSum[i] is the product of density and
microscopic cross section for element i.  However, it should be the
sum of these quantities for elements 0 to i.

A patch for the code from G4HadronicProcess.cc starting at line 62 is
reproduced below with the original code commented.

    for( i=0; i < numberOfElements; ++i )
    {
      //   runningSum.push_back(theAtomicNumberDensity[i] *
      //     dispatch->GetMicroscopicCrossSection( aParticle,
(*theElementVector)[i], aTemp));
      //   crossSectionTotal+=runningSum[i];
      crossSectionTotal += theAtomicNumberDensity[i] *
        dispatch->GetMicroscopicCrossSection( aParticle, (*theElementVector)[i],
aTemp);
      runningSum.push_back(crossSectionTotal);
    }
Comment 1 John Apostolakis 2003-09-08 05:37:59 CEST
Thank you for your report.
I am redirecting it to the responcible for the hadronic processes.
Comment 2 Hans-Peter.Wellisch 2003-09-11 12:09:59 CEST
I fixed this, and it is now with system testing. Thank you again or reporting.

Many greetings,

Hans-Peter.