In G4PenelopeRayleigh, the re-computation of the random sampling function for each call to PostStepDoIt results in my entire simulation being slowed down a factor of more than 30. I am attaching a modification to G4PenelopeRayleigh.cc and the associated header file which caches these results, and looks up re-used values. This eleminates the bottleneck. These should be verified for correctness, and if OK, (and someone else hasn't already fixed this internally), checked in. Thanks.
The problem is re-assigned to the developer expert in Geant4 Penelope processes. Best wishes, Maria Grazia Pia
Your solution is correct indeed and it can greatly reduce the computation time for the Rayleigh process. The modified process will be available in the next public release/patch. Thank you very much for your report and solution. Best wishes, Luciano Pandola