Problem 1961

Summary: Adding new function G4RandomDirectionWithinACone
Product: Geant4 Reporter: Michele Renda <michele.renda>
Component: globalAssignee: Evgueni.Tcherniaev
Status: RESOLVED FIXED    
Severity: enhancement CC: dan.andrei.ciubotaru
Priority: P4    
Version: 10.3   
Hardware: All   
OS: All   
Attachments: Add new function

Description Michele Renda 2017-04-03 15:36:24 CEST
Hello everybody.

In my simulation I was needing to simulate a not collimated particle gun (primary particle are not parallel but uniformly diverging within a cone).

I was expecting to find that function inside G4RandomTools.hh or G4RandomDirection.hh but I was not able to find something like this (the nearest one was G4RandomDirection()).

So I decided to create a patch in case someone need it.

Best regards
Michele Renda
Comment 1 Michele Renda 2017-04-03 15:39:01 CEST
Created git merge request:
https://gitlab.cern.ch/geant4/geant4/merge_requests/2
Comment 2 Michele Renda 2017-04-03 15:40:01 CEST
Created attachment 450 [details]
Add new function
Comment 3 Gabriele Cosmo 2017-04-05 11:09:37 CEST
Thanks for the proposed extension, we'll evaluate it.
Please, note that in general, the policy adopted in Geant4 for tools/functions provided is to include only those limited for adoption within the toolkit itself, also for motivations of validation and testing. There is no commitment for providing a comprehensive variety of tools for general use.
Comment 4 Michele Renda 2017-04-05 11:23:48 CEST
Hello Gabriele.

Indeed understand the policy. I created the patch because it was very easy to copy my implementation and to submit to Geant4.

Feel free to don't include it, if it is not needed.

Best regards
Comment 5 Evgueni.Tcherniaev 2017-04-11 10:59:49 CEST
A new function G4RandomDirection(cosTheta) has been introduced.
The function is already available at the trunk of the repository.