Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ParticleDefinition.hh 73598 2013-09-02 09:18:28Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -33,21 +33,22 @@
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ---------------- G4ParticleDefinition ----------------
|
||||
// first implementation by Makoto Asai, 29 January 1996
|
||||
// revised by G.Cosmo, 29 February 1996
|
||||
// revised by H.Kurashige, 19 April 1996
|
||||
// revised by H.Kurashige, 4 July 1996
|
||||
// added GetEnergyCuts() and GetLengthCuts() by G.Cosmo, 11 July 1996
|
||||
// added Set/GetVerboseLevel() H.Kurashige 11 Nov. 1997
|
||||
// added SetCuts() and ResetCuts H.Kurashige 15 Nov.1996
|
||||
// change SetProcessManager as public H.Kurashige 06 June 1998
|
||||
// added GetEnergyThreshold H.Kurashige 08 June 1998
|
||||
// added ShortLived flag and ApplyCuts flag H.Kurashige 27 June 1998
|
||||
// fixed some improper codings H.Kurashige 08 Apr. 1999
|
||||
// added sub-type H.Kurashige 15 Feb. 2000
|
||||
// added RestoreCuts H.Kurashige 09 Mar. 2001
|
||||
// restructuring for Cuts per Region by Hisaya 11 MAr.2003
|
||||
// added MagneticMoment Mar. 2007
|
||||
// first implementation by Makoto Asai - 29 January 1996
|
||||
// revised - G.Cosmo - 29 February 1996
|
||||
// revised - H.Kurashige - 19 April 1996
|
||||
// revised - H.Kurashige - 4 July 1996
|
||||
// added GetEnergyCuts() and GetLengthCuts() - G.Cosmo - 11 July 1996
|
||||
// added Set/GetVerboseLevel() - H.Kurashige - 11 November 1997
|
||||
// added SetCuts() and ResetCuts - H.Kurashige - 15 November 1996
|
||||
// change SetProcessManager as public - H.Kurashige - 06 June 1998
|
||||
// added GetEnergyThreshold - H.Kurashige - 08 June 1998
|
||||
// added ShortLived flag and ApplyCuts flag - H.Kurashige - 27 June 1998
|
||||
// fixed some improper codings - H.Kurashige - 08 April 1999
|
||||
// added sub-type - H.Kurashige - 15 February 2000
|
||||
// added RestoreCuts - H.Kurashige - 09 March 2001
|
||||
// restructuring for Cuts per Region - H.Kurashige - 11 March 2003
|
||||
// added MagneticMoment - H.Kurashige - March 2007
|
||||
// modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ParticleDefinition_h
|
||||
@@ -58,31 +59,75 @@
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4PDefSplitter.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 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
|
||||
// This class containes all the static data of a particle.
|
||||
// It also has uses a process manager in order to collect
|
||||
// all the processes this kind of particle can undertake.
|
||||
// Class Description:
|
||||
//
|
||||
// This class containes all the static data of a particle.
|
||||
// It also has uses a process manager in order to collect
|
||||
// all the processes this kind of particle can undertake.
|
||||
|
||||
friend class G4ParticlePropertyTable;
|
||||
|
||||
public: // With Description
|
||||
// Only one type of constructor can be used for G4ParticleDefinition.
|
||||
// If you want to create new particle, you must set name of the particle
|
||||
// at construction. Most of members seen as arguments of the constructor
|
||||
// (except last 3 arguments concerning with decay ) are "constant"
|
||||
// and can not be changed later. (No "SET" methods are available)
|
||||
// Each type of particle must be constructed as a unique object
|
||||
// of special class derived from G4ParticleDefinition.
|
||||
// see G4ParticleTypes for detail
|
||||
|
||||
// Only one type of constructor can be used for G4ParticleDefinition.
|
||||
// If you want to create new particle, you must set name of the particle
|
||||
// at construction. Most of members seen as arguments of the constructor
|
||||
// (except last 3 arguments concerning with decay ) are "constant"
|
||||
// and can not be changed later. (No "SET" methods are available)
|
||||
// Each type of particle must be constructed as a unique object
|
||||
// of special class derived from G4ParticleDefinition.
|
||||
// see G4ParticleTypes for detail
|
||||
|
||||
G4ParticleDefinition(const G4String& aName,
|
||||
G4double mass,
|
||||
@@ -106,12 +151,11 @@ class G4ParticleDefinition
|
||||
G4int anti_encoding =0,
|
||||
G4double magneticMoment = 0.0);
|
||||
|
||||
virtual ~G4ParticleDefinition();
|
||||
virtual ~G4ParticleDefinition();
|
||||
|
||||
public: // With Description
|
||||
// By these following Getxxxx methods, you can get values
|
||||
// for members which can not be changed
|
||||
//
|
||||
// With the following Getxxxx methods, one can get values
|
||||
// for members which can not be changed
|
||||
|
||||
const G4String& GetParticleName() const { return theParticleName; }
|
||||
|
||||
G4double GetPDGMass() const { return thePDGMass; }
|
||||
@@ -131,7 +175,7 @@ class G4ParticleDefinition
|
||||
G4double GetPDGMagneticMoment() const { return thePDGMagneticMoment; }
|
||||
void SetPDGMagneticMoment(G4double mageticMoment);
|
||||
G4double CalculateAnomaly() const;
|
||||
// gives the anomaly of magnetic moment for spin 1/2 particles
|
||||
// Gives the anomaly of magnetic moment for spin 1/2 particles
|
||||
|
||||
const G4String& GetParticleType() const { return theParticleType; }
|
||||
const G4String& GetParticleSubType() const { return theParticleSubType; }
|
||||
@@ -145,88 +189,125 @@ class G4ParticleDefinition
|
||||
|
||||
G4int GetQuarkContent(G4int flavor) const;
|
||||
G4int GetAntiQuarkContent(G4int flavor) const;
|
||||
// return the number of quark with flavor contained in this particle.
|
||||
// The value of flavor is assigned as follows
|
||||
// 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
|
||||
// Returns the number of quark with flavor contained in this particle.
|
||||
// The value of flavor is assigned as follows
|
||||
// 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
|
||||
|
||||
|
||||
public: // With Description
|
||||
// ShortLived flag
|
||||
G4bool IsShortLived() const { return fShortLivedFlag; }
|
||||
|
||||
G4bool GetPDGStable() const { return thePDGStable; }
|
||||
void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
|
||||
|
||||
G4double GetPDGLifeTime() const { return thePDGLifeTime; }
|
||||
void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime = aLifeTime; }
|
||||
void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime=aLifeTime; }
|
||||
|
||||
public:// With Description
|
||||
G4DecayTable* GetDecayTable() const;
|
||||
void SetDecayTable(G4DecayTable* aDecayTable);
|
||||
// Set/Get Decay Table
|
||||
// !! Decay Table can be modified !!
|
||||
// Set/Get Decay Table
|
||||
// !! Decay Table can be modified !!
|
||||
|
||||
public: // With Description
|
||||
G4ProcessManager* GetProcessManager() const;
|
||||
void SetProcessManager(G4ProcessManager* aProcessManager);
|
||||
// Set/Get Process Manager
|
||||
// !! Process Manager can be modified !!
|
||||
// Set/Get Process Manager
|
||||
// !! Process Manager can be modified !!
|
||||
|
||||
G4ParticleTable* GetParticleTable() const;
|
||||
// get pointer to the particle table
|
||||
// Get pointer to the particle table
|
||||
|
||||
void DumpTable() const;
|
||||
// Prints information of data members.
|
||||
|
||||
protected:
|
||||
G4int FillQuarkContents();
|
||||
// calculate quark and anti-quark contents
|
||||
// return value is PDG encoding for this particle.
|
||||
// It means error if the return value is deffernt from
|
||||
// this->thePDGEncoding.
|
||||
|
||||
void SetParticleSubType(const G4String& subtype);
|
||||
|
||||
public: // With Description
|
||||
// Get AtomicNumber and AtomicMass
|
||||
// These properties are defined for nucleus
|
||||
G4int GetAtomicNumber() const;
|
||||
G4int GetAtomicMass() const;
|
||||
// Get AtomicNumber and AtomicMass
|
||||
// These properties are defined for nucleus
|
||||
|
||||
protected:
|
||||
void SetAtomicNumber(G4int );
|
||||
void SetAtomicMass(G4int );
|
||||
void DumpTable() const;
|
||||
// Prints information of data members.
|
||||
|
||||
public:
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
|
||||
protected:
|
||||
// !!! can not use "copy constructor" nor "default constructor" !!!!
|
||||
G4ParticleDefinition(const G4ParticleDefinition &right);
|
||||
G4ParticleDefinition();
|
||||
void SetApplyCutsFlag(G4bool);
|
||||
G4bool GetApplyCutsFlag() const;
|
||||
|
||||
private:
|
||||
// !!! Assignment operation is forbidden !!!
|
||||
const G4ParticleDefinition & operator=(const G4ParticleDefinition &right);
|
||||
G4bool IsGeneralIon() const;
|
||||
// true only if the particle is G4Ions
|
||||
// (it means that theProcessManager is same as one for G4GenricIon)
|
||||
|
||||
public:
|
||||
G4int operator==(const G4ParticleDefinition &right) const;
|
||||
G4int operator!=(const G4ParticleDefinition &right) const;
|
||||
|
||||
public : // without description
|
||||
|
||||
inline G4ProcessManager* GetMasterProcessManager() const;
|
||||
// Returns the process manager master pointer.
|
||||
inline void SetMasterProcessManager(G4ProcessManager* aNewPM);
|
||||
//Sets the shadow master pointer (not to be used by user)
|
||||
|
||||
inline G4int GetInstanceID() const;
|
||||
// Returns the instance ID.
|
||||
|
||||
static const G4PDefManager& GetSubInstanceManager();
|
||||
// Returns the private data instance manager.
|
||||
private:
|
||||
// --- Shadow of master pointers.
|
||||
|
||||
G4ProcessManager *theProcessManagerShadow;
|
||||
// Each worker thread can access this field from the master thread
|
||||
// through this pointer.
|
||||
|
||||
G4int g4particleDefinitionInstanceID;
|
||||
// This field is used as instance ID.
|
||||
|
||||
G4PART_DLL static G4PDefManager subInstanceManager;
|
||||
// This field helps to use the class G4PDefManager introduced above.
|
||||
|
||||
protected:
|
||||
|
||||
G4int FillQuarkContents();
|
||||
// Calculates quark and anti-quark contents
|
||||
// return value is PDG encoding for this particle.
|
||||
// It means error if the return value is deffernt from
|
||||
// this->thePDGEncoding.
|
||||
|
||||
void SetParticleSubType(const G4String& subtype);
|
||||
|
||||
void SetAtomicNumber(G4int );
|
||||
void SetAtomicMass(G4int );
|
||||
|
||||
// !!! can not use "copy constructor" nor "default constructor" !!!!
|
||||
//
|
||||
G4ParticleDefinition(const G4ParticleDefinition &right);
|
||||
G4ParticleDefinition();
|
||||
|
||||
private:
|
||||
// Values following can not be changed
|
||||
// i.e. No Setxxxx Methods for them
|
||||
|
||||
// !!! Assignment operation is forbidden !!!
|
||||
//
|
||||
const G4ParticleDefinition & operator=(const G4ParticleDefinition &r);
|
||||
|
||||
protected:
|
||||
|
||||
enum {NumberOfQuarkFlavor = 6};
|
||||
G4int theQuarkContent[NumberOfQuarkFlavor];
|
||||
G4int theAntiQuarkContent[NumberOfQuarkFlavor];
|
||||
// the number of quark (minus Sign means anti-quark) contents
|
||||
// The value of flavor is assigned as follows
|
||||
// 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
|
||||
|
||||
private:
|
||||
|
||||
// --- Following values can not be changed
|
||||
// --- i.e. No Setxxxx Methods for them
|
||||
|
||||
G4String theParticleName;
|
||||
// The name of the particle.
|
||||
// Each object must have its specific name!!
|
||||
|
||||
// --- following member values must be defined with Units
|
||||
// --- Following member values must be defined with Units
|
||||
|
||||
G4double thePDGMass;
|
||||
// The mass of the particle, in units of equivalent energy.
|
||||
|
||||
@@ -238,9 +319,10 @@ class G4ParticleDefinition
|
||||
G4double thePDGCharge;
|
||||
// The charge of the particle.(in units of Coulomb)
|
||||
|
||||
// ---- following members are quantum number
|
||||
// i.e. discrete numbers can be allowded
|
||||
// So, you can defined only by using integer in constructor
|
||||
// --- Following members are quantum number
|
||||
// i.e. discrete numbers can be allowded
|
||||
// So, you can defined only by using integer in constructor
|
||||
|
||||
G4int thePDGiSpin;
|
||||
// The total spin of the particle, also often denoted as
|
||||
// capital J, in units of 1/2.
|
||||
@@ -286,22 +368,13 @@ class G4ParticleDefinition
|
||||
G4int theAntiPDGEncoding;
|
||||
// The Particle Data Group integer identifier of the anti-particle
|
||||
|
||||
protected:
|
||||
enum {NumberOfQuarkFlavor = 6};
|
||||
G4int theQuarkContent[NumberOfQuarkFlavor];
|
||||
G4int theAntiQuarkContent[NumberOfQuarkFlavor];
|
||||
// the number of quark (minus Sign means anti-quark) contents
|
||||
// The value of flavor is assigned as follows
|
||||
// 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
|
||||
// --- Following members can be changed after construction
|
||||
|
||||
private:
|
||||
// Following members can be changed after construction
|
||||
|
||||
G4bool fShortLivedFlag;
|
||||
G4bool fShortLivedFlag;
|
||||
// Particles which have true value of this flag
|
||||
// will not be tracked by TrackingManager
|
||||
|
||||
G4bool thePDGStable;
|
||||
G4bool thePDGStable;
|
||||
// Is an indicator that this particle is stable. It must
|
||||
// not decay. If the user tries to assign a kind of decay
|
||||
// object to it, it will refuse to take it.
|
||||
@@ -310,29 +383,25 @@ class G4ParticleDefinition
|
||||
// Is related to the decay width of the particle. The mean
|
||||
// life time is given in seconds.
|
||||
|
||||
class G4DecayTable *theDecayTable;
|
||||
G4DecayTable *theDecayTable;
|
||||
// Points DecayTable
|
||||
|
||||
|
||||
private:
|
||||
class G4ProcessManager *theProcessManager;
|
||||
// Points to G4ProcessManager
|
||||
|
||||
G4ParticleTable* theParticleTable;
|
||||
|
||||
private:
|
||||
G4int theAtomicNumber;
|
||||
G4int theAtomicMass;
|
||||
G4int theAtomicNumber;
|
||||
G4int theAtomicMass;
|
||||
|
||||
private:
|
||||
G4int verboseLevel;
|
||||
G4int verboseLevel;
|
||||
G4bool fApplyCutsFlag;
|
||||
|
||||
private:
|
||||
G4bool fApplyCutsFlag;
|
||||
public:
|
||||
|
||||
void SetApplyCutsFlag(G4bool);
|
||||
G4bool GetApplyCutsFlag() const;
|
||||
protected:
|
||||
G4bool isGeneralIon;
|
||||
|
||||
public:
|
||||
void SetParticleDefinitionID(G4int id=-1);
|
||||
G4int GetParticleDefinitionID() const;
|
||||
};
|
||||
|
||||
#include "G4ParticleDefinition.icc"
|
||||
|
||||
Reference in New Issue
Block a user