Problem 1961 - Adding new function G4RandomDirectionWithinACone
Summary: Adding new function G4RandomDirectionWithinACone
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: global (show other problems)
Version: 10.3
Hardware: All All
: P4 enhancement
Assignee: Evgueni.Tcherniaev
URL:
Depends on:
Blocks:
 
Reported: 2017-04-03 15:36 CEST by Michele Renda
Modified: 2017-04-11 10:59 CEST (History)
1 user (show)

See Also:


Attachments
Add new function (1.47 KB, patch)
2017-04-03 15:40 CEST, Michele Renda
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
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.