| Summary: | sort error | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Hans-Peter.Wellisch |
| Component: | processes/hadronic/models | Assignee: | Hans-Peter.Wellisch |
| Status: | CLOSED FIXED | ||
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 3.2 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
this is a really hard one. I cannot quite belief that sort does not work, but all my attempts to find the 'bug' elsewhere have failed up to now. Many greetings, Hans-Peter. Hi, I think I found a simple solution to this. STL has two sort algorithms. sort, and stable_sort, that use entirely differrent implementations. Many greetings, Hans-Peter. released in 4.1 |
Dear Hans-Peter, I have encountered a problem while trying to apply G4PhotonEvaporation to Pa233(57.1 keV). In G4DiscreteGammaDeexcitation, the nuclearLevelManager returns the wrong "minLevelEnergy" and this resulted in Pa233 not being treated properly. The problem can be traced back to G4NuclearLevelManager::MakeLevels(): afeter the creation of all levels the code try to sort them into ascending order in energy using G4std::sort(). I can see nothing wrong here as the < operator for G4NuclearLevel has been defined and it worked most of the time. BUT it will mess up the nuclear levels if the numbers of levels of the nucleus is big, as in the case of Pa233, AND also this ONLY happens when the nuclearlevelmagers is invoked from G4DiscreteGammaDeexcitation:: CreateTransition() { ... _levelManager.SetNucleus(Z,A); .... } In this case the sorting process in MakeLevels() is not carried out properly and the resulted nuclearlevel vector is not in ascending order. I cannot see any obvious reason in the code why this is the case. The coding seems to be correct and the G4std::sort() ought to have put the nuclear levels in ascending order, but... It is a mystery to me. One tempary fix is to remove this sorting process. It is not really needed there, as the nuclearlevels are created in ascending orders automatically from the photonevaporation database. Regards. Fan