Problem 523 - error in G4HadronicProcess::ChooseAandZ()
Summary: error in G4HadronicProcess::ChooseAandZ()
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic (show other problems)
Version: 5.1
Hardware: PC Linux
: P2 normal
Assignee: Hans-Peter.Wellisch
URL:
Depends on:
Blocks:
 
Reported: 2003-08-23 11:27 CEST by hodges
Modified: 2003-09-11 12:09 CEST (History)
2 users (show)

See Also:


Attachments

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