-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Isotropic vector generation #9
Comments
I believe the present implementation should be isotropic. Using angles would be more complex implementation Here is a good example Do you have any clues pointing to a problem on isotropy with present vector? |
Our present implementation is closer to the "Alternative method 1", however, we do not protect normalization by very small vectors, as they do, this could cause problems for us: They require that the norm is larger than 0.001, we could improve that in our method. |
I think we should really use the internal features of geant4 for this, using the We can only use the angular distribution from the generator, we do not need to change from I will do this later this morning. |
The currecnt method is by throwing points randomly in a cube, and calculate their directions. I guess there will be more events near the 8 corners of the cube |
OK, I see we rejected the events with n >1. Then this is right. Isotropic indeed. Just be less elegant. |
Yes, you always get a uniform distribution within a sphere of radius 1. Indeed, efficiency goes with However, the calculation of cosines and other mathematical functions required in other methods believe is more expensive computationally. |
Ok, finally I believe there is a bug there, because the random number is running between -0.5 and 0.5, so the radius is 0.5 and not 1! |
No no, it is ok, it is ok, it is divided by 0.5 so it is runnning between -1 and 1. :) |
This generator is improved in commit (3826fd1) of the branch I will do the pull request once it is better organized, feel free to discuss the approach, I think it could be ported to all distributions we are currently using. |
It is probably more time consuming than the simple implementation we had. On top of that it loses transparency, before we were at least able to go to the method and read clearly what it was doing. |
|
Well, I don't think the performance is a bottleneck here, as the time generating primaries is most of the time neglectable compared to the tracking. Maybe in the worst case scenario you could save a few minutes. Regarding the "transparency", I guess this is a matter of opinion. I am of the opinion that the less code, the better, as more code means more maintenance. Personally I think the tradeoff if justified here, but it is just an opinion. |
restG4/src/PrimaryGeneratorAction.cc
Line 671 in 8e6c7ef
Generating vector in this way may not be isotropic. Shouldn't we use θ and Φ to randomize direction?
The text was updated successfully, but these errors were encountered: