Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 110104 2018-05-15 11:40:56Z gcosmo $
|
||||
$Id: History 110258 2018-05-17 14:20:46Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,10 +17,21 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
- 09 April 2018 Makoto Asai ( particles-V10-03-17 )
|
||||
- 17 May 2018 Jonathan Madsen (particles-V10-04-03)
|
||||
- updated "thread-local-static-var" model to
|
||||
"function-returning-thread-local-static-reference" model
|
||||
which fixes Windows DLL + MT
|
||||
|
||||
- 09 April 2018 Makoto Asai (particles-V10-04-02)
|
||||
- G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
|
||||
Fix incorrect indexing. Addressing bug report #2053.
|
||||
|
||||
- 12 February 2018 Jonathan Madsen (particles-V10-04-01)
|
||||
- Removed G4MUTEX_INITIALIZER from constructor in G4VDecayChannel
|
||||
|
||||
- 07 February 2018 Hisaya Kurashige ( particles-V10-04-00 )
|
||||
- remove obsolete enum of MaxNumberOfProducts in G4DecayProducts
|
||||
|
||||
- 13 September 2017 Krzysztof Genser ( particles-V10-03-16 )
|
||||
- moved G4MuonicAtom & G4MuonicAtomHelper to management
|
||||
to avoid circular reference in the granular lib case
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DecayProducts.hh 67971 2013-03-13 10:13:24Z gcosmo $
|
||||
// $Id: G4DecayProducts.hh 108369 2018-02-09 08:39:32Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -92,8 +92,6 @@ class G4DecayProducts
|
||||
void DumpInfo() const;
|
||||
|
||||
typedef std::vector<G4DynamicParticle*> G4DecayProductVector;
|
||||
protected:
|
||||
enum {MaxNumberOfProducts = 64};
|
||||
|
||||
private:
|
||||
G4int numberOfProducts;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DynamicParticle.icc 98352 2016-07-08 08:21:00Z gcosmo $
|
||||
// $Id: G4DynamicParticle.icc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -33,7 +33,7 @@
|
||||
// History: first implementation, based on object model of
|
||||
// 17 AUg. 1999 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
extern G4PART_DLL G4ThreadLocal G4Allocator<G4DynamicParticle> *pDynamicParticleAllocator;
|
||||
extern G4PART_DLL G4Allocator<G4DynamicParticle>*& pDynamicParticleAllocator();
|
||||
|
||||
// ------------------------
|
||||
// Inlined operators
|
||||
@@ -41,14 +41,14 @@ extern G4PART_DLL G4ThreadLocal G4Allocator<G4DynamicParticle> *pDynamicParticle
|
||||
|
||||
inline void * G4DynamicParticle::operator new(size_t)
|
||||
{
|
||||
if (!pDynamicParticleAllocator) pDynamicParticleAllocator =
|
||||
if (!pDynamicParticleAllocator()) pDynamicParticleAllocator() =
|
||||
new G4Allocator<G4DynamicParticle>;
|
||||
return pDynamicParticleAllocator->MallocSingle();
|
||||
return pDynamicParticleAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::operator delete(void * aDynamicParticle)
|
||||
{
|
||||
pDynamicParticleAllocator->FreeSingle((G4DynamicParticle *) aDynamicParticle);
|
||||
pDynamicParticleAllocator()->FreeSingle((G4DynamicParticle *) aDynamicParticle);
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectronOccupancy.hh 79357 2014-02-25 10:06:54Z gcosmo $
|
||||
// $Id: G4ElectronOccupancy.hh 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -102,7 +102,7 @@ class G4ElectronOccupancy
|
||||
|
||||
};
|
||||
|
||||
extern G4PART_DLL G4ThreadLocal G4Allocator<G4ElectronOccupancy> *aElectronOccupancyAllocator;
|
||||
extern G4PART_DLL G4Allocator<G4ElectronOccupancy>*& aElectronOccupancyAllocator();
|
||||
|
||||
// ------------------------
|
||||
// Inlined operators
|
||||
@@ -110,16 +110,16 @@ extern G4PART_DLL G4ThreadLocal G4Allocator<G4ElectronOccupancy> *aElectronOccup
|
||||
|
||||
inline void * G4ElectronOccupancy::operator new(size_t)
|
||||
{
|
||||
if (!aElectronOccupancyAllocator)
|
||||
if (!aElectronOccupancyAllocator())
|
||||
{
|
||||
aElectronOccupancyAllocator = new G4Allocator<G4ElectronOccupancy>;
|
||||
aElectronOccupancyAllocator() = new G4Allocator<G4ElectronOccupancy>;
|
||||
}
|
||||
return (void *) aElectronOccupancyAllocator->MallocSingle();
|
||||
return (void *) aElectronOccupancyAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ElectronOccupancy::operator delete(void * aElectronOccupancy)
|
||||
{
|
||||
aElectronOccupancyAllocator->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
|
||||
aElectronOccupancyAllocator()->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PDefManager.hh 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
// $Id: G4PDefManager.hh 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -111,8 +111,8 @@ class G4PDefManager
|
||||
|
||||
public:
|
||||
|
||||
G4PART_DLL G4ThreadLocalStatic G4int slavetotalspace;
|
||||
G4PART_DLL G4ThreadLocalStatic G4PDefData* offset;
|
||||
G4PART_DLL static G4int& slavetotalspace(); // thread-local
|
||||
G4PART_DLL static G4PDefData*& offset(); // thread-local
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleTable.hh 106143 2017-09-14 06:34:42Z gcosmo $
|
||||
// $Id: G4ParticleTable.hh 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -236,8 +236,8 @@ class G4ParticleTable
|
||||
#ifdef G4MULTITHREADED
|
||||
public:
|
||||
//Andrea Dotti January 16. Shared instance of a mutex
|
||||
static G4Mutex particleTableMutex;
|
||||
static G4int lockCount;
|
||||
static G4GLOB_DLL G4Mutex& particleTableMutex();
|
||||
static G4GLOB_DLL G4int& lockCount();
|
||||
#endif
|
||||
};
|
||||
#include "G4ParticleTable.icc"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryParticle.hh 99159 2016-09-07 08:11:50Z gcosmo $
|
||||
// $Id: G4PrimaryParticle.hh 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -179,20 +179,20 @@ class G4PrimaryParticle
|
||||
|
||||
};
|
||||
|
||||
extern G4PART_DLL G4ThreadLocal G4Allocator<G4PrimaryParticle> *aPrimaryParticleAllocator;
|
||||
extern G4PART_DLL G4Allocator<G4PrimaryParticle>*& aPrimaryParticleAllocator();
|
||||
|
||||
inline void * G4PrimaryParticle::operator new(size_t)
|
||||
{
|
||||
if (!aPrimaryParticleAllocator)
|
||||
if (!aPrimaryParticleAllocator())
|
||||
{
|
||||
aPrimaryParticleAllocator = new G4Allocator<G4PrimaryParticle>;
|
||||
aPrimaryParticleAllocator() = new G4Allocator<G4PrimaryParticle>;
|
||||
}
|
||||
return (void *) aPrimaryParticleAllocator->MallocSingle();
|
||||
return (void *) aPrimaryParticleAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4PrimaryParticle::operator delete(void * aPrimaryParticle)
|
||||
{
|
||||
aPrimaryParticleAllocator->FreeSingle((G4PrimaryParticle *) aPrimaryParticle);
|
||||
aPrimaryParticleAllocator()->FreeSingle((G4PrimaryParticle *) aPrimaryParticle);
|
||||
}
|
||||
|
||||
inline G4double G4PrimaryParticle::GetMass() const
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryVertex.hh 99159 2016-09-07 08:11:50Z gcosmo $
|
||||
// $Id: G4PrimaryVertex.hh 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -102,20 +102,20 @@ class G4PrimaryVertex
|
||||
|
||||
};
|
||||
|
||||
extern G4PART_DLL G4ThreadLocal G4Allocator<G4PrimaryVertex> *aPrimaryVertexAllocator;
|
||||
extern G4PART_DLL G4Allocator<G4PrimaryVertex>*& aPrimaryVertexAllocator();
|
||||
|
||||
inline void * G4PrimaryVertex::operator new(size_t)
|
||||
{
|
||||
if (!aPrimaryVertexAllocator)
|
||||
if (!aPrimaryVertexAllocator())
|
||||
{
|
||||
aPrimaryVertexAllocator = new G4Allocator<G4PrimaryVertex>;
|
||||
aPrimaryVertexAllocator() = new G4Allocator<G4PrimaryVertex>;
|
||||
}
|
||||
return (void *) aPrimaryVertexAllocator->MallocSingle();
|
||||
return (void *) aPrimaryVertexAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4PrimaryVertex::operator delete(void * aPrimaryVertex)
|
||||
{
|
||||
aPrimaryVertexAllocator->FreeSingle((G4PrimaryVertex *) aPrimaryVertex);
|
||||
aPrimaryVertexAllocator()->FreeSingle((G4PrimaryVertex *) aPrimaryVertex);
|
||||
}
|
||||
|
||||
inline G4ThreeVector G4PrimaryVertex::GetPosition() const
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DynamicParticle.cc 98352 2016-07-08 08:21:00Z gcosmo $
|
||||
// $Id: G4DynamicParticle.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -71,7 +71,11 @@
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<G4DynamicParticle> *pDynamicParticleAllocator = 0;
|
||||
G4Allocator<G4DynamicParticle>*& pDynamicParticleAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4DynamicParticle>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
static const G4double EnergyMomentumRelationAllowance = 1.0e-2*keV;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectronOccupancy.cc 79357 2014-02-25 10:06:54Z gcosmo $
|
||||
// $Id: G4ElectronOccupancy.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -40,7 +40,11 @@
|
||||
#include "G4ElectronOccupancy.hh"
|
||||
#include <sstream>
|
||||
|
||||
G4ThreadLocal G4Allocator<G4ElectronOccupancy> *aElectronOccupancyAllocator = 0;
|
||||
G4Allocator<G4ElectronOccupancy>*& aElectronOccupancyAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4ElectronOccupancy>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ElectronOccupancy::G4ElectronOccupancy(G4int sizeOrbit )
|
||||
: theSizeOfOrbit(sizeOrbit)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PDefManager.cc 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
// $Id: G4PDefManager.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -53,8 +53,17 @@ void G4PDefData::initialize()
|
||||
theProcessManager = 0;
|
||||
}
|
||||
|
||||
G4ThreadLocal G4int G4PDefManager::slavetotalspace=0;
|
||||
G4ThreadLocal G4PDefData* G4PDefManager::offset=0;
|
||||
G4int& G4PDefManager::slavetotalspace()
|
||||
{
|
||||
G4ThreadLocalStatic G4int _instance = 0;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4PDefData*& G4PDefManager::offset()
|
||||
{
|
||||
G4ThreadLocalStatic G4PDefData* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4PDefManager::G4PDefManager() : totalobj(0)
|
||||
{
|
||||
@@ -68,7 +77,7 @@ G4int G4PDefManager::CreateSubInstance()
|
||||
{
|
||||
G4AutoLock l(&mutex);
|
||||
totalobj++;
|
||||
if (totalobj > slavetotalspace)
|
||||
if (totalobj > slavetotalspace())
|
||||
{
|
||||
l.unlock();
|
||||
NewSubInstances();
|
||||
@@ -83,53 +92,53 @@ void G4PDefManager::NewSubInstances()
|
||||
// by the subclass.
|
||||
{
|
||||
G4AutoLock l(&mutex);
|
||||
if (slavetotalspace >= totalobj) { return; }
|
||||
G4int originaltotalspace = slavetotalspace;
|
||||
slavetotalspace = totalobj + 512;
|
||||
offset = (G4PDefData *) realloc(offset, slavetotalspace * sizeof(G4PDefData));
|
||||
if (slavetotalspace() >= totalobj) { return; }
|
||||
G4int originaltotalspace = slavetotalspace();
|
||||
slavetotalspace() = totalobj + 512;
|
||||
offset() = (G4PDefData *) realloc(offset(), slavetotalspace() * sizeof(G4PDefData));
|
||||
|
||||
if (offset == 0)
|
||||
if (offset() == 0)
|
||||
{
|
||||
G4Exception("G4PDefManager::NewSubInstances()",
|
||||
"OutOfMemory", FatalException, "Cannot malloc space!");
|
||||
}
|
||||
|
||||
for (G4int i = originaltotalspace; i < slavetotalspace; i++)
|
||||
for (G4int i = originaltotalspace; i < slavetotalspace(); i++)
|
||||
{
|
||||
offset[i].initialize();
|
||||
offset()[i].initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void G4PDefManager::FreeSlave()
|
||||
// Invoked by all threads to free the subinstance array.
|
||||
{
|
||||
if (!offset) { return; }
|
||||
free(offset);
|
||||
offset = 0;
|
||||
if (!offset()) { return; }
|
||||
free(offset());
|
||||
offset() = 0;
|
||||
}
|
||||
|
||||
G4PDefData* G4PDefManager::GetOffset()
|
||||
{
|
||||
return offset;
|
||||
return offset();
|
||||
}
|
||||
|
||||
void G4PDefManager::UseWorkArea( G4PDefData* newOffset )
|
||||
// Use recycled work area, which was created previously.
|
||||
{
|
||||
if( offset && offset!=newOffset )
|
||||
if( offset() && offset()!=newOffset )
|
||||
{
|
||||
G4Exception("G4PDefManager::UseWorkspace()",
|
||||
"InvalidCondition", FatalException,
|
||||
"Thread already has workspace - cannot use another.");
|
||||
}
|
||||
offset= newOffset;
|
||||
offset()= newOffset;
|
||||
}
|
||||
|
||||
G4PDefData* G4PDefManager::FreeWorkArea()
|
||||
// Detach this thread from this Location
|
||||
// The object which calls this method is responsible for it.
|
||||
{
|
||||
G4PDefData* offsetRet= offset;
|
||||
offset= 0;
|
||||
G4PDefData* offsetRet= offset();
|
||||
offset()= 0;
|
||||
return offsetRet;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleDefinition.cc 106143 2017-09-14 06:34:42Z gcosmo $
|
||||
// $Id: G4ParticleDefinition.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -69,61 +69,61 @@ G4PDefManager G4ParticleDefinition::subInstanceManager;
|
||||
// This macro changes the references to fields that are now encapsulated
|
||||
// in the class G4PDefData.
|
||||
//
|
||||
#define G4MT_pmanager ((subInstanceManager.offset[g4particleDefinitionInstanceID]).theProcessManager)
|
||||
#define G4MT_pmanager ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theProcessManager)
|
||||
|
||||
G4ParticleDefinition::G4ParticleDefinition(
|
||||
const G4String& aName,
|
||||
G4double mass,
|
||||
G4double width,
|
||||
G4double charge,
|
||||
G4int iSpin,
|
||||
G4int iParity,
|
||||
G4int iConjugation,
|
||||
G4int iIsospin,
|
||||
G4int iIsospin3,
|
||||
G4int gParity,
|
||||
const G4String& pType,
|
||||
G4int lepton,
|
||||
G4int baryon,
|
||||
G4int encoding,
|
||||
G4bool stable,
|
||||
G4double lifetime,
|
||||
G4DecayTable *decaytable,
|
||||
G4bool shortlived,
|
||||
const G4String& subType,
|
||||
G4int anti_encoding,
|
||||
G4double magneticMoment)
|
||||
const G4String& aName,
|
||||
G4double mass,
|
||||
G4double width,
|
||||
G4double charge,
|
||||
G4int iSpin,
|
||||
G4int iParity,
|
||||
G4int iConjugation,
|
||||
G4int iIsospin,
|
||||
G4int iIsospin3,
|
||||
G4int gParity,
|
||||
const G4String& pType,
|
||||
G4int lepton,
|
||||
G4int baryon,
|
||||
G4int encoding,
|
||||
G4bool stable,
|
||||
G4double lifetime,
|
||||
G4DecayTable *decaytable,
|
||||
G4bool shortlived,
|
||||
const G4String& subType,
|
||||
G4int anti_encoding,
|
||||
G4double magneticMoment)
|
||||
|
||||
: theParticleName(aName),
|
||||
thePDGMass(mass),
|
||||
thePDGWidth(width),
|
||||
thePDGCharge(charge),
|
||||
thePDGiSpin(iSpin),
|
||||
thePDGSpin(iSpin*0.5),
|
||||
thePDGiParity(iParity),
|
||||
thePDGiConjugation(iConjugation),
|
||||
thePDGiGParity(gParity),
|
||||
thePDGiIsospin(iIsospin),
|
||||
thePDGiIsospin3(iIsospin3),
|
||||
thePDGIsospin(iIsospin*0.5),
|
||||
thePDGIsospin3(iIsospin3*0.5),
|
||||
thePDGMagneticMoment(magneticMoment),
|
||||
theLeptonNumber(lepton),
|
||||
theBaryonNumber(baryon),
|
||||
theParticleType(pType),
|
||||
theParticleSubType(subType),
|
||||
thePDGEncoding(encoding),
|
||||
theAntiPDGEncoding(-1*encoding),
|
||||
fShortLivedFlag(shortlived),
|
||||
thePDGStable(stable),
|
||||
thePDGLifeTime(lifetime),
|
||||
theDecayTable(decaytable),
|
||||
theAtomicNumber(0),
|
||||
theAtomicMass(0),
|
||||
verboseLevel(1),
|
||||
fApplyCutsFlag(false),
|
||||
isGeneralIon(false),
|
||||
isMuonicAtom(false)
|
||||
: theParticleName(aName),
|
||||
thePDGMass(mass),
|
||||
thePDGWidth(width),
|
||||
thePDGCharge(charge),
|
||||
thePDGiSpin(iSpin),
|
||||
thePDGSpin(iSpin*0.5),
|
||||
thePDGiParity(iParity),
|
||||
thePDGiConjugation(iConjugation),
|
||||
thePDGiGParity(gParity),
|
||||
thePDGiIsospin(iIsospin),
|
||||
thePDGiIsospin3(iIsospin3),
|
||||
thePDGIsospin(iIsospin*0.5),
|
||||
thePDGIsospin3(iIsospin3*0.5),
|
||||
thePDGMagneticMoment(magneticMoment),
|
||||
theLeptonNumber(lepton),
|
||||
theBaryonNumber(baryon),
|
||||
theParticleType(pType),
|
||||
theParticleSubType(subType),
|
||||
thePDGEncoding(encoding),
|
||||
theAntiPDGEncoding(-1*encoding),
|
||||
fShortLivedFlag(shortlived),
|
||||
thePDGStable(stable),
|
||||
thePDGLifeTime(lifetime),
|
||||
theDecayTable(decaytable),
|
||||
theAtomicNumber(0),
|
||||
theAtomicMass(0),
|
||||
verboseLevel(1),
|
||||
fApplyCutsFlag(false),
|
||||
isGeneralIon(false),
|
||||
isMuonicAtom(false)
|
||||
{
|
||||
static const G4String nucleus("nucleus");
|
||||
static const G4String muAtom("MuonicAtom");
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleTable.cc 106143 2017-09-14 06:34:42Z gcosmo $
|
||||
// $Id: G4ParticleTable.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
// class G4ParticleTable
|
||||
//
|
||||
@@ -89,8 +89,16 @@ G4ParticleTable* G4ParticleTable::fgParticleTable =0;
|
||||
#ifdef G4MULTITHREADED
|
||||
// Lock for particle table accesses.
|
||||
//
|
||||
G4Mutex G4ParticleTable::particleTableMutex = G4MUTEX_INITIALIZER;
|
||||
G4int G4ParticleTable::lockCount = 0;
|
||||
G4Mutex& G4ParticleTable::particleTableMutex()
|
||||
{
|
||||
static G4Mutex _instance = G4MUTEX_INITIALIZER;
|
||||
return _instance;
|
||||
}
|
||||
G4int& G4ParticleTable::lockCount()
|
||||
{
|
||||
static G4int _instance = 0;
|
||||
return _instance;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////
|
||||
@@ -162,8 +170,8 @@ void G4ParticleTable::WorkerG4ParticleTable()
|
||||
// The iterator for the shadow particle table is not sharable.
|
||||
//
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4ParticleTable::lockCount++;
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
|
||||
G4ParticleTable::lockCount()++;
|
||||
#endif
|
||||
if(fDictionary == 0) {
|
||||
fDictionary = new G4PTblDictionary();
|
||||
@@ -189,7 +197,7 @@ void G4ParticleTable::WorkerG4ParticleTable()
|
||||
fIterator = new G4PTblDicIterator( *fDictionary);
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex());
|
||||
#endif
|
||||
|
||||
fIonTable->WorkerG4IonTable();
|
||||
@@ -539,7 +547,7 @@ G4ParticleDefinition* G4ParticleTable::FindParticle(const G4String &particle_nam
|
||||
G4ParticleDefinition* ptcl = 0;
|
||||
if(G4Threading::IsWorkerThread())
|
||||
{
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
|
||||
G4PTblDictionary::iterator its = fDictionaryShadow->find(particle_name);
|
||||
if(its != fDictionaryShadow->end())
|
||||
{
|
||||
@@ -548,7 +556,7 @@ G4ParticleDefinition* G4ParticleTable::FindParticle(const G4String &particle_nam
|
||||
G4int code = ptcl->GetPDGEncoding();
|
||||
if(code!=0) fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
|
||||
}
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex());
|
||||
}
|
||||
return ptcl;
|
||||
#else
|
||||
@@ -590,7 +598,7 @@ G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding )
|
||||
#ifdef G4MULTITHREADED
|
||||
if(particle == 0 && G4Threading::IsWorkerThread())
|
||||
{
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
|
||||
G4PTblEncodingDictionary::iterator its = fEncodingDictionaryShadow->find(aPDGEncoding);
|
||||
if(its!=fEncodingDictionaryShadow->end())
|
||||
{
|
||||
@@ -599,7 +607,7 @@ G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding )
|
||||
G4String key = GetKey(particle);
|
||||
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
|
||||
}
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
|
||||
G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 110104 2018-05-15 11:40:56Z gcosmo $
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 109299 2018-04-10 06:51:21Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryParticle.cc 81373 2014-05-27 13:06:32Z gcosmo $
|
||||
// $Id: G4PrimaryParticle.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4PrimaryParticle.hh"
|
||||
@@ -34,7 +34,11 @@
|
||||
#include "G4ios.hh"
|
||||
#include "G4VUserPrimaryParticleInformation.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<G4PrimaryParticle> *aPrimaryParticleAllocator = 0;
|
||||
G4Allocator<G4PrimaryParticle>*& aPrimaryParticleAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4PrimaryParticle>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4PrimaryParticle::G4PrimaryParticle()
|
||||
:PDGcode(0),G4code(0),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryVertex.cc 99159 2016-09-07 08:11:50Z gcosmo $
|
||||
// $Id: G4PrimaryVertex.cc 110257 2018-05-17 14:20:12Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4PrimaryVertex.hh"
|
||||
@@ -32,7 +32,11 @@
|
||||
#include "G4VUserPrimaryVertexInformation.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<G4PrimaryVertex> *aPrimaryVertexAllocator = 0;
|
||||
G4Allocator<G4PrimaryVertex>*& aPrimaryVertexAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4PrimaryVertex>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4PrimaryVertex::G4PrimaryVertex()
|
||||
:X0(0.),Y0(0.),Z0(0.),T0(0.),theParticle(0),theTail(0),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VDecayChannel.cc 105720 2017-08-16 12:38:10Z gcosmo $
|
||||
// $Id: G4VDecayChannel.cc 108440 2018-02-14 07:35:49Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -76,9 +76,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName, G4int Verbose)
|
||||
rangeMass(2.5),
|
||||
parent_polarization(),
|
||||
particletable(nullptr),
|
||||
verboseLevel(Verbose),
|
||||
daughtersMutex(G4MUTEX_INITIALIZER),
|
||||
parentMutex(G4MUTEX_INITIALIZER)
|
||||
verboseLevel(Verbose)
|
||||
{
|
||||
G4MT_parent = nullptr;
|
||||
G4MT_daughters = nullptr;
|
||||
@@ -106,9 +104,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
|
||||
rangeMass(1.0),
|
||||
parent_polarization(),
|
||||
particletable(0),
|
||||
verboseLevel(1),
|
||||
daughtersMutex(G4MUTEX_INITIALIZER),
|
||||
parentMutex(G4MUTEX_INITIALIZER)
|
||||
verboseLevel(1)
|
||||
{
|
||||
G4MT_parent = nullptr;
|
||||
G4MT_daughters = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user