Import Geant4 11.0.1 source tree

This commit is contained in:
Gabriele Cosmo
2022-03-23 08:25:50 +01:00
parent 84f33a068c
commit de4f28d823
234 changed files with 61815 additions and 61766 deletions
+4
View File
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
January. 19th, 2022 - V.Ivantchenko (proccuts-V10-07-06)
- G4VRangeToEnergyConverter - fixed construction/destruction of
static data (initial problem identified by I. Hrivnakova)
October. 12th, 2021 - V.Ivanchenko (proccuts-V10-07-05)
- G4PhysicsTableHelper - fixed Coverity warning due to index type,
removed G4ThreadLocal variable, substitute old cerr by
@@ -117,6 +117,7 @@ protected:
G4int fPDG = 0;
G4int verboseLevel = 1;
G4bool isFirstInstance = false;
};
// ------------------
@@ -52,7 +52,21 @@ G4VRangeToEnergyConverter::G4VRangeToEnergyConverter()
{
if(nullptr == Energy)
{
Energy = new std::vector<G4double>(Nbin + 1);
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&theMutex);
if(nullptr == Energy)
{
#endif
isFirstInstance = true;
Energy = new std::vector<G4double>(Nbin + 1);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&theMutex);
#endif
}
// this method defines lock itself
if(isFirstInstance)
{
FillEnergyVector(1*CLHEP::keV, 10.0*CLHEP::GeV);
}
}
@@ -60,7 +74,7 @@ G4VRangeToEnergyConverter::G4VRangeToEnergyConverter()
// --------------------------------------------------------------------
G4VRangeToEnergyConverter::~G4VRangeToEnergyConverter()
{
if(nullptr != Energy)
if(isFirstInstance)
{
delete Energy;
Energy = nullptr;
@@ -145,25 +159,26 @@ void G4VRangeToEnergyConverter::SetMaxEnergyCut(const G4double value)
void G4VRangeToEnergyConverter::FillEnergyVector(const G4double emin,
const G4double emax)
{
if(emin == Emin && emax == Emax) { return; }
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&theMutex);
if(emin == Emin && emax == Emax) { return; }
#endif
Emin = emin;
Emax = emax;
Nbin = NbinPerDecade*static_cast<G4int>(std::log10(emax/emin));
Energy->resize(Nbin + 1);
(*Energy)[0] = emin;
(*Energy)[Nbin] = emax;
G4double fact = G4Log(emax/emin)/Nbin;
for(G4int i=1; i<Nbin; ++i)
if(emin != Emin || emax != Emax)
{
(*Energy)[i] = emin*G4Exp(i * fact);
}
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&theMutex);
G4MUTEXLOCK(&theMutex);
if(emin != Emin || emax != Emax)
{
#endif
Emin = emin;
Emax = emax;
Nbin = NbinPerDecade*static_cast<G4int>(std::log10(emax/emin));
Energy->resize(Nbin + 1);
(*Energy)[0] = emin;
(*Energy)[Nbin] = emax;
G4double fact = G4Log(emax/emin)/Nbin;
for(G4int i=1; i<Nbin; ++i) { (*Energy)[i] = emin*G4Exp(i * fact); }
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&theMutex);
#endif
}
}
// --------------------------------------------------------------------