Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# $Id: GNUmakefile 99159 2016-09-07 08:11:50Z gcosmo $
# ----------------------------------------------------------------
# GNUmakefile for particle management library. G.Cosmo, 4/4/97.
# ----------------------------------------------------------------
@@ -22,3 +22,7 @@ CPPFLAGS += \
include $(G4INSTALL)/config/common.gmk
ifdef G4NucleiProperties_USE_OLD_AME_TABLE
CPPFLAGS += -DG4NucleiProperties_USE_OLD_AME_TABLE
endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DynamicParticle.icc 72152 2013-07-11 12:49:58Z gcosmo $
// $Id: G4DynamicParticle.icc 98352 2016-07-08 08:21:00Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -33,7 +33,6 @@
// History: first implementation, based on object model of
// 17 AUg. 1999 H.Kurashige
// ------------------------------------------------------------
extern G4PART_DLL G4ThreadLocal G4Allocator<G4DynamicParticle> *pDynamicParticleAllocator;
// ------------------------
@@ -145,11 +144,6 @@ inline void G4DynamicParticle::SetMagneticMoment(G4double magneticMoment)
theDynamicalMagneticMoment = magneticMoment;
}
inline void G4DynamicParticle::SetMass(G4double newMass)
{
theDynamicalMass = newMass;
}
inline const G4ThreeVector& G4DynamicParticle::GetMomentumDirection() const
{
return theMomentumDirection;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4IonTable.hh 96314 2016-04-06 07:21:51Z gcosmo $
// $Id: G4IonTable.hh 99621 2016-09-29 10:14:44Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -150,7 +150,8 @@ class G4IonTable
// E: Excitaion energy
// lvl: Isomer Level 0: ground state)
// flb: Floating level base (enum defined in G4Ions.hh)
// flbChar: Floating level base denoted bya character (X,Y,Z,U,V,W)
// flbChar: Floating level base denoted by a character
// (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
// J: Total Angular momentum (in unit of 1/2) : not used
G4ParticleDefinition* GetIon(G4int encoding);
@@ -177,7 +178,8 @@ class G4IonTable
// E: Excitaion energy
// lvl: Isomer Level 0: ground state)
// flb: Floating level base (enum defined in G4Ions.hh)
// flbChar: Floating level base denoted bya character (X,Y,Z,U,V,W)
// flbChar: Floating level base denoted by a character
// (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
// J: Total Angular momentum (in unit of 1/2) : not used
static G4bool IsIon(const G4ParticleDefinition*);
@@ -189,9 +191,9 @@ class G4IonTable
const G4String& GetIonName(G4int Z, G4int A, G4int lvl=0) const;
const G4String& GetIonName(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::noFloat) const;
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const;
const G4String& GetIonName(G4int Z, G4int A, G4int L, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::noFloat) const;
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const;
const G4String& GetIonName(G4int Z, G4int A, G4int L, G4int lvl) const;
// get ion name
@@ -233,7 +235,7 @@ class G4IonTable
G4double GetLifeTime(const G4ParticleDefinition*) const;
G4double GetLifeTime(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::noFloat) const;
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const;
G4double GetLifeTime(G4int Z, G4int A, G4double E, char flbChar) const;
// Returns a life time of an ion. -1 for stable ion, and -1001 for ion
// that is not listed in G4NuclideTable.
@@ -331,6 +333,10 @@ class G4IonTable
private:
G4int n_error;
public:
G4ParticleDefinition* GetMuonicAtom(G4Ions const*);
G4ParticleDefinition* GetMuonicAtom(G4int Z, G4int A);
#ifdef G4MULTITHREADED
public:
static G4Mutex ionTableMutex;
+55 -21
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Ions.hh 96314 2016-04-06 07:21:51Z gcosmo $
// $Id: G4Ions.hh 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -92,7 +92,11 @@ class G4Ions : public G4ParticleDefinition
G4int GetIsomerLevel() const;
// enumerator for floating level base
enum class G4FloatLevelBase { noFloat=0, plus_U, plus_V, plus_W, plus_X, plus_Y, plus_Z };
enum class G4FloatLevelBase
{ no_Float=0,
plus_X, plus_Y, plus_Z, plus_U, plus_V, plus_W,
plus_R, plus_S, plus_T, plus_A, plus_B, plus_C, plus_D, plus_E
};
static G4Ions::G4FloatLevelBase FloatLevelBase(char flbChar);
static G4Ions::G4FloatLevelBase FloatLevelBase(G4int flbIdx);
static char FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb);
@@ -111,12 +115,21 @@ class G4Ions : public G4ParticleDefinition
};
#define noFloat G4Ions::G4FloatLevelBase::no_Float
#define plusU G4Ions::G4FloatLevelBase::plus_U
#define plusV G4Ions::G4FloatLevelBase::plus_V
#define plusW G4Ions::G4FloatLevelBase::plus_W
#define plusX G4Ions::G4FloatLevelBase::plus_X
#define plusY G4Ions::G4FloatLevelBase::plus_Y
#define plusZ G4Ions::G4FloatLevelBase::plus_Z
#define plusR G4Ions::G4FloatLevelBase::plus_R
#define plusS G4Ions::G4FloatLevelBase::plus_S
#define plusT G4Ions::G4FloatLevelBase::plus_T
#define plusA G4Ions::G4FloatLevelBase::plus_A
#define plusB G4Ions::G4FloatLevelBase::plus_B
#define plusC G4Ions::G4FloatLevelBase::plus_C
#define plusD G4Ions::G4FloatLevelBase::plus_D
#define plusE G4Ions::G4FloatLevelBase::plus_E
inline
G4Ions* G4Ions::IonsDefinition()
@@ -175,18 +188,9 @@ inline
inline
G4Ions::G4FloatLevelBase G4Ions::FloatLevelBase(char flbChar)
{
G4Ions::G4FloatLevelBase flb = G4FloatLevelBase::noFloat;
G4Ions::G4FloatLevelBase flb = noFloat;
switch(flbChar)
{
case 'u': case 'U':
flb = plusU;
break;
case 'v': case 'V':
flb = plusV;
break;
case 'w': case 'W':
flb = plusW;
break;
case 'x': case 'X':
flb = plusX;
break;
@@ -196,7 +200,40 @@ inline
case 'z': case 'Z':
flb = plusZ;
break;
default:
case 'u': case 'U':
flb = plusU;
break;
case 'v': case 'V':
flb = plusV;
break;
case 'w': case 'W':
flb = plusW;
break;
case 'r': case 'R':
flb = plusR;
break;
case 's': case 'S':
flb = plusS;
break;
case 't': case 'T':
flb = plusT;
break;
case 'a': case 'A':
flb = plusA;
break;
case 'b': case 'B':
flb = plusB;
break;
case 'c': case 'C':
flb = plusC;
break;
case 'd': case 'D':
flb = plusD;
break;
case 'e': case 'E':
flb = plusE;
break;
case '\0': default:
break;
}
return flb;
@@ -206,20 +243,17 @@ inline
G4Ions::G4FloatLevelBase G4Ions::FloatLevelBase(G4int flbIdx)
{
static G4Ions::G4FloatLevelBase flb[] =
{ G4FloatLevelBase::noFloat,
G4FloatLevelBase::plus_U,
G4FloatLevelBase::plus_V,
G4FloatLevelBase::plus_W,
G4FloatLevelBase::plus_X,
G4FloatLevelBase::plus_Y,
G4FloatLevelBase::plus_Z };
{ noFloat,
plusU, plusV, plusW, plusX, plusY, plusZ,
plusR, plusS, plusT, plusA, plusB, plusC, plusD, plusE };
return flb[flbIdx];
}
inline
char G4Ions::FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb)
{
static char flbChar[] = {'\0','U','V','W','X','Y','Z'};
static char flbChar[] = {'\0','X','Y','Z','U','V','W',
'R','S','T','A','B','C','D','E'};
return flbChar[static_cast<G4int>(flb)];
}
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtom.hh 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation,
// July 2016, K. Lynch
#ifndef G4MuonicAtom_h
#define G4MuonicAtom_h 1
#include "G4Ions.hh"
class G4MuonicAtom : public G4Ions
{
public:
G4MuonicAtom(
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 =""
);
};
#endif
@@ -0,0 +1,39 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomDIODecayChannel.hh 96314 2016-04-06 07:21:51Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 17 October 16 K.Lynch
// ------------------------------------------------------------
#ifndef G4MuonicAtomDIODecayChannel_h
#define G4MuonicAtomDIODecayChannel_h 1
#endif
@@ -0,0 +1,46 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomHelper.hh 96314 2016-04-06 07:21:51Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 1 July 16 K.Lynch
// ------------------------------------------------------------
#ifndef G4MuonicAtomHelper_h
#define G4MuonicAtomHelper_h 1
#include "G4MuonicAtom.hh"
#include "G4Ions.hh"
class G4MuonicAtomHelper {
public:
static G4MuonicAtom* ConstructMuonicAtom(G4String name, G4int encoding, G4Ions const* baseion);
};
#endif
@@ -0,0 +1,39 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomNuclearCaptureChannel.hh 96314 2016-04-06 07:21:51Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 17 October 16 K.Lynch
// ------------------------------------------------------------
#ifndef G4MuonicAtomNuclearCaptureChannel_h
#define G4MuonicAtomNuclearCaptureChannel_h 1
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NucleiProperties.hh 67971 2013-03-13 10:13:24Z gcosmo $
// $Id: G4NucleiProperties.hh 99159 2016-09-07 08:11:50Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -43,9 +43,6 @@
#include "globals.hh"
#include "G4ios.hh"
#include "G4NucleiPropertiesTableAME03.hh"
#include "G4NucleiPropertiesTheoreticalTable.hh"
#include "G4ParticleTable.hh"
class G4NucleiProperties
{
@@ -59,7 +56,7 @@ public:
~G4NucleiProperties() { };
// Default constructor ()
G4NucleiProperties(){};
G4NucleiProperties() { };
public: // With Description
@@ -81,6 +78,9 @@ public: // With Description
static G4double GetMassExcess(const G4int A, const G4int Z);
static G4double GetMassExcess(const G4double A, const G4double Z);
//Swich AME table in use
static void UseOldAMETable( G4bool val = true );
private:
// hidie methods to enforce using GetNuclearMass
// Give mass of Atom A,Z
@@ -109,6 +109,7 @@ private:
static G4ThreadLocal G4double mass_triton;
static G4ThreadLocal G4double mass_alpha;
static G4ThreadLocal G4double mass_He3;
static G4bool use_old_evaluation;
};
@@ -0,0 +1,148 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4NucleiPropertiesTableAME12.hh 72955 2013-08-14 14:23:14Z gcosmo $
//
// -------------------------------------------------------------------
//
// File name: G4NucleiPropertiesTableAME12.cc
//
// Authors: Tatsumi Koi (tkoi@slac.stanford.edu)
//
// Data are update to AME2012
// "The Ame2012 atomic mass evaluation (I)"
// by G.Audi, M.Wang, A.H.Wapstra, F.G.Kondev, M.MacCormick, X.Xu, and B.~Pfeiffer
// Chinese Physics C36 p. 1287-1602, December 2012.
// "The Ame2012 atomic mass evaluation (II)"
// by M.Wang, G.Audi, A.H.Wapstra, F.G.Kondev, M.MacCormick, X.Xu, and B.~Pfeiffer
// Chinese Physics C36 p. 1603-2014, December 2012.
//
// Creation date: Aug. 2016
// based on G4NucleiPropertiesTableAME03
//
// Modifications:
//
#ifndef G4NucleiPropertiesTableAME12_h
#define G4NucleiPropertiesTableAME12_h 1
#include <cmath>
#include "globals.hh"
//
class G4NucleiProperties;
class G4NucleiPropertiesTableAME12
{
private:
// Default constructor - this class should exist only once!
G4NucleiPropertiesTableAME12();
public:
// Destructor (generated)
~G4NucleiPropertiesTableAME12() { };
// Following values migrate to AME12
enum {nEntries = 3353,MaxA = 295, ZMax = 120};
// Other Operations
// all methods are private and can be used only by G4NucleiProperties
friend class G4NucleiProperties;
private:
// Operation: GetMassExcess
// values imported from The Ame2003 atomic mass evaluation (II)
static G4double GetMassExcess(G4int Z, G4int A);
// Operation: GetAtomicMass .. in Geant4 Energy units!
// Atomic_Mass = MassExcess + A*amu_c2
static G4double GetAtomicMass(G4int Z, G4int A);
// Operation: GetNuclearMass
// Nuclear_Mass = Atomic_Mass - electronMass
static G4double GetNuclearMass(G4int Z, G4int A);
// Operation: GetBindingEnergy
static G4double GetBindingEnergy(G4int Z, G4int A);
// Operation: GetBetaDecayEnergy
static G4double GetBetaDecayEnergy(G4int Z, G4int A);
// Is the nucleus (A,Z) in table?
static G4bool IsInTable(G4int Z, G4int A);
static G4int MaxZ(G4int A);
static G4int MinZ(G4int A);
private:
// Operation: GetIndex
static G4int GetIndex(G4int Z, G4int A);
// Data Members for Class Attributes
//----------------------------------
// The following arrays are static for allow inicialization.
// The inicialization is Done in G4NucleiPropertiesTableAME12.cc
// Mass Excess
static const G4double MassExcess[nEntries];
// Beta Decay Energy
static const G4double BetaEnergy[nEntries];
// Table of Z (number of protons) and A (number of nucleons)
// indexArray[0][ ] --> Z
// indexArray[1][ ] --> A
static const G4int indexArray[2][nEntries];
// Reduced Table of A for shorter index search.
// The index in this table coincide with A-1
// For each A value shortTable[A-1] has the index of the 1st occurrence in
// the indexArray[][]
static const G4int shortTable[MaxA+1];
// electrom mass
static G4ThreadLocal G4double electronMass[ZMax];
static G4ThreadLocal G4bool isIntialized;
};
#endif
@@ -94,6 +94,7 @@ public:
void AddState(G4int,G4int,G4double,G4double,G4int ionJ=0,G4double ionMu=0.0);
void AddState(G4int,G4int,G4double,G4int,G4double,G4int ionJ=0,G4double ionMu=0.0);
void AddState(G4int,G4int,G4double,G4Ions::G4FloatLevelBase,G4double,G4int ionJ=0,G4double ionMu=0.0);
//G4bool Exists(G4double,G4double,G4double);
@@ -107,7 +108,7 @@ public:
// with description
//
virtual G4IsotopeProperty* GetIsotope(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::noFloat);
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float);
virtual G4IsotopeProperty* GetIsotopeByIsoLvl(G4int Z, G4int A, G4int lvl=0);
//
// again it will replace the pure virtual one in the abstract base class.
@@ -165,6 +166,7 @@ private:
private:
G4double StripFloatLevelBase(G4double E, G4int& flbIndex);
G4Ions::G4FloatLevelBase StripFloatLevelBase( G4String );
};
inline
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PDefManager.hh 101112 2016-11-07 08:19:33Z gcosmo $
//
//
// ------------------------------------------------------------
//
// GEANT 4 class header file
//
// ---------------- G4PDefManager ----------------
//
// Utility template class for splitting RW data for thread-safety from
// classes: G4ParticleDefinition, G4VDecayChannel.
//
// ------------------------------------------------------------
// History:
// 01.25.2009 Xin Dong: First implementation from automatic MT conversion.
// ------------------------------------------------------------
#ifndef G4PDefManager_HH
#define G4PDefManager_HH
#include <stdlib.h>
#include "globals.hh"
#include "pwdefs.hh"
#include "G4AutoLock.hh"
class G4ProcessManager;
// G4PDefData is the private data from the object to be split
class G4PDefData
{
// Encapsulates the fields of the class G4ParticleDefinition
// that may not be read-only.
public:
void initialize();
G4ProcessManager *theProcessManager;
};
// The type G4PDefManager is introduced to encapsulate the methods used by
// both the master thread and worker threads to allocate memory space for
// the fields encapsulated by the class G4PDefData. When each thread
// changes the value for these fields, it refers to them using a macro
// definition defined below. For every G4ParticleDefinition instance,
// there is a corresponding G4PDefData instance. All G4PDefData instances
// are organized by the class G4PDefManager as an array.
// The field "int g4particleDefinitionInstanceID" is added to the class G4ParticleDefinition.
// The value of this field in each G4ParticleDefinition instance is the
// subscript of the corresponding G4PDefData instance.
// In order to use the class G4PDefManager, we add a static member in the class
// G4ParticleDefinition as follows: "static G4PDefManager subInstanceManager".
// Both the master thread and worker threads change the length of the array
// for G4PDefData instances mutually along with G4ParticleDefinition
// instances are created. For each worker thread, it dynamically creates ions.
// Consider any thread A, if there is any other thread which creates an ion.
// This ion is shared by the thread A. So the thread A leaves an empty space
// in the array of G4PDefData instances for the ion.
//
class G4PDefManager
{
public:
G4PDefManager();
G4int CreateSubInstance();
// Invoked by the master or work thread to create a new subinstance
// whenever a new split class instance is created. For each worker
// thread, ions are created dynamically.
void NewSubInstances();
// Invoked by each worker thread to grow the subinstance array and
// initialize each new subinstance using a particular method defined
// by the subclass.
void FreeSlave();
// Invoked by all threads to free the subinstance array.
G4PDefData* GetOffset();
void UseWorkArea( G4PDefData* newOffset ); // , G4int numObjects, G4int numSpace)
G4PDefData* FreeWorkArea(); // G4int* numObjects, G4int* numSpace)
public:
G4PART_DLL G4ThreadLocalStatic G4int slavetotalspace;
G4PART_DLL G4ThreadLocalStatic G4PDefData* offset;
private:
G4int totalobj;
G4Mutex mutex;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.hh 79342 2014-02-24 11:42:42Z gcosmo $
// $Id: G4ParticleDefinition.hh 101025 2016-11-04 08:36:30Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -59,55 +59,16 @@
#include "globals.hh"
#include "G4ios.hh"
#include "G4PDefSplitter.hh"
#include "G4PDefManager.hh"
class G4ProcessManager;
class G4DecayTable;
class G4ParticleTable;
class G4ParticlePropertyTable;
class G4PDefData
{
// Encapsulates the fields of the class G4ParticleDefinition
// that may not be read-only.
public:
void initialize()
{
theProcessManager = 0;
}
G4ProcessManager *theProcessManager;
};
// The type G4PDefManager is introduced to encapsulate the methods used by
// both the master thread and worker threads to allocate memory space for
// the fields encapsulated by the class G4PDefData. When each thread
// changes the value for these fields, it refers to them using a macro
// definition defined below. For every G4ParticleDefinition instance,
// there is a corresponding G4PDefData instance. All G4PDefData instances
// are organized by the class G4PDefManager as an array.
// The field "int g4particleDefinitionInstanceID" is added to the class G4ParticleDefinition.
// The value of this field in each G4ParticleDefinition instance is the
// subscript of the corresponding G4PDefData instance.
// In order to use the class G4PDefManager, we add a static member in the class
// G4ParticleDefinition as follows: "static G4PDefManager subInstanceManager".
// Both the master thread and worker threads change the length of the array
// for G4PDefData instances mutually along with G4ParticleDefinition
// instances are created. For each worker thread, it dynamically creates ions.
// Consider any thread A, if there is any other thread which creates an ion.
// This ion is shared by the thread A. So the thread A leaves an empty space
// in the array of G4PDefData instances for the ion.
//
typedef G4PDefSplitter<G4PDefData> G4PDefManager;
//typedef G4PDefSplitter<G4PDefData> G4PDefManager;
typedef G4PDefManager G4ParticleDefinitionSubInstanceManager;
// This macro changes the references to fields that are now encapsulated
// in the class G4PDefData.
//
#define G4MT_pmanager ((subInstanceManager.offset[g4particleDefinitionInstanceID]).theProcessManager)
class G4ParticleDefinition
{
// Class Description:
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.icc 92918 2015-09-21 15:04:01Z gcosmo $
// $Id: G4ParticleDefinition.icc 99391 2016-09-20 13:32:30Z gcosmo $
//
inline
@@ -92,13 +92,6 @@ inline
return verboseLevel;
}
inline
G4ProcessManager* G4ParticleDefinition::GetProcessManager() const
{
if(g4particleDefinitionInstanceID<0) return 0;
return G4MT_pmanager;
}
inline
G4ProcessManager* G4ParticleDefinition::GetMasterProcessManager() const
{
@@ -54,6 +54,7 @@
class G4ParticlesWorkspace
{
public:
typedef G4TWorkspacePool<G4ParticlesWorkspace> pool_type;
G4ParticlesWorkspace(G4bool verbose=false);
~G4ParticlesWorkspace();
@@ -69,18 +70,22 @@ class G4ParticlesWorkspace
G4bool GetVerbose() { return fVerbose; }
static pool_type* GetPool();
protected: // Implementation methods
void InitialiseParticles();
private: // Helper pointers - can be per instance or shared
G4PDefManager *fpPDefSIM;
private:
// Helper pointer - can be per instance or shared
G4PDefManager *fpPDefSIM;
// Per Instance variables
// NOTE: the ownership of the Data Arrays is IN this object
private:
// Store SubInstanceManager object pointers (SIM pointers)
G4PDefData *fpPDefOffset;
G4bool fVerbose;
G4bool fVerbose;
};
#endif //G4PARTICLESWORKSPACE_HH
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.hh 67971 2013-03-13 10:13:24Z gcosmo $
// $Id: G4PrimaryParticle.hh 99159 2016-09-07 08:11:50Z gcosmo $
//
//
@@ -136,6 +136,7 @@ class G4PrimaryParticle
G4double GetPz() const;
G4PrimaryParticle * GetNext() const;
void SetNext(G4PrimaryParticle * np);
void ClearNext();
G4PrimaryParticle * GetDaughter() const;
void SetDaughter(G4PrimaryParticle * np);
G4int GetTrackID() const;
@@ -301,6 +302,11 @@ inline void G4PrimaryParticle::SetNext(G4PrimaryParticle * np)
else { nextParticle->SetNext(np); }
}
inline void G4PrimaryParticle::ClearNext()
{
nextParticle = nullptr;
}
inline void G4PrimaryParticle::SetDaughter(G4PrimaryParticle * np)
{
if(daughterParticle == 0) { daughterParticle = np; }
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.hh 67971 2013-03-13 10:13:24Z gcosmo $
// $Id: G4PrimaryVertex.hh 99159 2016-09-07 08:11:50Z gcosmo $
//
//
@@ -78,6 +78,7 @@ class G4PrimaryVertex
void SetPrimary(G4PrimaryParticle * pp);
G4PrimaryParticle* GetPrimary(G4int i=0) const;
void SetNext(G4PrimaryVertex* nv);
void ClearNext();
G4PrimaryVertex* GetNext() const;
G4double GetWeight() const;
void SetWeight(G4double w);
@@ -149,7 +150,6 @@ inline void G4PrimaryVertex::SetPrimary(G4PrimaryParticle * pp)
numberOfParticle++;
}
inline void G4PrimaryVertex::SetNext(G4PrimaryVertex* nv)
{
if(nextVertex == 0) { nextVertex = nv; }
@@ -157,6 +157,12 @@ inline void G4PrimaryVertex::SetNext(G4PrimaryVertex* nv)
tailVertex = nv;
}
inline void G4PrimaryVertex::ClearNext()
{
nextVertex = nullptr;
tailVertex = nullptr;
}
inline G4PrimaryVertex* G4PrimaryVertex::GetNext() const
{ return nextVertex; }
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VIsotopeTable.hh 96314 2016-04-06 07:21:51Z gcosmo $
// $Id: G4VIsotopeTable.hh 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -64,7 +64,7 @@ class G4VIsotopeTable
public: // With Description
// pure virtual method
virtual G4IsotopeProperty* GetIsotope(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::noFloat)=0;
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0;
virtual G4IsotopeProperty* GetIsotopeByIsoLvl(G4int Z, G4int A, G4int level=0);
// Search the isotope in the G4VIsotopeTable.
// The isotope is desingated by
+30 -12
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 94332 2015-11-12 09:56:46Z gcosmo $
# $Id: sources.cmake 101025 2016-11-04 08:36:30Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -48,14 +48,19 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4MuonDecayChannel.hh
G4MuonDecayChannelWithSpin.hh
G4MuonRadiativeDecayChannelWithSpin.hh
G4MuonicAtom.hh
G4MuonicAtomDIODecayChannel.hh
G4MuonicAtomHelper.hh
G4MuonicAtomNuclearCaptureChannel.hh
G4NeutronBetaDecayChannel.hh
G4NucleiProperties.hh
G4NucleiPropertiesTableAME03.hh
G4NucleiPropertiesTableAME12.hh
G4NucleiPropertiesTheoreticalTable.hh
G4NuclideTable.hh
G4NuclideTableMessenger.hh
G4NuclideTable.hh
G4NuclideTableMessenger.hh
G4PDGCodeChecker.hh
G4PDefSplitter.hh
G4PDefManager.hh
G4ParticleDefinition.hh
G4ParticleDefinition.icc
G4ParticleMessenger.hh
@@ -79,7 +84,7 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4VUserPrimaryParticleInformation.hh
G4VUserPrimaryVertexInformation.hh
pwdefs.hh
SOURCES
SOURCES
G4DalitzDecayChannel.cc
G4DecayProducts.cc
G4DecayTable.cc
@@ -93,15 +98,21 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4KL3DecayChannel.cc
G4MuonDecayChannel.cc
G4MuonDecayChannelWithSpin.cc
G4MuonicAtom.cc
G4MuonicAtomDIODecayChannel.cc
G4MuonicAtomHelper.cc
G4MuonicAtomNuclearCaptureChannel.cc
G4MuonRadiativeDecayChannelWithSpin.cc
G4NeutronBetaDecayChannel.cc
G4NucleiProperties.cc
G4NucleiPropertiesTableAME03.cc
G4NucleiPropertiesTableAME12.cc
G4NucleiPropertiesTheoreticalTableA.cc
G4NucleiPropertiesTheoreticalTableB.cc
G4NuclideTable.cc
G4NuclideTableMessenger.cc
G4NuclideTable.cc
G4NuclideTableMessenger.cc
G4PDGCodeChecker.cc
G4PDefManager.cc
G4ParticleDefinition.cc
G4ParticleMessenger.cc
G4ParticlePropertyData.cc
@@ -118,18 +129,25 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4VIsotopeTable.cc
G4VUserPrimaryParticleInformation.cc
G4VUserPrimaryVertexInformation.cc
GRANULAR_DEPENDENCIES
GRANULAR_DEPENDENCIES
G4geometrymng
G4globman
G4intercoms
G4materials
GLOBAL_DEPENDENCIES
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4intercoms
G4materials
LINK_LIBRARIES
)
LINK_LIBRARIES
)
# List any source specific properties here
if("$ENV{G4NucleiProperties_USE_OLD_AME_TABLE}")
set_source_files_properties(
${G4partman_SOURCES}
PROPERTIES COMPILE_DEFINITIONS G4NucleiProperties_USE_OLD_AME_TABLE
)
endif()
# List any source specific properties here
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DynamicParticle.cc 81373 2014-05-27 13:06:32Z gcosmo $
// $Id: G4DynamicParticle.cc 98352 2016-07-08 08:21:00Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -73,7 +73,7 @@
G4ThreadLocal G4Allocator<G4DynamicParticle> *pDynamicParticleAllocator = 0;
static const G4double EnergyMomentumRelationAllowance = keV;
static const G4double EnergyMomentumRelationAllowance = 1.0e-2*keV;
////////////////////
G4DynamicParticle::G4DynamicParticle():
@@ -126,7 +126,7 @@ G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefin
theParticleDefinition(aParticleDefinition),
theKineticEnergy(aKineticEnergy),
theProperTime(0.0),
theDynamicalMass(dynamicalMass),
theDynamicalMass(aParticleDefinition->GetPDGMass()),
theDynamicalCharge(aParticleDefinition->GetPDGCharge()),
theDynamicalSpin(aParticleDefinition->GetPDGSpin()),
theDynamicalMagneticMoment(aParticleDefinition->GetPDGMagneticMoment()),
@@ -137,6 +137,10 @@ G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefin
primaryParticle(0),
thePDGcode(0)
{
if (std::abs(theDynamicalMass-dynamicalMass)> EnergyMomentumRelationAllowance) {
if (dynamicalMass>EnergyMomentumRelationAllowance) theDynamicalMass= dynamicalMass;
else theDynamicalMass= 0.0;
}
}
////////////////////
@@ -201,13 +205,18 @@ G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefin
G4double pModule2 = aParticleMomentum.mag2();
if (pModule2>0.0) {
G4double mass2 = totalEnergy*totalEnergy - pModule2;
if(mass2 < EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance) {
G4double PDGmass2 = (aParticleDefinition->GetPDGMass())*(aParticleDefinition->GetPDGMass());
SetMomentumDirection(aParticleMomentum.unit());
if (mass2 < EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance) {
theDynamicalMass = 0.;
SetMomentumDirection(aParticleMomentum.unit());
SetKineticEnergy(totalEnergy);
} else {
if (std::abs(PDGmass2-mass2)>EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance){
theDynamicalMass = std::sqrt(mass2);
SetMomentum(aParticleMomentum);
SetKineticEnergy(totalEnergy-theDynamicalMass);
} else {
SetKineticEnergy(totalEnergy-theDynamicalMass);
}
}
} else {
SetMomentumDirection(1.0,0.0,0.0);
@@ -380,13 +389,13 @@ void G4DynamicParticle::Set4Momentum(const G4LorentzVector &momentum )
SetMomentumDirection(momentum.vect().unit());
G4double totalenergy = momentum.t();
G4double mass2 = totalenergy*totalenergy - pModule2;
if(mass2 < EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance) {
G4double PDGmass2 = (theParticleDefinition->GetPDGMass())*(theParticleDefinition->GetPDGMass());
if (mass2 < EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance) {
theDynamicalMass = 0.;
SetKineticEnergy(totalenergy);
} else {
} else if (std::abs(PDGmass2-mass2)>EnergyMomentumRelationAllowance*EnergyMomentumRelationAllowance){
theDynamicalMass = std::sqrt(mass2);
SetKineticEnergy(totalenergy-theDynamicalMass);
}
SetKineticEnergy(totalenergy-theDynamicalMass);
} else {
SetMomentumDirection(1.0,0.0,0.0);
SetKineticEnergy(0.0);
@@ -431,7 +440,14 @@ void G4DynamicParticle::DumpInfo(G4int) const
return;
}
#endif
///////////////////////
//
void G4DynamicParticle::SetMass(G4double newMass)
{
if(std::abs(newMass-theParticleDefinition->GetPDGMass())>EnergyMomentumRelationAllowance*0.1) {
theDynamicalMass = newMass;
}
}
////////////////////////
G4double G4DynamicParticle::GetElectronMass() const
{
+115 -24
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4IonTable.cc 96797 2016-05-09 10:13:42Z gcosmo $
// $Id: G4IonTable.cc 99621 2016-09-29 10:14:44Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -43,6 +43,7 @@
// New design using G4VIsotopeTable 5 Oct. 99 H.Kurashige
// Modified Element Name for Z>103 06 Apr. 01 H.Kurashige
// Remove test of cuts in SetCuts 16 Jan 03 V.Ivanchenko
// Added initial support for Muonic Atoms 1 Jul 16 K.Lynch
#include <iostream>
#include <iomanip>
@@ -65,6 +66,9 @@
#include "G4VIsotopeTable.hh"
#include "G4NuclideTable.hh"
#include "G4MuonicAtom.hh"
#include "G4MuonicAtomHelper.hh"
// It is very important for multithreaded Geant4 to keep only one copy of the
// particle table pointer and the ion table pointer. However, we try to let
// each worker thread hold its own copy of the particle dictionary and the
@@ -78,19 +82,19 @@ G4IonTable::G4IonList* G4IonTable::fIonListShadow = 0;
std::vector<G4VIsotopeTable*> *G4IonTable::fIsotopeTableListShadow = 0;
namespace lightions {
static const G4ParticleDefinition* p_proton=0;
static const G4ParticleDefinition* p_deuteron=0;
static const G4ParticleDefinition* p_triton=0;
static const G4ParticleDefinition* p_alpha=0;
static const G4ParticleDefinition* p_He3=0;
void Init() {
if ( p_proton ) return;
p_proton = G4ParticleTable::GetParticleTable()-> FindParticle("proton"); // proton
p_deuteron = G4ParticleTable::GetParticleTable()-> FindParticle("deuteron"); // deuteron
p_triton = G4ParticleTable::GetParticleTable()-> FindParticle("triton"); // tritoon
p_alpha = G4ParticleTable::GetParticleTable()-> FindParticle("alpha"); // alpha
p_He3 = G4ParticleTable::GetParticleTable()-> FindParticle("He3"); // He3
}
static const G4ParticleDefinition* p_proton=0;
static const G4ParticleDefinition* p_deuteron=0;
static const G4ParticleDefinition* p_triton=0;
static const G4ParticleDefinition* p_alpha=0;
static const G4ParticleDefinition* p_He3=0;
void Init() {
if ( p_proton ) return;
p_proton = G4ParticleTable::GetParticleTable()-> FindParticle("proton"); // proton
p_deuteron = G4ParticleTable::GetParticleTable()-> FindParticle("deuteron"); // deuteron
p_triton = G4ParticleTable::GetParticleTable()-> FindParticle("triton"); // tritoon
p_alpha = G4ParticleTable::GetParticleTable()-> FindParticle("alpha"); // alpha
p_He3 = G4ParticleTable::GetParticleTable()-> FindParticle("He3"); // He3
}
}
namespace antilightions {
@@ -289,7 +293,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E,
G4ExceptionDescription ed;
ed << "G4IonTable::CreateIon() : G4IsotopeProperty object was not found for"
<< " Z = " << Z << " A = " << A << " E = " << E/keV << " (keV)";
if(flb!=G4Ions::G4FloatLevelBase::noFloat)
if(flb!=G4Ions::G4FloatLevelBase::no_Float)
{ ed << " FloatingLevel +" << G4Ions::FloatLevelBaseChar(flb); }
ed << ".\n"
<< " Physics quantities such as life are not set for this ion.";
@@ -307,7 +311,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E,
// ion name
G4String name ="";
/////////////if (lvl<9) name = GetIonName(Z, A, lvl);
if (lvl==0) name = GetIonName(Z, A, lvl);
if (lvl==0 && flb==G4Ions::G4FloatLevelBase::no_Float) name = GetIonName(Z, A, lvl);
else name = GetIonName(Z, A, Eex, flb);
// PDG encoding
@@ -469,7 +473,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4int LL, G4double
////////////////////////////////
G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4int lvl)
{
if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::noFloat);
if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
G4Exception( "G4IonTable::CreateIon()","PART105", JustWarning,
"Ion cannot be created by an isomer level. Use excitation energy.");
return 0;
@@ -480,7 +484,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4int lvl)
G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4int LL, G4int lvl)
{
if (LL==0) return CreateIon(Z,A,lvl);
if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::noFloat);
if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
if (lvl>0) {
G4ExceptionDescription ed;
@@ -594,7 +598,7 @@ G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int LL, G4int lvl)
////////////////////
G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4double E, G4int J)
{ return GetIon(Z,A,E,G4Ions::G4FloatLevelBase::noFloat,J); }
{ return GetIon(Z,A,E,G4Ions::G4FloatLevelBase::no_Float,J); }
////////////////////
G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4double E,
@@ -642,7 +646,7 @@ G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4double E,
////////////////////
G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int LL, G4double E, G4int J)
{ return GetIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::noFloat,J); }
{ return GetIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::no_Float,J); }
////////////////////
G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int LL, G4double E,
@@ -724,7 +728,7 @@ G4ParticleDefinition* G4IonTable::GetIon(G4int encoding)
// -- FindIon methods ------
/////////////////////
G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4double E, G4int J)
{ return FindIon(Z,A,E,G4Ions::G4FloatLevelBase::noFloat,J); }
{ return FindIon(Z,A,E,G4Ions::G4FloatLevelBase::no_Float,J); }
////////////////////
G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4double E,
@@ -785,7 +789,7 @@ G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4double E,
////////////////////
G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4int LL, G4double E, G4int J)
{ return FindIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::noFloat,J); }
{ return FindIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::no_Float,J); }
////////////////////
G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4int LL, G4double E,
@@ -1056,12 +1060,12 @@ const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4double E,
name = GetIonName(Z, A);
//excited energy
if ( E>0 ){
if ( E>0 || flb!=G4Ions::G4FloatLevelBase::no_Float){
os->str("");
std::ostringstream& oo = *os;
// Excited nucleus
oo<<'['<<E/keV;
if(flb!=G4Ions::G4FloatLevelBase::noFloat)
if(flb!=G4Ions::G4FloatLevelBase::no_Float)
{ oo<<G4Ions::FloatLevelBaseChar(flb); }
oo<< ']';
name += os->str();
@@ -1863,6 +1867,93 @@ G4double G4IonTable::GetLifeTime(G4int Z, G4int A, G4double E,
}
////////////////////
G4ParticleDefinition* G4IonTable::GetMuonicAtom(G4Ions const* base)
{
if (base==0 || !IsIon(base))
G4Exception("G4IonTable::GetMuonicAtom()", "PART987654321",FatalException,"Constructor argument is not a G4Ions");
// We're assuming here that we get a base that is actually
// constructed and unexcited ... strip excitations, Lambdas, and
// isomers from the encoding
auto const Z = base->GetAtomicNumber();
auto const A = base->GetAtomicMass();
auto const baseenc = GetNucleusEncoding(Z,A);
auto const encoding = baseenc+1000000000;
// We have to do all the MT manipulations manually, because the
// convenience functions assume a G4Ions with canonical PDG codes;
// they recalculate the encoding from particle properties rather
// than using the carried member function values. Thus, they will
// do operations on the base ion, rather than the passed in
// G4MuonicAtom
auto i = fIonList->find(encoding);
if(i!=fIonList->end()){
return const_cast<G4ParticleDefinition*>(i->second);
}
// not in threadlocal list; check global list ...
#ifdef G4MULTITHREADED
if(G4Threading::IsWorkerThread()){
G4MUTEXLOCK(&G4IonTable::ionTableMutex);
i = fIonListShadow->find(encoding);
auto end = fIonListShadow->end();
G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
if(i!=end){
// we found it, stuff it into the threadlocal list
fIonList->insert(*i);
// and then return it ...
return const_cast<G4ParticleDefinition*>(i->second);
}
}
#endif
// not found in either list; create and potentially insert
auto const name = "Mu"+GetIonName(Z,A);
G4MuonicAtom* muatom =
G4MuonicAtomHelper::ConstructMuonicAtom(name, encoding, base);
// Not sure this is doing the right thing...
AddProcessManager(muatom);
// Now, we have to push the muatom into the appropriate IonTables
// first, recheck global list, in case another thread came along
// before us and created this same muatom
#ifdef G4MULTITHREADED
if(G4Threading::IsWorkerThread()){
G4MUTEXLOCK(&G4IonTable::ionTableMutex);
// first, we need to make sure it hasn't been inserted by some
// other thread
auto j = fIonListShadow->find(encoding);
if( j!= fIonListShadow->end() ){
// oops ... someone else built a copy when we weren't looking;
// cleanup our instantiation, and take a handle to the one in
// the global list
delete muatom;
muatom = const_cast<G4MuonicAtom*>(static_cast<G4MuonicAtom const*>(j->second));
} else {
// otherwise, push onto the global list first
fIonListShadow->insert(std::make_pair(encoding, muatom));
}
G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
}
#endif
// in either case, push onto the the threadlocal list
fIonList->insert(std::make_pair(encoding,muatom));
return muatom;
}
////////////////////
G4ParticleDefinition* G4IonTable::GetMuonicAtom(G4int Z, G4int A)
{
// Need the cast because we need a G4Ions* to pass into the
// function, but GetIon returns a G4ParticleDefinition*
auto base = static_cast<G4Ions const*>(GetIon(Z,A, 0.0));
return GetMuonicAtom(base);
}
+2 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Ions.cc 96314 2016-04-06 07:21:51Z gcosmo $
// $Id: G4Ions.cc 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// ----------------------------------------------------------------------
@@ -66,7 +66,7 @@ G4Ions::G4Ions(
shortlived, subType, anti_encoding),
theExcitationEnergy(excitation),
theIsomerLevel(isomer),
floatLevelBase(G4FloatLevelBase::noFloat)
floatLevelBase(G4FloatLevelBase::no_Float)
{
if ((aName == "proton") || (aName == "neutron")) {
isGeneralIon = false ;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4IsotopeProperty.cc 96314 2016-04-06 07:21:51Z gcosmo $
// $Id: G4IsotopeProperty.cc 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// ----------------------------------------------------------------------
@@ -51,7 +51,7 @@ G4IsotopeProperty::G4IsotopeProperty():
fLifeTime(-1.0),fDecayTable(0),
fMagneticMoment(0.0),
fIsomerLevel(-1),
fFloatLevelBase(G4Ions::G4FloatLevelBase::noFloat)
fFloatLevelBase(G4Ions::G4FloatLevelBase::no_Float)
{
}
@@ -131,7 +131,7 @@ void G4IsotopeProperty::DumpInfo() const
<< ", Excited Energy: "
<< std::setprecision(1)
<< fEnergy/keV;
if(fFloatLevelBase!=G4Ions::G4FloatLevelBase::noFloat)
if(fFloatLevelBase!=G4Ions::G4FloatLevelBase::no_Float)
{ G4cout << " +" << G4Ions::FloatLevelBaseChar(fFloatLevelBase); }
G4cout << " [keV]"
<< ", "
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtom.cc 98732 2016-08-09 10:50:57Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, K.Lynch July 2016
#include "G4MuonicAtom.hh"
G4MuonicAtom::G4MuonicAtom(
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
) : G4Ions( aName,mass,width,charge,iSpin,iParity,
iConjugation,iIsospin,iIsospin3,gParity,pType,
lepton,baryon,encoding,stable,lifetime,decaytable,
shortlived, subType, 0,0,0)
{
// member is private in base, so we need to go through the public
// interface
SetFloatLevelBase(G4FloatLevelBase::no_Float);
isGeneralIon=true;
}
@@ -0,0 +1,36 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomDIODecayChannel.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 17 October 16 K.Lynch
// ---------------------------------------------------------------
#include "G4MuonicAtomDIODecayChannel.hh"
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomHelper.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 1 July 16 K.Lynch
// ---------------------------------------------------------------
#include "G4MuonicAtomHelper.hh"
G4MuonicAtom*
G4MuonicAtomHelper::ConstructMuonicAtom(G4String name, G4int encoding, G4Ions const* baseion){
// mass calculation is missing binding energy correction
//auto const mass = G4MuonMinus::Definition()->GetPDGMass() + baseion->GetPDGMass();
auto const mass = 0.1056583715*CLHEP::GeV + baseion->GetPDGMass();
// what should static charge be? for G4Ions, it is Z ... should it
// be Z-1 here (since there will always be a muon attached), or Z?
auto const charge = baseion->GetPDGCharge();
auto muatom = new G4MuonicAtom(name, mass, 0.0, charge,
baseion->GetPDGiSpin(),
baseion->GetPDGiParity(),
baseion->GetPDGiConjugation(),
baseion->GetPDGiIsospin(),
baseion->GetPDGiIsospin3(),
baseion->GetPDGiGParity(),
baseion->GetParticleType(),
baseion->GetLeptonNumber(),
baseion->GetBaryonNumber(),
encoding,
baseion->GetPDGStable(),
// TODO: this is wrong ... need to
// get correct muonic atom lifetime.
// but see next comment
baseion->GetPDGLifeTime(),
// TODO: this is _definitely_ wrong:
// we need to add muonic atom decay
// channels ... do we try to support
// other modes of decay, or do we
// just assume for now that we don't
// need to worry about radioactive
// decay and the like?
baseion->GetDecayTable(),
baseion->IsShortLived(),
baseion->GetParticleSubType());
muatom->SetPDGMagneticMoment(baseion->GetPDGMagneticMoment());
return muatom;
}
@@ -0,0 +1,36 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomNuclearCaptureChannel.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 17 October 16 K.Lynch
// ---------------------------------------------------------------
#include "G4MuonicAtomNuclearCaptureChannel.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NucleiProperties.cc 69015 2013-04-15 09:46:48Z gcosmo $
// $Id: G4NucleiProperties.cc 99159 2016-09-07 08:11:50Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -40,6 +40,12 @@
// 090331 Migrate to AME03 by Koi, Tatsumi
#include "G4NucleiProperties.hh"
#include "G4NucleiPropertiesTableAME03.hh"
#include "G4NucleiPropertiesTableAME12.hh"
#include "G4NucleiPropertiesTheoreticalTable.hh"
#include "G4ParticleTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
@@ -49,6 +55,11 @@ G4ThreadLocal G4double G4NucleiProperties::mass_deuteron = -1.;
G4ThreadLocal G4double G4NucleiProperties::mass_triton = -1.;
G4ThreadLocal G4double G4NucleiProperties::mass_alpha = -1.;
G4ThreadLocal G4double G4NucleiProperties::mass_He3 = -1.;
#ifndef G4NucleiProperties_USE_OLD_AME_TABLE
G4bool G4NucleiProperties::use_old_evaluation = false;
#else
G4bool G4NucleiProperties::use_old_evaluation = true;
#endif
G4double G4NucleiProperties::GetNuclearMass(const G4double A, const G4double Z)
{
@@ -116,9 +127,19 @@ G4double G4NucleiProperties::GetNuclearMass(const G4int A, const G4int Z)
}
if (mass < 0.) {
if (G4NucleiPropertiesTableAME03::IsInTable(Z,A)) {
// AME 03 table
mass = G4NucleiPropertiesTableAME03::GetNuclearMass(Z,A);
G4bool inAMETable = false;
if ( ! use_old_evaluation ) {
inAMETable = G4NucleiPropertiesTableAME12::IsInTable(Z,A);
} else {
inAMETable = G4NucleiPropertiesTableAME03::IsInTable(Z,A);
}
if ( inAMETable ) {
// AME table
if ( ! use_old_evaluation ) {
mass = G4NucleiPropertiesTableAME12::GetNuclearMass(Z,A);
} else {
mass = G4NucleiPropertiesTableAME03::GetNuclearMass(Z,A);
}
} else if (G4NucleiPropertiesTheoreticalTable::IsInTable(Z,A)){
// Theoretical table
mass = G4NucleiPropertiesTheoreticalTable::GetNuclearMass(Z,A);
@@ -150,8 +171,11 @@ G4bool G4NucleiProperties::IsInStableTable(const G4int A, const int Z)
return false;
}
return G4NucleiPropertiesTableAME03::IsInTable(Z,A);
if ( ! use_old_evaluation ) {
return G4NucleiPropertiesTableAME12::IsInTable(Z,A);
} else {
return G4NucleiPropertiesTableAME03::IsInTable(Z,A);
}
}
G4double G4NucleiProperties::GetMassExcess(const G4double A, const G4double Z)
@@ -174,8 +198,19 @@ G4double G4NucleiProperties::GetMassExcess(const G4int A, const G4int Z)
} else {
if (G4NucleiPropertiesTableAME03::IsInTable(Z,A)){
return G4NucleiPropertiesTableAME03::GetMassExcess(Z,A);
G4bool inAMETable = false;
if ( ! use_old_evaluation ) {
inAMETable = G4NucleiPropertiesTableAME12::IsInTable(Z,A);
} else {
inAMETable = G4NucleiPropertiesTableAME03::IsInTable(Z,A);
}
if (inAMETable){
// AME table
if ( ! use_old_evaluation ) {
return G4NucleiPropertiesTableAME12::GetMassExcess(Z,A);
} else {
return G4NucleiPropertiesTableAME03::GetMassExcess(Z,A);
}
} else if (G4NucleiPropertiesTheoreticalTable::IsInTable(Z,A)){
return G4NucleiPropertiesTheoreticalTable::GetMassExcess(Z,A);
} else {
@@ -203,8 +238,18 @@ G4double G4NucleiProperties::GetAtomicMass(const G4double A, const G4double Z)
} else {
G4int iA = G4int(A);
G4int iZ = G4int(Z);
if (G4NucleiPropertiesTableAME03::IsInTable(iZ,iA)) {
return G4NucleiPropertiesTableAME03::GetAtomicMass(iZ,iA);
G4bool inAMETable = false;
if ( ! use_old_evaluation ) {
inAMETable = G4NucleiPropertiesTableAME12::IsInTable(Z,A);
} else {
inAMETable = G4NucleiPropertiesTableAME03::IsInTable(Z,A);
}
if (inAMETable) {
if ( ! use_old_evaluation ) {
return G4NucleiPropertiesTableAME12::GetAtomicMass(Z,A);
} else {
return G4NucleiPropertiesTableAME03::GetAtomicMass(Z,A);
}
} else if (G4NucleiPropertiesTheoreticalTable::IsInTable(iZ,iA)){
return G4NucleiPropertiesTheoreticalTable::GetAtomicMass(iZ,iA);
} else {
@@ -232,8 +277,18 @@ G4double G4NucleiProperties::GetBindingEnergy(const G4int A, const G4int Z)
return 0.0;
} else {
if (G4NucleiPropertiesTableAME03::IsInTable(Z,A)) {
return G4NucleiPropertiesTableAME03::GetBindingEnergy(Z,A);
G4bool inAMETable = false;
if ( ! use_old_evaluation ) {
inAMETable = G4NucleiPropertiesTableAME12::IsInTable(Z,A);
} else {
inAMETable = G4NucleiPropertiesTableAME03::IsInTable(Z,A);
}
if (inAMETable) {
if ( ! use_old_evaluation ) {
return G4NucleiPropertiesTableAME12::GetBindingEnergy(Z,A);
} else {
return G4NucleiPropertiesTableAME03::GetBindingEnergy(Z,A);
}
} else if (G4NucleiPropertiesTheoreticalTable::IsInTable(Z,A)) {
return G4NucleiPropertiesTheoreticalTable::GetBindingEnergy(Z,A);
}else {
@@ -251,8 +306,17 @@ G4double G4NucleiProperties::MassExcess(G4double A, G4double Z)
G4double G4NucleiProperties::AtomicMass(G4double A, G4double Z)
{
const G4double hydrogen_mass_excess = G4NucleiPropertiesTableAME03::GetMassExcess(1,1);
const G4double neutron_mass_excess = G4NucleiPropertiesTableAME03::GetMassExcess(0,1);
//const G4double hydrogen_mass_excess;
//const G4double neutron_mass_excess;
G4double hydrogen_mass_excess;
G4double neutron_mass_excess;
if ( ! use_old_evaluation ) {
hydrogen_mass_excess = G4NucleiPropertiesTableAME12::GetMassExcess(1,1);
neutron_mass_excess = G4NucleiPropertiesTableAME12::GetMassExcess(0,1);
} else {
hydrogen_mass_excess = G4NucleiPropertiesTableAME03::GetMassExcess(1,1);
neutron_mass_excess = G4NucleiPropertiesTableAME03::GetMassExcess(0,1);
}
G4double mass =
(A-Z)*neutron_mass_excess + Z*hydrogen_mass_excess - BindingEnergy(A,Z) + A*amu_c2;
@@ -273,7 +337,7 @@ G4double G4NucleiProperties::NuclearMass(G4double A, G4double Z)
}
G4double mass = AtomicMass(A,Z);
// atomic mass is converted to nuclear mass according formula in AME03
// atomic mass is converted to nuclear mass according formula in AME03 and 12
mass -= Z*electron_mass_c2;
mass += ( 14.4381*std::pow ( Z , 2.39 ) + 1.55468*1e-6*std::pow ( Z , 5.35 ) )*eV;
@@ -297,3 +361,7 @@ G4double G4NucleiProperties::BindingEnergy(G4double A, G4double Z)
return -binding*MeV;
}
void G4NucleiProperties::UseOldAMETable( G4bool val )
{
use_old_evaluation = val;
}
File diff suppressed because it is too large Load Diff
@@ -40,6 +40,7 @@
#include "G4NuclideTableMessenger.hh"
#include "G4ios.hh"
#include "G4String.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
@@ -133,6 +134,7 @@ G4IsotopeProperty* G4NuclideTable::GetIsotope(G4int Z, G4int A, G4double E,
if ( itf != map_pre_load_list.end() ) {
std::multimap< G4double , G4IsotopeProperty* >::iterator lower_bound_itr = itf -> second.lower_bound ( E - flevelTolerance/2 );
G4double levelE = DBL_MAX;
/*
if ( lower_bound_itr != itf -> second.end() ) {
levelE = lower_bound_itr->first;
if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 ) {
@@ -140,6 +142,17 @@ G4IsotopeProperty* G4NuclideTable::GetIsotope(G4int Z, G4int A, G4double E,
{ return lower_bound_itr->second; } // found
}
}
*/
while ( lower_bound_itr != itf -> second.end() ) {
levelE = lower_bound_itr->first;
if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 ) {
if ( flb == (lower_bound_itr->second)->GetFloatLevelBase() ) return lower_bound_itr->second; // found
} else {
break;
}
lower_bound_itr++;
}
}
return fProperty; // not found
@@ -194,11 +207,13 @@ void G4NuclideTable::GenerateNuclide()
G4int ionZ;
G4int ionA;
G4double ionE;
G4String ionFL;
G4double ionLife;
G4int ionJ;
G4double ionMu;
ifs >> ionZ >> ionA >> ionE >> ionLife >> ionJ >> ionMu;
//ifs >> ionZ >> ionA >> ionE >> ionLife >> ionJ >> ionMu;
ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
while ( ifs.good() ) {// Loop checking, 09.08.2015, K.Kurashige
@@ -208,13 +223,17 @@ void G4NuclideTable::GenerateNuclide()
}
ionE *= keV;
G4int flbIndex = 0;
ionE = StripFloatLevelBase( ionE, flbIndex );
//G4int flbIndex = 0;
//ionE = StripFloatLevelBase( ionE, flbIndex );
G4Ions::G4FloatLevelBase flb = StripFloatLevelBase( ionFL );
ionLife *= ns;
ionMu *= (joule/tesla);
if ( ( ionE == 0 && minimum_threshold_of_half_life == DBL_MAX ) // ground state is alwyas build in very first attempt
|| ( threshold_of_half_life <= ionLife*std::log(2.0) && ionLife*std::log(2.0) < minimum_threshold_of_half_life && ionE != 0 ) ) {
//if ( ( ionE == 0 && minimum_threshold_of_half_life == DBL_MAX ) // ground state is alwyas build in very first attempt
// || ( threshold_of_half_life <= ionLife*std::log(2.0) && ionLife*std::log(2.0) < minimum_threshold_of_half_life && ionE != 0 ) ) {
if ( ( ionE == 0 && flb == G4Ions::G4FloatLevelBase::no_Float ) //
|| ( threshold_of_half_life <= ionLife*std::log(2.0) && ionLife*std::log(2.0) < minimum_threshold_of_half_life ) ) {
if ( ionE > 0 ) iLevel++;
if ( iLevel > 9 ) iLevel=9;
@@ -230,7 +249,7 @@ void G4NuclideTable::GenerateNuclide()
fProperty->SetLifeTime(ionLife);
fProperty->SetDecayTable(0);
fProperty->SetMagneticMoment(ionMu);
fProperty->SetFloatLevelBase(flbIndex);
fProperty->SetFloatLevelBase( flb );
fIsotopeList->push_back(fProperty);
@@ -243,7 +262,7 @@ void G4NuclideTable::GenerateNuclide()
itf -> second.insert( std::pair< G4double, G4IsotopeProperty* >( ionE , fProperty ) );
}
ifs >> ionZ >> ionA >> ionE >> ionLife >> ionJ >> ionMu;
ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
}
minimum_threshold_of_half_life = threshold_of_half_life;
@@ -324,7 +343,33 @@ void G4NuclideTable::AddState( G4int ionZ, G4int ionA, G4double ionE,
}
}
#include "G4Threading.hh"
void G4NuclideTable::AddState( G4int ionZ, G4int ionA, G4double ionE,
G4Ions::G4FloatLevelBase flb, G4double ionLife, G4int ionJ, G4double ionMu )
{
if ( G4Threading::IsMasterThread() ) {
if ( fUserDefinedList == NULL ) fUserDefinedList = new G4IsotopeList();
G4IsotopeProperty* fProperty = new G4IsotopeProperty();
// Set Isotope Property
fProperty->SetAtomicNumber(ionZ);
fProperty->SetAtomicMass(ionA);
fProperty->SetIsomerLevel(9);
fProperty->SetEnergy(ionE);
fProperty->SetiSpin(ionJ);
fProperty->SetLifeTime(ionLife);
fProperty->SetDecayTable(0);
fProperty->SetMagneticMoment(ionMu);
fProperty->SetFloatLevelBase( flb );
fUserDefinedList->push_back(fProperty);
fIsotopeList->push_back(fProperty);
}
}
//#include "G4Threading.hh"
void G4NuclideTable::SetThresholdOfHalfLife( G4double t )
{
if ( G4Threading::IsMasterThread() ) {
@@ -335,7 +380,24 @@ void G4NuclideTable::SetThresholdOfHalfLife( G4double t )
G4double G4NuclideTable::StripFloatLevelBase(G4double E, G4int& flbIndex)
{
G4double rem = fmod(E/(1.0E-3*eV),10.0);
G4double rem = std::fmod(E/(1.0E-3*eV),10.0);
flbIndex = int(rem);
return E-rem;
}
G4Ions::G4FloatLevelBase G4NuclideTable::StripFloatLevelBase( G4String sFLB )
{
if ( sFLB.size() < 1 || 2 < sFLB.size() ) {
G4String text;
text += sFLB;
text += " is not valid indicator of G4Ions::G4FloatLevelBase. You may use a wrong version of ENSDFSTATE data. Please use G4ENSDFSTATE2.0 or later.";
G4Exception( "G4NuclideTable" , "PART70002" ,
FatalException , text );
}
G4Ions::G4FloatLevelBase flb = noFloat;
if ( !(sFLB == '-') ) {
flb = G4Ions::FloatLevelBase( sFLB.back() );
}
return flb;
}
@@ -0,0 +1,141 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PDefManager.cc 101112 2016-11-07 08:19:33Z gcosmo $
//
//
// ------------------------------------------------------------
//
// GEANT 4 class header file
//
// ---------------- G4PDefManager ----------------
//
// Utility template class for splitting RW data for thread-safety from
// classes: G4ParticleDefinition, G4VDecayChannel.
//
// ------------------------------------------------------------
// History:
// 01.25.2009 Xin Dong: First implementation from automatic MT conversion.
// ------------------------------------------------------------
#include <stdlib.h>
#include "G4PDefManager.hh"
#include "globals.hh"
#include "pwdefs.hh"
#include "G4AutoLock.hh"
void G4PDefData::initialize()
{
theProcessManager = 0;
}
G4ThreadLocal G4int G4PDefManager::slavetotalspace=0;
G4ThreadLocal G4PDefData* G4PDefManager::offset=0;
G4PDefManager::G4PDefManager() : totalobj(0)
{
G4MUTEXINIT(mutex);
}
G4int G4PDefManager::CreateSubInstance()
// Invoked by the master or work thread to create a new subinstance
// whenever a new split class instance is created. For each worker
// thread, ions are created dynamically.
{
G4AutoLock l(&mutex);
totalobj++;
if (totalobj > slavetotalspace)
{
l.unlock();
NewSubInstances();
l.lock();
}
return (totalobj - 1);
}
void G4PDefManager::NewSubInstances()
// Invoked by each worker thread to grow the subinstance array and
// initialize each new subinstance using a particular method defined
// by the subclass.
{
G4AutoLock l(&mutex);
if (slavetotalspace >= totalobj) { return; }
G4int originaltotalspace = slavetotalspace;
slavetotalspace = totalobj + 512;
offset = (G4PDefData *) realloc(offset, slavetotalspace * sizeof(G4PDefData));
if (offset == 0)
{
G4Exception("G4PDefManager::NewSubInstances()",
"OutOfMemory", FatalException, "Cannot malloc space!");
}
for (G4int i = originaltotalspace; i < slavetotalspace; i++)
{
offset[i].initialize();
}
}
void G4PDefManager::FreeSlave()
// Invoked by all threads to free the subinstance array.
{
if (!offset) { return; }
free(offset);
offset = 0;
}
G4PDefData* G4PDefManager::GetOffset()
{
return offset;
}
void G4PDefManager::UseWorkArea( G4PDefData* newOffset ) // , G4int numObjects, G4int numSpace)
{
// Use recycled work area - which was created previously
if( offset && offset!=newOffset )
{
G4Exception("G4PDefManager::UseWorkspace()",
"TwoWorkspaces", FatalException,
"Thread already has workspace - cannot use another.");
}
offset= newOffset;
// totalobj= numObjects;
// totalspace= numSpace;
}
G4PDefData* G4PDefManager::FreeWorkArea() // G4int* numObjects, G4int* numSpace)
{
// Detach this thread from this Location
// The object which calls this method is responsible for it.
//
G4PDefData* offsetRet= offset;
offset= 0;
return offsetRet;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.cc 92918 2015-09-21 15:04:01Z gcosmo $
// $Id: G4ParticleDefinition.cc 100425 2016-10-21 12:57:06Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -61,22 +61,15 @@
#include "G4StateManager.hh"
#include "G4UnitsTable.hh"
// This static member is thread local. For each thread, it holds the array
// size of G4PDefData instances.
//
template <class G4PDefData> G4ThreadLocal
G4int G4PDefSplitter<G4PDefData>::slavetotalspace = 0;
// This static member is thread local. For each thread, it points to the
// array of G4PDefData instances.
//
template <class G4PDefData> G4ThreadLocal
G4PDefData* G4PDefSplitter<G4PDefData>::offset = 0;
// This new field helps to use the class G4PDefManager.
//
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)
// Returns the private data instance manager.
//
const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager()
@@ -251,7 +244,11 @@ G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const
return (this->theParticleName != right.theParticleName);
}
G4ProcessManager* G4ParticleDefinition::GetProcessManager() const
{
if(g4particleDefinitionInstanceID<0) return 0;
return G4MT_pmanager;
}
G4int G4ParticleDefinition::FillQuarkContents()
// calculate quark and anti-quark contents
@@ -25,11 +25,9 @@
//
#include "G4ParticlesWorkspace.hh"
//Note: G4ParticlesWorkspacePool is typedef to G4TWorkspacePool<G4ParticlesWorkspace>
template<> G4ThreadLocal G4ParticlesWorkspace* G4ParticlesWorkspace::pool_type::fMyWorkspace = 0;
namespace {
G4ParticlesWorkspace::pool_type thePool;
namespace
{
G4ParticlesWorkspace::pool_type thePool;
}
G4ParticlesWorkspace::pool_type*
@@ -50,27 +48,23 @@ G4ParticlesWorkspace::G4ParticlesWorkspace(G4bool verbose)
G4ParticlesWorkspace::~G4ParticlesWorkspace()
{
}
// Static methods
// For with current (original) G4WorkerThread -- which uses static methods
void
G4ParticlesWorkspace::UseWorkspace()
{
if( fVerbose )
G4cout << "G4ParticlesWorkspace::UseWorkspace: Copying particles-definition Split-Class - Start " << G4endl;
G4cout << "G4ParticlesWorkspace::UseWorkspace: "
<< "Copying particles-definition Split-Class - Start " << G4endl;
// Implementation copied from G4WorkerThread::BuildGeometryAndPhysicsVector()
// Implementation copied from G4WorkerThread::BuildGeometryAndPhysicsVector()
//Geometry related, split classes mechanism: instantiate sub-instance for this thread
// Geometry related, split classes mechanism: instantiate
// sub-instance for this thread
fpPDefSIM->UseWorkArea(fpPDefOffset);
}
void G4ParticlesWorkspace::ReleaseWorkspace()
// The opposite of Use Workspace - let go of it.
{
fpPDefSIM->UseWorkArea(0);
}
@@ -86,10 +80,10 @@ G4ParticlesWorkspace::InitialiseWorkspace()
G4cout << "G4ParticlesWorkspace::InitialiseWorkspace: "
<< "Copying particles-definition Split-Class - Start " << G4endl;
//Particles related, split classes mechanism:
// Particles related, split classes mechanism:
// Do *NOT* instantiate sub-instance for this thread,
// just copy the contents !!
fpPDefSIM->NewSubInstances();
// just copy the contents !!
fpPDefSIM->NewSubInstances();
// Additional initialization if needed - beyond copying memory
InitialiseParticles();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhaseSpaceDecayChannel.cc 96797 2016-05-09 10:13:42Z gcosmo $
// $Id: G4PhaseSpaceDecayChannel.cc 98352 2016-07-08 08:21:00Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -199,8 +199,10 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
"Can not create decay products: sum of daughter mass is larger than parent mass");
return products;
}
G4double dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
G4double dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
G4double dm1=daughtermass[0];
if (daughterwidth[0] > 0.) dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
G4double dm2= daughtermass[1];
if (daughterwidth[1] > 0.) dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
while (dm1+dm2>parentmass){ // Loop checking, 09.08.2015, K.Kurashige
dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
@@ -307,9 +309,12 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
"Can not create decay products: sum of daughter mass is larger than parent mass");
return products;
}
G4double dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
G4double dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
G4double dm3= DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
G4double dm1=daughtermass[0];
if (daughterwidth[0] > 0.) dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
G4double dm2= daughtermass[1];
if (daughterwidth[1] > 0.) dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
G4double dm3= daughtermass[2];
if (daughterwidth[2] > 0.) dm3= DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
while (dm1+dm2+dm3>parentmass){ // Loop checking, 09.08.2015, K.Kurashige
dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.cc 91885 2015-08-10 07:05:56Z gcosmo $
// $Id: G4PrimaryVertex.cc 99159 2016-09-07 08:11:50Z gcosmo $
//
#include "G4PrimaryVertex.hh"
@@ -67,7 +67,14 @@ G4PrimaryVertex::G4PrimaryVertex(const G4PrimaryVertex & right)
G4PrimaryVertex::~G4PrimaryVertex()
{
if(theParticle != 0) {
delete theParticle;
G4PrimaryParticle* theNext = theParticle;
while(theNext)
{
G4PrimaryParticle* thisPrimary = theNext;
theNext = thisPrimary->GetNext();
thisPrimary->ClearNext();
delete thisPrimary;
}
theParticle = 0;
}
if(nextVertex != 0) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VDecayChannel.cc 95906 2016-03-02 10:56:50Z gcosmo $
// $Id: G4VDecayChannel.cc 98352 2016-07-08 08:21:00Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -420,6 +420,7 @@ void G4VDecayChannel::FillDaughters()
// check sum of daghter mass
G4double widthMass = std::sqrt(G4MT_parent->GetPDGWidth()*G4MT_parent->GetPDGWidth()+sumofdaughterwidthsq);
if ( (G4MT_parent->GetParticleType() != "nucleus") &&
(numberOfDaughters !=1) &&
(sumofdaughtermass > parentmass + rangeMass*widthMass) ){
// !!! illegal mass !!!
#ifdef G4VERBOSE
@@ -566,6 +567,7 @@ const G4String& G4VDecayChannel::GetNoName() const
#include "Randomize.hh"
G4double G4VDecayChannel::DynamicalMass(G4double massPDG, G4double width, G4double maxDev ) const
{
if (width<=0.0) return massPDG;
if (maxDev >rangeMass) maxDev = rangeMass;
if (maxDev <=-1.*rangeMass) return massPDG; // can not calculate
@@ -586,10 +588,12 @@ G4bool G4VDecayChannel::IsOKWithParentMass(G4double parentMass)
G4double sumOfDaughterMassMin=0.0;
CheckAndFillParent();
CheckAndFillDaughters();
// skip one body decay
if (numberOfDaughters==1) return true;
for (G4int index=0; index < numberOfDaughters; index++) {
sumOfDaughterMassMin +=
G4MT_daughters_mass[index] -rangeMass*G4MT_daughters_width[index];
}
return (parentMass > sumOfDaughterMassMin);
return (parentMass >= sumOfDaughterMassMin);
}