StatMF MacroCanonical fix#100
Open
apBUSampK wants to merge 1 commit intoGeant4:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Geant4 v11.4.0 release the Macrocanonical part of Statistical Multifragmentation Model has been changed. In particular, in the function
G4StatMFMacroCanonical::ChooseAthat decides the masses of the resulting fragments, the procedure for invalidating the resulting mass distribution vector upon rejecting the sample was changed from explicit for-loop tostd::vector::resize. This, however, is a mistake, sinceresizedoes nothing if the vector's size is equal to the requested one.Therefore, upon sample rejection, the mass distribution vector kept the distributions from previous samples and new sample was added to them. This results in the model working correctly only if the very first sample is valid, which is rare, even more so for heavier fragments. When testing to find this issue, I observed millions of fragments with A=1 produced from a single A=150 nucleus remnant going through de-excitation. The returned distribution breaks the following logic of
G4StatMFMacroCanonical::ChooseZand results in the stall of de-excitation model, but does not produce any errors (at least for about 5 minutes I was willing to wait before looking into it).I propose to change the function from
std::vector::resizetostd::vector::assignthat both resizes the vector (if needed) and always replaces its contents with the second argument (as intended by the logic ofChooseAfunction).