G4double anglefactor = (localdir.x()*localpos1.x() +localdir.y()*localpos1.y() +localdir.z()*localpos1.z()) /std::sqrt(localdirL2)/std::sqrt(localR2); anglefactor should be always positive.
The angle factor in G4PSSphereSurfaceFlux was modified to keep it always positive. The modification in the code was same as the other scorers such as G4PSFlatSurfaceFlux, i.e. : if ( anglefactor < 0.0 ) anglefactor *= -1.0;