Problem 1417 - There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutron()' to the left and to the right of the '||' operator. g4scatterer.cc 140
Summary: There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutr...
Status: RESOLVED DUPLICATE of problem 1334
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/im_r_matrix (show other problems)
Version: 9.6
Hardware: PC Windows
: P5 minor
Assignee: Gunter.Folger
URL:
Depends on:
Blocks:
 
Reported: 2012-12-31 13:13 CET by a.ramazani
Modified: 2013-01-07 17:55 CET (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 a.ramazani 2012-12-31 13:13:22 CET
There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutron()' to the left and to the right of the '||' operator. g4scatterer.cc 140


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-07 17:48:31 CET
Fixed in development version.
The only problem this causes will be a performance penality, as a shortcut may not be taken. Shortcut is to avoid calculation of cross section, when it is easy to estimate that particles will not interact.
Comment 2 Gunter.Folger 2013-01-07 17:55:30 CET

*** This problem has been marked as a duplicate of problem 1334 ***