34 #define INCLXX_IN_GEANT4_MODE 1
58 namespace NuclearPotential {
66 G4ThreadLocal std::map<long,INuclearPotential const *> *nuclearPotentialCache = NULL;
71 if(!nuclearPotentialCache)
72 nuclearPotentialCache =
new std::map<long,INuclearPotential const *>;
74 const long nuclideID = (pionPotential ? 1 : -1) * (1000*theZ + theA + 1000000*type);
75 const std::map<long,INuclearPotential const *>::const_iterator mapEntry = nuclearPotentialCache->find(nuclideID);
76 if(mapEntry == nuclearPotentialCache->end()) {
92 INCL_FATAL(
"Unrecognized potential type at Nucleus creation." <<
'\n');
95 (*nuclearPotentialCache)[nuclideID] = thePotential;
98 return mapEntry->second;
103 if(nuclearPotentialCache) {
104 for(std::map<long,INuclearPotential const *>::const_iterator i = nuclearPotentialCache->begin(),
e=nuclearPotentialCache->end(); i!=
e; ++i)
106 nuclearPotentialCache->clear();
107 delete nuclearPotentialCache;
108 nuclearPotentialCache = NULL;