Problem 1507

Summary: (need break;inside for): in method: G4XNNstarTable::CrossSectionTable
Product: Geant4 Reporter: a.ramazani
Component: processes/hadronic/models/im_r_matrixAssignee: Gunter.Folger
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P5    
Version: 9.6   
Hardware: All   
OS: All   

Description a.ramazani 2013-07-26 22:09:41 CEST
\processes\hadronic\models\im_r_matrix\G4XNNstarTable.cc
const G4PhysicsVector* G4XNNstarTable::CrossSectionTable(const G4String& particleName) const 

(need break;inside for):
    G4double* sigmaPointer = 0;
      for (iter = xMap.begin(); iter != xMap.end(); ++iter)
	{
	  G4String str = (*iter).first;
          if (str == particleName)
	    {
	      sigmaPointer = (*iter).second; 
	    }
	} 



Correct:
    G4double* sigmaPointer = 0;
      for (iter = xMap.begin(); iter != xMap.end(); ++iter)
	{
	  G4String str = (*iter).first;
          if (str == particleName)
	    {
	      sigmaPointer = (*iter).second; 
	break;    }
	}
Comment 1 Gunter.Folger 2013-09-10 15:17:12 CEST
Thanks for this report. This is not a bug, the code searches the complete map, while your code would stop on str == particleName.

Likely, the code should use map::find().