Problem 324 - sort error
Summary: sort error
Status: CLOSED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models (show other problems)
Version: 3.2
Hardware: PC Linux
: P2 normal
Assignee: Hans-Peter.Wellisch
URL:
Depends on:
Blocks:
 
Reported: 2001-11-28 01:18 CET by Hans-Peter.Wellisch
Modified: 2003-03-13 02:09 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Hans-Peter.Wellisch 2001-11-28 01:18:16 CET
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
Comment 1 Hans-Peter.Wellisch 2002-05-02 08:29:59 CEST
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.
Comment 2 Hans-Peter.Wellisch 2002-06-04 04:15:59 CEST
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.
Comment 3 Hans-Peter.Wellisch 2003-03-13 02:10:59 CET
released in 4.1