Problem 942 - Bug in G4EmCorrections::InitialiseMaterial(const G4Material* mat)
Summary: Bug in G4EmCorrections::InitialiseMaterial(const G4Material* mat)
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/processes (show other problems)
Version: 8.2
Hardware: All All
: P5 critical
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2007-05-07 12:28 CEST by porosev
Modified: 2007-05-15 12:03 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description porosev 2007-05-07 12:28:29 CEST
Hello all!

I studed simple example.. 100MeV proton hit to cube made from G4_WATER...
as the result G4 crashed :))) in "v->PutValue(i, dedx/dedx1)" in g4emcorrections.cc Ln. 758

G4PhysicsVector* G4EmCorrections::InitialiseMaterial(const G4Material* mat)
{
...
    size_t nbins = v->GetVectorLength();
...
    for(size_t i=0; i<nbins; i++) {
...
      v->PutValue(i, dedx/dedx1);
...  }
  }
  return v;
}

the fuction "PutValue" is called with parameter "i"  equals to "22"... but
"v" array has a length "23" only and G4 crash when it try to write "dataVector[binNumber+1] = theValue" element behind last element in: 

inline 
 void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
{
  dataVector[binNumber] = theValue;

  // Fill the bin which is hidden to user with theValue. This is to 
  // handle correctly when Energy=theEmax in getValue.
  if(binNumber==numberOfBin-1) {
    dataVector[binNumber+1] = theValue;
  }                                 
}

Please fix this strange place!!!!

Sincerely Yours,
Viacheslav Porosev
Comment 1 Vladimir.Ivantchenko 2007-05-08 20:43:53 CEST
Please, reproduce the bug using $G4INSTALL/example/extended/electromagnetic/TestEm7
There is a standrad macro TestEm7.in, also proton.mac
These macros are regulary executed and bug does not show up.
Comment 2 Vladimir.Ivantchenko 2007-05-15 12:03:51 CEST
Hello,
Thank you for poining to the bug. Your analysis was correct. It is fixed and submitted for testing. Fixed version will be available in Geant4 9.0.