56#define G4MT_pmanager \
57 ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theProcessManager)
58#define G4MT_tmanager \
59 ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theTrackingManager)
86 : theParticleName(aName),
91 thePDGSpin(iSpin*0.5),
92 thePDGiParity(iParity),
93 thePDGiConjugation(iConjugation),
94 thePDGiGParity(gParity),
95 thePDGiIsospin(iIsospin),
96 thePDGiIsospin3(iIsospin3),
97 thePDGIsospin(iIsospin*0.5),
98 thePDGIsospin3(iIsospin3*0.5),
99 thePDGMagneticMoment(magneticMoment),
100 theLeptonNumber(lepton),
101 theBaryonNumber(baryon),
102 theParticleType(pType),
103 theParticleSubType(subType),
106 fShortLivedFlag(shortlived),
107 thePDGStable(stable),
108 thePDGLifeTime(lifetime),
109 theDecayTable(decaytable)
112 static const G4String nucleus(
"nucleus");
113 static const G4String muAtom(
"MuonicAtom");
115 g4particleDefinitionInstanceID = -1;
116 theProcessManagerShadow =
nullptr;
123 if (anti_encoding != 0) theAntiPDGEncoding = anti_encoding;
128 if (verboseLevel > 0) {
131 G4cout <<
"Particle " << aName <<
" has a strange PDGEncoding " <<
G4endl;
135 "Strange PDGEncoding ");
141 if (!fShortLivedFlag && (theParticleType != nucleus) && (theParticleType != muAtom)
146 G4cout <<
"G4ParticleDefinition (other than ions and shortlived)"
147 <<
" should be created in Pre_Init state - " << aName <<
G4endl;
151 "G4ParticleDefinition should be created in PreInit state");
165 theParticleTable->
Insert(
this);
171 "Illegal call of default constructor for G4ParticleDefinition!");
180 G4String msg =
"Request of deletion for ";
182 msg +=
" has No effects because readyToUse is true.";
188 if (verboseLevel > 0) {
193 delete theDecayTable;
198 return (this->theParticleName == right.theParticleName);
203 return (this->theParticleName != right.theParticleName);
209 return subInstanceManager;
220 if (g4particleDefinitionInstanceID < 0)
return nullptr;
226 if (g4particleDefinitionInstanceID < 0)
return nullptr;
253 if ((theParticleType ==
"meson") || (theParticleType ==
"baryon")) {
258 "Inconsistent charge against PDG code ");
260 if (verboseLevel > 0) {
261 G4cout <<
"G4ParticleDefinition::FillQuarkContents : "
262 <<
" illegal charge (" << thePDGCharge / eplus <<
" PDG code=" << thePDGEncoding
268 if (checker.
GetSpin() != thePDGiSpin) {
271 "Inconsistent spin against PDG code ");
273 if (verboseLevel > 0) {
274 G4cout <<
"G4ParticleDefinition::FillQuarkContents : "
275 <<
" illegal SPIN (" << thePDGiSpin <<
"/2"
276 <<
" PDG code=" << thePDGEncoding <<
G4endl;
289 G4cout <<
" Particle Name : " << theParticleName <<
G4endl;
290 G4cout <<
" PDG particle code : " << thePDGEncoding;
292 G4cout <<
" Mass [GeV/c2] : " << thePDGMass / GeV;
294 G4cout <<
" Lifetime [nsec] : " << thePDGLifeTime / ns <<
G4endl;
295 G4cout <<
" Charge [e]: " << thePDGCharge / eplus <<
G4endl;
298 G4cout <<
" Charge conjugation : " << thePDGiConjugation <<
G4endl;
299 G4cout <<
" Isospin : (I,Iz): (" << thePDGiIsospin <<
"/2";
300 G4cout <<
" , " << thePDGiIsospin3 <<
"/2 ) " <<
G4endl;
302 if (thePDGMagneticMoment != 0.0) {
303 G4cout <<
" MagneticMoment [MeV/T] : " << thePDGMagneticMoment / MeV * tesla <<
G4endl;
317 G4cout <<
" Lepton number : " << theLeptonNumber;
318 G4cout <<
" Baryon number : " << theBaryonNumber <<
G4endl;
319 G4cout <<
" Particle type : " << theParticleType;
328 if (fShortLivedFlag) {
335 G4cout <<
" Stable : No data found -- unknown" <<
G4endl;
337 else if (lftm < 0.) {
342 <<
"\n Decay table should be consulted to G4RadioactiveDecayProcess." <<
G4endl;
350 if (theDecayTable !=
nullptr) {
362 if (theParticleName ==
"gamma" || theParticleName ==
"e-" || theParticleName ==
"e+"
363 || theParticleName ==
"proton")
365 fApplyCutsFlag = flg;
368 G4cout <<
"G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName <<
G4endl;
369 G4cout <<
"becomes obsolete. Production threshold is applied only for "
370 <<
"gamma, e- ,e+ and proton." <<
G4endl;
377 "CalculateAnomaly() method will be removed in future releases");
380 if (thePDGiSpin == 1) {
381 G4double muB = 0.5 * CLHEP::eplus * CLHEP::hbar_Planck / (thePDGMass / CLHEP::c_squared);
382 return 0.5 * std::fabs(thePDGMagneticMoment / muB - 2. * thePDGCharge / CLHEP::eplus);
396 g4particleDefinitionInstanceID = id;
400 ed <<
"ParticleDefinitionID should not be set for the particles <" << theParticleName <<
">.";
408 if (g4particleDefinitionInstanceID < 0 && !
isGeneralIon) {
411 ed <<
"ProcessManager is being set to " << theParticleName
412 <<
" without proper initialization of TLS pointer vector.\n"
413 <<
"This operation is thread-unsafe.";
423 if (g4particleDefinitionInstanceID < 0 && !
isGeneralIon) {
426 ed <<
"TrackingManager is being set to " << theParticleName
427 <<
" without proper initialization of TLS pointer vector.\n"
428 <<
"This operation is thread-unsafe.";
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
static G4bool IsIon(const G4ParticleDefinition *)
static G4bool IsAntiIon(const G4ParticleDefinition *)
G4int CheckPDGCode(G4int code, const G4String &type)
G4int GetQuarkContent(G4int flavor) const
G4bool CheckCharge(G4double charge) const
G4int GetAntiQuarkContent(G4int flavor) const
void SetVerboseLevel(G4int verbose)
G4int CreateSubInstance()
G4ProcessManager * GetProcessManager() const
G4VTrackingManager * GetTrackingManager() const
G4int GetAtomicNumber() const
static const G4PDefManager & GetSubInstanceManager()
G4bool IsGeneralIon() const
G4int GetAntiPDGEncoding() const
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int GetVerboseLevel() const
void SetParticleDefinitionID(G4int id=-1)
void SetTrackingManager(G4VTrackingManager *aTrackingManager)
G4int GetAtomicMass() const
virtual ~G4ParticleDefinition()
G4double GetPDGCharge() const
G4bool operator==(const G4ParticleDefinition &right) const
void SetApplyCutsFlag(G4bool)
G4int theQuarkContent[NumberOfQuarkFlavor]
void SetAtomicMass(G4int)
G4double GetIonLifeTime() const
G4int GetBaryonNumber() const
G4bool operator!=(const G4ParticleDefinition &right) const
G4double CalculateAnomaly() const
G4int FillQuarkContents()
const G4String & GetParticleName() const
void SetProcessManager(G4ProcessManager *aProcessManager)
void SetAtomicNumber(G4int)
G4IonTable * GetIonTable() const
G4int GetVerboseLevel() const
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * Insert(G4ParticleDefinition *particle)
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()