55#define G4MT_pmanager ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theProcessManager)
81 : theParticleName(aName),
86 thePDGSpin(iSpin*0.5),
87 thePDGiParity(iParity),
88 thePDGiConjugation(iConjugation),
89 thePDGiGParity(gParity),
90 thePDGiIsospin(iIsospin),
91 thePDGiIsospin3(iIsospin3),
92 thePDGIsospin(iIsospin*0.5),
93 thePDGIsospin3(iIsospin3*0.5),
94 thePDGMagneticMoment(magneticMoment),
95 theLeptonNumber(lepton),
96 theBaryonNumber(baryon),
97 theParticleType(pType),
98 theParticleSubType(subType),
101 fShortLivedFlag(shortlived),
102 thePDGStable(stable),
103 thePDGLifeTime(lifetime),
104 theDecayTable(decaytable)
106 static const G4String nucleus(
"nucleus");
107 static const G4String muAtom(
"MuonicAtom");
109 g4particleDefinitionInstanceID = -1;
110 theProcessManagerShadow = 0;
117 if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding;
127 G4cout <<
"Particle " << aName
128 <<
" has a strange PDGEncoding " <<
G4endl;
131 G4Exception(
"G4ParticleDefintion::G4ParticleDefintion",
133 "Strange PDGEncoding ");
140 if ( !fShortLivedFlag && (theParticleType!=nucleus)
146 G4cout <<
"G4ParticleDefinition (other than ions and shortlived)"
147 <<
" should be created in Pre_Init state - "
151 G4Exception(
"G4ParticleDefintion::G4ParticleDefinition()",
153 "G4ParticleDefinition should be created in PreInit state");
170 theParticleTable->
Insert(
this);
176 G4Exception(
"G4ParticleDefinition::G4ParticleDefinition()",
178 "Illegal call of default constructor for G4ParticleDefinition!");
190 G4String msg =
"Request of deletion for ";
192 msg +=
" has No effects because readyToUse is true.";
193 G4Exception(
"G4ParticleDefinition::~G4ParticleDefinition()",
207 delete theDecayTable;
213 return (this->theParticleName == right.theParticleName);
219 return (this->theParticleName != right.theParticleName);
226 return subInstanceManager;
239 if(g4particleDefinitionInstanceID<0)
return nullptr;
270 if ((theParticleType ==
"meson")||(theParticleType ==
"baryon"))
276 G4Exception(
"G4ParticleDefintion::G4ParticleDefintion",
278 "Inconsistent charge against PDG code ");
282 G4cout <<
"G4ParticleDefinition::FillQuarkContents : "
283 <<
" illegal charge (" << thePDGCharge/eplus
284 <<
" PDG code=" << thePDGEncoding <<
G4endl;
289 if (checker.
GetSpin() != thePDGiSpin)
292 G4Exception(
"G4ParticleDefintion::G4ParticleDefintion",
294 "Inconsistent spin against PDG code ");
298 G4cout <<
"G4ParticleDefinition::FillQuarkContents : "
299 <<
" illegal SPIN (" << thePDGiSpin <<
"/2"
300 <<
" PDG code=" << thePDGEncoding <<
G4endl;
314 G4cout <<
" Particle Name : " << theParticleName <<
G4endl;
315 G4cout <<
" PDG particle code : " << thePDGEncoding;
317 G4cout <<
" Mass [GeV/c2] : " << thePDGMass/GeV ;
320 G4cout <<
" Charge [e]: " << thePDGCharge/eplus <<
G4endl;
323 G4cout <<
" Charge conjugation : " << thePDGiConjugation <<
G4endl;
324 G4cout <<
" Isospin : (I,Iz): (" << thePDGiIsospin <<
"/2";
325 G4cout <<
" , " << thePDGiIsospin3 <<
"/2 ) " <<
G4endl;
327 if (thePDGMagneticMoment != 0.0)
329 G4cout <<
" MagneticMoment [MeV/T] : "
330 << thePDGMagneticMoment/MeV*tesla <<
G4endl;
344 G4cout <<
" Lepton number : " << theLeptonNumber;
345 G4cout <<
" Baryon number : " << theBaryonNumber <<
G4endl;
346 G4cout <<
" Particle type : " << theParticleType ;
355 if ( fShortLivedFlag )
364 {
G4cout <<
" Stable : No data found -- unknown" <<
G4endl; }
370 <<
"\n Decay table should be consulted to G4RadioactiveDecayProcess."
382 if( theDecayTable !=
nullptr )
397 if (theParticleName==
"gamma"
398 || theParticleName==
"e-"
399 || theParticleName==
"e+"
400 || theParticleName==
"proton")
402 fApplyCutsFlag = flg;
407 <<
"G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName
410 <<
"becomes obsolete. Production threshold is applied only for "
411 <<
"gamma, e- ,e+ and proton." <<
G4endl;
418 G4Exception(
"G4ParticleDefinition::G4ParticleDefinition",
420 "CalculateAnomaly() method will be removed in future releases");
425 G4double muB = 0.5*CLHEP::eplus*CLHEP::hbar_Planck
426 / (thePDGMass/CLHEP::c_squared);
427 return 0.5*std::fabs(thePDGMagneticMoment/muB
428 - 2.*thePDGCharge/CLHEP::eplus);
447 { g4particleDefinitionInstanceID = id; }
451 ed <<
"ParticleDefinitionID should not be set for the particles <"
452 << theParticleName <<
">.";
453 G4Exception(
"G4ParticleDefintion::SetParticleDefinitionID",
467 ed <<
"ProcessManager is being set to " << theParticleName
468 <<
" without proper initialization of TLS pointer vector.\n"
469 <<
"This operation is thread-unsafe.";
470 G4Exception(
"G4ParticleDefintion::SetProcessManager",
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
G4int GetAtomicNumber() const
static const G4PDefManager & GetSubInstanceManager()
G4bool IsGeneralIon() const
G4int GetAntiPDGEncoding() const
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int GetVerboseLevel() const
void SetParticleDefinitionID(G4int id=-1)
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()