Problem 1507 - (need break;inside for): in method: G4XNNstarTable::CrossSectionTable
Summary: (need break;inside for): in method: G4XNNstarTable::CrossSectionTable
Status: RESOLVED WORKSFORME
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/im_r_matrix (show other problems)
Version: 9.6
Hardware: All All
: P5 normal
Assignee: Gunter.Folger
URL:
Depends on:
Blocks:
 
Reported: 2013-07-26 22:09 CEST by a.ramazani
Modified: 2013-09-10 15:17 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 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().