Skip to content
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

Ability to select energy range in cosmic generator #131

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

lobis
Copy link
Member

@lobis lobis commented Oct 3, 2024

lobis Ok: 53 Powered by Pull Request Badge

<generator type="cosmic">
    <source use="Cosmics" direction="(0,-1,0)" filename="../cosmics.root"
            particles="neutron" energy="(1,10)MeV"/>
</generator>

Works to limit the range of the generator, the equivalent simulation time is adjusted accordingly. This works by continously sampling the full range until the energy lies in the selected range, then the ratio of accepted / total attempts is used to bias the simulation time. This is not the optimal approach but it is easy enough to implement (an especially to maintain) and it shouldn't be a problem since sampling the histogram is much faster than doing the radiation transport of an event (unless the energy range is extremely narrow, then this may become a bottleneck).

@lobis lobis marked this pull request as ready for review October 3, 2024 19:08
@lobis lobis enabled auto-merge October 3, 2024 19:49
@lobis lobis disabled auto-merge October 3, 2024 19:58
@lobis lobis merged commit bb6fd19 into master Oct 3, 2024
64 checks passed
@lobis lobis deleted the cosmics-choose-energy branch October 3, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant