-
Notifications
You must be signed in to change notification settings - Fork 144
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
Fix #1065: source collection fluence #1076
base: develop
Are you sure you want to change the base?
Fix #1065: source collection fluence #1076
Conversation
In case where multiple transformations of a single base source are used.
Great work Blake! Just a note that this should be rebased to merge into |
@@ -87,7 +87,7 @@ REPLACE {$COVMIN} WITH {10} "min. no. of particles crossing a scoring" | |||
REPLACE {$MXMED} WITH {12} "max # of media | |||
REPLACE {$MXREG} WITH {3000} "maximum number of regions (absolute) | |||
REPLACE {$MXSTACK} WITH {900000} "maximum stack (much less if no brem split) | |||
REPLACE {$MAXBRSPLIT} WITH {2000} "maximum number of bremsstrahlung splits | |||
REPLACE {$MAXBRSPLIT} WITH {5000} "maximum number of bremsstrahlung splits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an accidental addition to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is, @rtownson. This file shouldn't even be part of this PR. I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, my mistake @rtownson! I've accidentally issued this PR against the master branch when I meant to do it against develop. Let me try that....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There!
Fluence for the source collection was not calculated properly in the case of a collection consisting of N transformations, i, of a single base source. EGS_SourceCollection::getFluence() sums the results of getFluence() for the i individual sources. If they are transformations of a single base source, then for each source i, getFluence returns the total fluence (of the base source), F_tot. Thus, EGS_SourceCollection::getFluence() erroneously returns N*F_tot.
The solution is to "detect" a group of sources sharing a common base source by looking for increases in the fluence of source i != j, where j is the source in the collection from which a given particle is being sampled. Before summing individual source fluences, EGS_SourceCollection::getFluence() then multiplies the result of getFluence() for source i by p[i]/p_tot, where p[i] is the user input probability for source i and p_tot is the sum of all probabilities of the N sources sharing the same base source. We are thus able to obtain an estimate of the fluence from each source i.
A further issue occurs when the results of parallel runs are combined. During a parallel run, we store the fluence for each source, i, in the source collection in the .egsdat file from each job. On recombining, results are first added up for each source. If these share a common base source, then these separate additions are actually cumulative with respect to the base source, with the result being that each source, i, will have (erroneous) fluence NF_tot. Then, to obtain the fluence of the source collection, we sum over the N sources, resulting in an additional multiplicative factor of N, so the total fluence is NN*F_tot. In this fix, we now detect when results are being combined and, prior to summing fluence from individual sources, divide by an additional factor N. Note that in order to determine N, we make use of new information written to the .egsdat file for each source i listing the other sources j != i sharing a common base source.
Fixes issue #1065