Problem 948 - inelastic photon distributions depend on uninitialized values in G4NeutronHPPhotonDist
Summary: inelastic photon distributions depend on uninitialized values in G4NeutronHPP...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/neutron_hp (show other problems)
Version: 8.3
Hardware: All All
: P5 major
Assignee: tkoi
URL:
Depends on:
Blocks:
 
Reported: 2007-05-25 16:50 CEST by gahs
Modified: 2011-05-09 18:12 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 gahs 2007-05-25 16:50:24 CEST
Many "Conditional jump or move depends on uninitialised value(s)"
errors detected by valgrind in the following places:

  G4NeutronHPPhotonDist::GetPhotons(double) (G4NeutronHPPhotonDist.cc:208)
  G4NeutronHPPhotonDist::GetPhotons(double) (G4NeutronHPPhotonDist.cc:342)
  G4NeutronHPPhotonDist::NeedsCascade() (inline function)

All of these turn out to be due to accessing "repFlag", which is not
initialized.  The above two functions are sometimes being called from
G4NeutronHPInelasticCompFS::CompositeApply(), and sometimes being
called from G4NeutronHPInelasticBaseFS::BaseApply().

I tracked it down, and found in G4NeutronHPInelasticCompFS::Init()
and G4NeutronHPInelasticBaseFS::Init(), there
is the following logic:
...
    else if(dataType==12)
    {
      theFinalStatePhotons[it] = new G4NeutronHPPhotonDist;
      theFinalStatePhotons[it]->InitMean(theData);
    }
    else if(dataType==13)
    {
      theFinalStatePhotons[it] = new G4NeutronHPPhotonDist;
      theFinalStatePhotons[it]->InitPartials(theData);
    }
...

It turns out that only G4NeutronHPPhotonDist::InitMean() initializes
repFlag.  Neither the G4NeutronHPPhotonDist constructor nor
G4NeutronHPPhotonDist::InitPartials() initializes repFlag.

Since InitMean occurs only in one place in G4NeutronHPInelastic*FS.*,
in the dataType==12 case, it follows that repFlag will _always_ be
uninitialized in the dataType==13 case, and inelastic interaction
photon distributions from isotopes using dataType==13 will _always_ be
buggy, i.e., physics results dependent on the garbage uninitialized
values in repFlag.  I confirmed this is the case by following the
initialization of oxygen 16 inelastic states in the debugger.

To quote the author of report #943, "Please fix this strange code."

It looks like maybe G4NeutronHPFSFissionFS could have the same
problem.  I'm not sure about G4NeutronHPCaptureFS.

Some of the isotope inelastic final state files that have this
dataType==13 case include

  G4NDL3.10/Inelastic/F23/7_14_Nitrogen
  G4NDL3.10/Inelastic/F23/7_15_Nitrogen
  G4NDL3.10/Inelastic/F24/7_14_Nitrogen
  G4NDL3.10/Inelastic/F24/7_15_Nitrogen
  G4NDL3.10/Inelastic/F25/7_14_Nitrogen
  G4NDL3.10/Inelastic/F25/7_15_Nitrogen
  G4NDL3.10/Inelastic/F27/7_14_Nitrogen
  G4NDL3.10/Inelastic/F27/7_15_Nitrogen
  
  G4NDL3.10/Inelastic/F23/8_16_Oxygen
  G4NDL3.10/Inelastic/F24/8_16_Oxygen
  G4NDL3.10/Inelastic/F25/8_16_Oxygen
  G4NDL3.10/Inelastic/F27/8_16_Oxygen
  G4NDL3.10/Inelastic/F27/8_16_Oxygen

I hope you can put in an appropriate fix as quickly and effectively as
you addressed #943.  Maybe this will also help solve other reports,
like 821, 900, 902?  Please be careful: it looks to me like simply
initializing repFlag to some value won't be enough to make
GetPhotons() and NeedsCascade() work correctly with the data loaded by
InitPartials(), although I could be wrong.
Comment 1 tkoi 2007-05-31 02:33:49 CEST
Hi,

Thank you very much for investigations.
Unfortunately the case you mentioned corresponds to
“the partial cross-section case",
and it was mentioned on the line 204 of G4NeutronHPPhotonDist.cc v8.3
“// the partial cross-section case is not in this yet. @@@@”

Thank you very much for your patience in this matter.
Comment 2 tkoi 2011-05-09 18:12:52 CEST
Hi 

This was impleneted some time before!
So I close this entry.

Tatsumi