Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -14,6 +14,11 @@ code and to keep track of all tags.
|
||||
* Please list in reverse chronological order (last date on top)
|
||||
---------------------------------------------------------------
|
||||
|
||||
23-December 2017 Vladimir Ivanchenko had-im_r_V10-03-01
|
||||
- G4ParticleTypeConverter - all methods become const
|
||||
- G4ConcreteMesonBaryonToResonance - fixed memory leak, adding
|
||||
static objects with const only methods
|
||||
|
||||
21-December 2016 Gunter Folger had-im_r_V10-03-00
|
||||
- G4VScatteringCollision: Fix memory leak in MT, bug report 1905
|
||||
|
||||
|
||||
+12
@@ -39,6 +39,7 @@
|
||||
#include "G4ParticleTypeConverter.hh"
|
||||
#include "G4BaryonWidth.hh"
|
||||
#include "G4BaryonPartialWidth.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
//class G4KineticTrack;
|
||||
|
||||
@@ -86,13 +87,24 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
static void InitialisePointers();
|
||||
|
||||
G4VCrossSectionSource* crossSectionSource;
|
||||
const G4ParticleDefinition* thePrimary1;
|
||||
const G4ParticleDefinition* thePrimary2;
|
||||
const G4ParticleDefinition* theSecondary;
|
||||
|
||||
static G4BaryonWidth & theBaryonWidth();
|
||||
static G4BaryonPartialWidth & theBaryonPartialWidth();
|
||||
static G4ParticleTypeConverter & myConv();
|
||||
|
||||
static G4BaryonWidth* baryonWidth;
|
||||
static G4BaryonPartialWidth* baryonPartialWidth;
|
||||
static G4ParticleTypeConverter* particleTypeConverter;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
static G4Mutex concreteMesonBaryonToResonanceMutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,14 +46,14 @@ public:
|
||||
|
||||
G4ParticleTypeConverter();
|
||||
|
||||
GenericType GetGenericType(const G4ParticleDefinition* const aParticleDef);
|
||||
GenericType GetGenericType(const G4KineticTrack& aTrack);
|
||||
GenericType GetGenericType(const G4String& aParticleName);
|
||||
GenericType GetGenericType(const G4ParticleDefinition* const aParticleDef) const;
|
||||
GenericType GetGenericType(const G4KineticTrack& aTrack) const;
|
||||
GenericType GetGenericType(const G4String& aParticleName) const;
|
||||
|
||||
G4int GetUrqmdItyp(GenericType gType);
|
||||
G4int GetUrqmdItyp(const G4ParticleDefinition* aParticleDef);
|
||||
G4int GetUrqmdItyp(GenericType gType) const;
|
||||
G4int GetUrqmdItyp(const G4ParticleDefinition* aParticleDef) const;
|
||||
|
||||
const G4ParticleDefinition* FindIso3State(const GenericType gType, const G4int isospin3);
|
||||
const G4ParticleDefinition* FindIso3State(const GenericType gType, const G4int isospin3) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
+31
-7
@@ -28,22 +28,30 @@
|
||||
#include "G4XAnnihilationChannel.hh"
|
||||
#include "G4ConcreteMesonBaryonToResonance.hh"
|
||||
|
||||
G4BaryonWidth* G4ConcreteMesonBaryonToResonance::baryonWidth = nullptr;
|
||||
G4BaryonPartialWidth* G4ConcreteMesonBaryonToResonance::baryonPartialWidth = nullptr;
|
||||
G4ParticleTypeConverter* G4ConcreteMesonBaryonToResonance::particleTypeConverter = nullptr;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4Mutex G4ConcreteMesonBaryonToResonance::concreteMesonBaryonToResonanceMutex = G4MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
G4BaryonWidth & G4ConcreteMesonBaryonToResonance::theBaryonWidth()
|
||||
{
|
||||
static G4ThreadLocal G4BaryonWidth *theWidth_G4MT_TLS_ = 0 ; if (!theWidth_G4MT_TLS_) theWidth_G4MT_TLS_ = new G4BaryonWidth ; G4BaryonWidth &theWidth = *theWidth_G4MT_TLS_;
|
||||
return theWidth;
|
||||
if(!baryonWidth) { G4ConcreteMesonBaryonToResonance::InitialisePointers(); }
|
||||
return *baryonWidth;
|
||||
}
|
||||
|
||||
G4BaryonPartialWidth & G4ConcreteMesonBaryonToResonance::theBaryonPartialWidth()
|
||||
{
|
||||
static G4ThreadLocal G4BaryonPartialWidth *theWidth_G4MT_TLS_ = 0 ; if (!theWidth_G4MT_TLS_) theWidth_G4MT_TLS_ = new G4BaryonPartialWidth ; G4BaryonPartialWidth &theWidth = *theWidth_G4MT_TLS_;
|
||||
return theWidth;
|
||||
if(!baryonPartialWidth) { G4ConcreteMesonBaryonToResonance::InitialisePointers(); }
|
||||
return *baryonPartialWidth;
|
||||
}
|
||||
|
||||
G4ParticleTypeConverter & G4ConcreteMesonBaryonToResonance::myConv()
|
||||
{
|
||||
static G4ThreadLocal G4ParticleTypeConverter *theConv_G4MT_TLS_ = 0 ; if (!theConv_G4MT_TLS_) theConv_G4MT_TLS_ = new G4ParticleTypeConverter ; G4ParticleTypeConverter &theConv = *theConv_G4MT_TLS_;
|
||||
return theConv;
|
||||
if(!particleTypeConverter) { G4ConcreteMesonBaryonToResonance::InitialisePointers(); }
|
||||
return *particleTypeConverter;
|
||||
}
|
||||
|
||||
G4ConcreteMesonBaryonToResonance::G4ConcreteMesonBaryonToResonance(const G4ParticleDefinition* aPrimary,
|
||||
@@ -56,14 +64,30 @@ G4ConcreteMesonBaryonToResonance::G4ConcreteMesonBaryonToResonance(const G4Parti
|
||||
theBaryonWidth(),
|
||||
theBaryonPartialWidth(),
|
||||
partWidthLabel);
|
||||
InitialisePointers();
|
||||
}
|
||||
|
||||
|
||||
G4ConcreteMesonBaryonToResonance::~G4ConcreteMesonBaryonToResonance()
|
||||
{
|
||||
delete crossSectionSource;
|
||||
}
|
||||
|
||||
void G4ConcreteMesonBaryonToResonance::InitialisePointers()
|
||||
{
|
||||
if(!baryonWidth) {
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&concreteMesonBaryonToResonanceMutex);
|
||||
if (!baryonWidth) {
|
||||
#endif
|
||||
baryonWidth = new G4BaryonWidth();
|
||||
baryonPartialWidth = new G4BaryonPartialWidth();
|
||||
particleTypeConverter = new G4ParticleTypeConverter();
|
||||
#ifdef G4MULTITHREADED
|
||||
}
|
||||
G4MUTEXUNLOCK(&concreteMesonBaryonToResonanceMutex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4ConcreteMesonBaryonToResonance::IsInCharge(const G4KineticTrack& trk1,
|
||||
const G4KineticTrack& trk2) const
|
||||
|
||||
@@ -211,10 +211,9 @@ G4ParticleTypeConverter::G4ParticleTypeConverter()
|
||||
}
|
||||
|
||||
|
||||
G4ParticleTypeConverter::GenericType G4ParticleTypeConverter::GetGenericType(const G4ParticleDefinition* const aParticleDef)
|
||||
G4ParticleTypeConverter::GenericType G4ParticleTypeConverter::GetGenericType(const G4ParticleDefinition* const aParticleDef) const
|
||||
{
|
||||
size_t i=0;
|
||||
for(i=0;i<defMap.size(); i++)
|
||||
for(size_t i=0;i<defMap.size(); i++)
|
||||
{
|
||||
if(defMap[i].first == aParticleDef) return defMap[i].second;
|
||||
}
|
||||
@@ -224,14 +223,12 @@ G4ParticleTypeConverter::GenericType G4ParticleTypeConverter::GetGenericType(con
|
||||
// throw G4HadronicException(__FILE__, __LINE__, "G4ParticleTypeConverter: unknown particle type!");
|
||||
}
|
||||
|
||||
|
||||
G4ParticleTypeConverter::GenericType G4ParticleTypeConverter::GetGenericType(const G4KineticTrack& aTrack)
|
||||
G4ParticleTypeConverter::GenericType G4ParticleTypeConverter::GetGenericType(const G4KineticTrack& aTrack) const
|
||||
{
|
||||
return GetGenericType(aTrack.GetDefinition());
|
||||
}
|
||||
|
||||
|
||||
G4int G4ParticleTypeConverter::GetUrqmdItyp(G4ParticleTypeConverter::GenericType )
|
||||
G4int G4ParticleTypeConverter::GetUrqmdItyp(G4ParticleTypeConverter::GenericType ) const
|
||||
{
|
||||
//if (uMap.find(gType)!=uMap.end())
|
||||
// hpw return uMap.operator[](gType);
|
||||
@@ -240,9 +237,8 @@ G4int G4ParticleTypeConverter::GetUrqmdItyp(G4ParticleTypeConverter::GenericType
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const G4ParticleDefinition* G4ParticleTypeConverter::FindIso3State(const G4ParticleTypeConverter::GenericType gType,
|
||||
const G4int isospin3)
|
||||
const G4int isospin3) const
|
||||
{
|
||||
MapIterator iter;
|
||||
for (iter = defMap.begin(); iter!=defMap.end(); ++iter) {
|
||||
@@ -255,5 +251,5 @@ const G4ParticleDefinition* G4ParticleTypeConverter::FindIso3State(const G4Parti
|
||||
}
|
||||
}
|
||||
// G4cout << "FindIso3State: can't find " << static_cast<G4int>(gType) << " with iso3 " << isospin3 << G4endl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user