Problem 1416

Summary: There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutron()' to the left and to the right of the '||' operator. g4mesonabsorption.cc 288
Product: Geant4 Reporter: a.ramazani
Component: processes/hadronic/models/im_r_matrixAssignee: Gunter.Folger
Status: RESOLVED FIXED    
Severity: minor CC: a.ramazani
Priority: P5    
Version: 9.6   
Hardware: PC   
OS: Windows   

Description a.ramazani 2012-12-31 13:10:48 CET
There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutron()' to the left and to the right of the '||' operator. g4mesonabsorption.cc 288



Error:
      if(( trk1.GetDefinition() == G4Neutron::Neutron() ||
	   trk1.GetDefinition() == G4Neutron::Neutron() ) &&
Correct:
      if(( trk1.GetDefinition() == G4Neutron::Neutron() ||
	   trk2.GetDefinition() == G4Neutron::Neutron() ) &&


I used The Best C++ static code analysis Tools "PVS-Studio 4.77" under Visual Studio 2012 to analyze the Geant4.9.6 code
There is many warnings and performance optimization so I recommend using PVS-Studio 
http://files.viva64.com/beta/PVS-Studio_setup.exe

Please correct me if I am wrong 
Thanks in Advance.
Comment 1 Gunter.Folger 2013-01-08 08:20:56 CET
Fixed in development version.
Bug led to some loss of cpu performance by possibly skipping a shortcut for neutrons.