Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4ParticleDefinition class implementation << 27 // 23 // 28 // Authors: G.Cosmo, 2 December 1995 - Design, << 24 // $Id: G4ParticleDefinition.cc,v 1.20 2003/09/19 18:44:05 kurasige Exp $ 29 // M.Asai, 29 January 1996 - First im << 25 // GEANT4 tag $Name: geant4-06-00 $ 30 // History: << 26 // 31 // - 1996-2003, H.Kurashige - Revisions << 27 // 32 // - 11.03.2003, H.Kurashige - Restructuring f << 28 // -------------------------------------------------------------- 33 // - 25.01.2013, G.Cosmo, A.Dotti - Introduced << 29 // GEANT 4 class implementation file 34 // - 15.06.2017, K.L.Genser - Added support fo << 30 // 35 // ------------------------------------------- << 31 // History: first implementation, based on object model of >> 32 // 2nd December 1995, G.Cosmo >> 33 // ---------------- G4ParticleDefinition ----------------- >> 34 // first implementation by Makoto Asai, 29 January 1996 >> 35 // revised by G.Cosmo, 29 February 1996 >> 36 // revised by H.Kurashige, 19 April 1996 >> 37 // Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96 >> 38 // revised by H.Kurashige, 4 July 1996 >> 39 // revised by H.Kurashige, 16 Feb 1997 >> 40 // revised by H.Kurashige, 10 Nov 1997 >> 41 // remove new/delete G4ProcessManager by H.Kurashige 06 June 1998 >> 42 // added Resonance flag and ApplyCuts flag H.Kurashige 27 June 1998 >> 43 // modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998 >> 44 // modify encoding rule H.Kurashige 23 Oct. 98 >> 45 // modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige >> 46 // >> 47 // modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige >> 48 // -------------------------------------------------------------- 36 49 37 #include "G4ParticleDefinition.hh" << 38 50 >> 51 #include "G4ParticleDefinition.hh" >> 52 #include "G4ParticleTable.hh" 39 #include "G4DecayTable.hh" 53 #include "G4DecayTable.hh" 40 #include "G4IonTable.hh" << 41 #include "G4PDGCodeChecker.hh" 54 #include "G4PDGCodeChecker.hh" 42 #include "G4ParticleTable.hh" << 43 #include "G4PhysicalConstants.hh" << 44 #include "G4StateManager.hh" << 45 #include "G4SystemOfUnits.hh" << 46 #include "G4Threading.hh" << 47 #include "G4UnitsTable.hh" << 48 << 49 // This new field helps to use the class G4PDe << 50 // << 51 G4PDefManager G4ParticleDefinition::subInstanc << 52 << 53 // This macro changes the references to fields << 54 // in the class G4PDefData. << 55 // << 56 #define G4MT_pmanager \ << 57 ((subInstanceManager.offset()[g4particleDefi << 58 #define G4MT_tmanager \ << 59 ((subInstanceManager.offset()[g4particleDefi << 60 55 61 // ------------------------------------------- << 62 // clang-format off << 63 G4ParticleDefinition::G4ParticleDefinition( 56 G4ParticleDefinition::G4ParticleDefinition( 64 const G4String& aName, << 57 const G4String& aName, 65 G4double mass, << 58 G4double mass, 66 G4double width, << 59 G4double width, 67 G4double charge, << 60 G4double charge, 68 G4int iSpin, << 61 G4int iSpin, 69 G4int iParity, << 62 G4int iParity, 70 G4int iConjugation, << 63 G4int iConjugation, 71 G4int iIsospin, << 64 G4int iIsospin, 72 G4int iIsospin3, << 65 G4int iIsospin3, 73 G4int gParity, << 66 G4int gParity, 74 const G4String& pType, << 67 const G4String& pType, 75 G4int lepton, << 68 G4int lepton, 76 G4int baryon, << 69 G4int baryon, 77 G4int encoding, << 70 G4int encoding, 78 G4bool stable, << 71 G4bool stable, 79 G4double lifetime, << 72 G4double lifetime, 80 G4DecayTable* decaytable, << 73 G4DecayTable *decaytable, 81 G4bool shortlived, << 74 G4bool shortlived) 82 const G4String& subType, << 75 : theParticleName(aName), 83 G4int anti_encoding, << 76 thePDGMass(mass), 84 G4double magneticMoment) << 77 thePDGWidth(width), 85 << 78 thePDGCharge(charge), 86 : theParticleName(aName), << 79 thePDGiSpin(iSpin), 87 thePDGMass(mass), << 80 thePDGSpin(iSpin*0.5), 88 thePDGWidth(width), << 81 thePDGiParity(iParity), 89 thePDGCharge(charge), << 82 thePDGiConjugation(iConjugation), 90 thePDGiSpin(iSpin), << 83 thePDGiGParity(gParity), 91 thePDGSpin(iSpin*0.5), << 84 thePDGiIsospin(iIsospin), 92 thePDGiParity(iParity), << 85 thePDGiIsospin3(iIsospin3), 93 thePDGiConjugation(iConjugation), << 86 thePDGIsospin(iIsospin*0.5), 94 thePDGiGParity(gParity), << 87 thePDGIsospin3(iIsospin3*0.5), 95 thePDGiIsospin(iIsospin), << 88 theLeptonNumber(lepton), 96 thePDGiIsospin3(iIsospin3), << 89 theBaryonNumber(baryon), 97 thePDGIsospin(iIsospin*0.5), << 90 theParticleType(pType), 98 thePDGIsospin3(iIsospin3*0.5), << 91 theParticleSubType(""), 99 thePDGMagneticMoment(magneticMoment), << 92 thePDGEncoding(encoding), 100 theLeptonNumber(lepton), << 93 theAntiPDGEncoding(-1*encoding), 101 theBaryonNumber(baryon), << 94 fShortLivedFlag(shortlived), 102 theParticleType(pType), << 95 thePDGStable(stable), 103 theParticleSubType(subType), << 96 thePDGLifeTime(lifetime), 104 thePDGEncoding(encoding), << 97 theDecayTable(decaytable), 105 theAntiPDGEncoding(-1*encoding), << 98 theProcessManager(0), 106 fShortLivedFlag(shortlived), << 99 verboseLevel(1), 107 thePDGStable(stable), << 100 fApplyCutsFlag(false) 108 thePDGLifeTime(lifetime), << 101 { 109 theDecayTable(decaytable) << 102 // check name and register this particle into ParticleTable 110 // clang-format on << 103 theParticleTable = G4ParticleTable::GetParticleTable(); 111 { << 104 theParticleTable->Insert(this); 112 static const G4String nucleus("nucleus"); << 113 static const G4String muAtom("MuonicAtom"); << 114 << 115 g4particleDefinitionInstanceID = -1; << 116 theProcessManagerShadow = nullptr; << 117 << 118 theParticleTable = G4ParticleTable::GetParti << 119 << 120 // set verboseLevel equal to ParticleTable << 121 verboseLevel = theParticleTable->GetVerboseL << 122 << 123 if (anti_encoding != 0) theAntiPDGEncoding = << 124 105 125 // check quark contents << 106 // check quark contents 126 if (this->FillQuarkContents() != thePDGEncod << 127 #ifdef G4VERBOSE 107 #ifdef G4VERBOSE 128 if (verboseLevel > 0) { << 108 if (this->FillQuarkContents() != thePDGEncoding) { 129 // Using G4cout expecting that it is ava << 109 if (verboseLevel>0) { 130 // in construction of static objects << 110 // cerr bnot G4cerr is used intentionally 131 G4cout << "Particle " << aName << " has << 111 // because G4ParticleDefinition constructor may be called 132 } << 112 // before G4cerr object is instantiated !! >> 113 G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl; >> 114 } >> 115 } 133 #endif 116 #endif 134 G4Exception("G4ParticleDefintion::G4Partic << 135 "Strange PDGEncoding "); << 136 } << 137 << 138 // check initialization is in Pre_Init state << 139 G4ApplicationState currentState = G4StateMan << 140 << 141 if (!fShortLivedFlag && (theParticleType != << 142 && (currentState != G4State_PreInit)) << 143 { << 144 #ifdef G4VERBOSE << 145 if (GetVerboseLevel() > 0) { << 146 G4cout << "G4ParticleDefinition (other t << 147 << " should be created in Pre_Ini << 148 } << 149 #endif << 150 G4Exception("G4ParticleDefintion::G4Partic << 151 "G4ParticleDefinition should b << 152 } << 153 << 154 if (theParticleTable->GetIonTable()->IsIon(t << 155 SetAtomicNumber(G4int(GetPDGCharge() / epl << 156 SetAtomicMass(GetBaryonNumber()); << 157 } << 158 << 159 if (theParticleTable->GetIonTable()->IsAntiI << 160 SetAtomicNumber(std::abs(G4int(GetPDGCharg << 161 SetAtomicMass(std::abs(GetBaryonNumber())) << 162 } << 163 << 164 // check name and register this particle int << 165 theParticleTable->Insert(this); << 166 } 117 } 167 118 168 G4ParticleDefinition::G4ParticleDefinition() << 119 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &) 169 { 120 { 170 G4Exception("G4ParticleDefinition::G4Particl << 121 G4Exception("You call Copy Constructor of G4ParticleDefinition "); 171 "Illegal call of default constru << 172 } 122 } 173 123 174 G4ParticleDefinition::~G4ParticleDefinition() << 124 G4ParticleDefinition::G4ParticleDefinition() 175 { 125 { 176 if (G4ParticleTable::GetParticleTable()->Get << 126 G4Exception("You call Default Constructor of G4ParticleDefinition "); 177 G4StateManager* pStateManager = G4StateMan << 178 G4ApplicationState currentState = pStateMa << 179 if (currentState != G4State_PreInit) { << 180 G4String msg = "Request of deletion for << 181 msg += GetParticleName(); << 182 msg += " has No effects because readyToU << 183 G4Exception("G4ParticleDefinition::~G4Pa << 184 return; << 185 } << 186 << 187 #ifdef G4VERBOSE << 188 if (verboseLevel > 0) { << 189 G4cout << GetParticleName() << " will be << 190 } << 191 #endif << 192 } << 193 delete theDecayTable; << 194 } 127 } 195 128 196 G4bool G4ParticleDefinition::operator==(const << 197 { << 198 return (this->theParticleName == right.thePa << 199 } << 200 129 201 G4bool G4ParticleDefinition::operator!=(const << 130 G4ParticleDefinition::~G4ParticleDefinition() 202 { 131 { 203 return (this->theParticleName != right.thePa << 132 if (theDecayTable!= 0) delete theDecayTable; 204 } 133 } 205 134 206 const G4PDefManager& G4ParticleDefinition::Get << 207 { << 208 // Returns the private data instance manager << 209 return subInstanceManager; << 210 } << 211 135 212 void G4ParticleDefinition::Clean() << 136 const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right) 213 { 137 { 214 // Clears memory allocated by sub-instance m << 138 if (this != &right) { 215 subInstanceManager.FreeSlave(); << 139 } >> 140 return *this; 216 } 141 } 217 142 218 G4ProcessManager* G4ParticleDefinition::GetPro << 143 G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const 219 { 144 { 220 if (g4particleDefinitionInstanceID < 0) retu << 145 return (this->theParticleName == right.theParticleName); 221 return G4MT_pmanager; << 222 } 146 } 223 147 224 G4VTrackingManager* G4ParticleDefinition::GetT << 148 G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const 225 { 149 { 226 if (g4particleDefinitionInstanceID < 0) retu << 150 return (this->theParticleName != right.theParticleName); 227 return G4MT_tmanager; << 228 } 151 } 229 152 >> 153 >> 154 230 G4int G4ParticleDefinition::FillQuarkContents( 155 G4int G4ParticleDefinition::FillQuarkContents() >> 156 // calculate quark and anti-quark contents >> 157 // return value is PDG encoding for this particle. >> 158 // It means error if the return value is differnt from >> 159 // this->thePDGEncoding. 231 { 160 { 232 // Calculate quark and anti-quark contents << 233 // Returned value is the PDG encoding for th << 234 // It means error if the return value is dif << 235 // this->thePDGEncoding << 236 << 237 G4int flavor; 161 G4int flavor; 238 for (flavor = 0; flavor < NumberOfQuarkFlavo << 162 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 239 theQuarkContent[flavor] = 0; << 163 theQuarkContent[flavor] = 0; 240 theAntiQuarkContent[flavor] = 0; 164 theAntiQuarkContent[flavor] = 0; 241 } 165 } 242 166 243 G4PDGCodeChecker checker; 167 G4PDGCodeChecker checker; 244 checker.SetVerboseLevel(verboseLevel); << 245 168 246 G4int temp = checker.CheckPDGCode(thePDGEnco 169 G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType); 247 170 248 if (temp != 0) { << 171 if ( temp != 0) { 249 for (flavor = 0; flavor < NumberOfQuarkFla << 172 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 250 theQuarkContent[flavor] = checker.GetQua << 173 theQuarkContent[flavor] = checker.GetQuarkContent(flavor); 251 theAntiQuarkContent[flavor] = checker.Ge 174 theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor); 252 } 175 } 253 if ((theParticleType == "meson") || (thePa << 176 if ((theParticleType == "meson")||(theParticleType == "baryon")) { 254 // check charge 177 // check charge 255 if (!checker.CheckCharge(thePDGCharge)) << 178 if (!checker.CheckCharge(thePDGCharge) ){ 256 temp = 0; << 179 temp = 0; 257 G4Exception("G4ParticleDefintion::G4Pa << 258 "Inconsistent charge again << 259 #ifdef G4VERBOSE 180 #ifdef G4VERBOSE 260 if (verboseLevel > 0) { << 181 if (verboseLevel>1) { 261 G4cout << "G4ParticleDefinition::Fil << 182 G4cout << " illegal charge (" << thePDGCharge/eplus; 262 << " illegal charge (" << the << 183 G4cout << " PDG code=" << thePDGEncoding <<G4endl; 263 << G4endl; << 184 } 264 } << 265 #endif 185 #endif 266 } 186 } 267 // check spin << 187 // check spin 268 if (checker.GetSpin() != thePDGiSpin) { 188 if (checker.GetSpin() != thePDGiSpin) { 269 temp = 0; << 189 temp=0; 270 G4Exception("G4ParticleDefintion::G4Pa << 271 "Inconsistent spin against << 272 #ifdef G4VERBOSE 190 #ifdef G4VERBOSE 273 if (verboseLevel > 0) { << 191 if (verboseLevel>1) { 274 G4cout << "G4ParticleDefinition::Fil << 192 G4cout << " illegal SPIN (" << thePDGiSpin << "/2"; 275 << " illegal SPIN (" << thePD << 193 G4cout << " PDG code=" << thePDGEncoding <<G4endl; 276 << " PDG code=" << thePDGEnco << 194 } 277 } << 278 #endif 195 #endif 279 } 196 } 280 } 197 } 281 } 198 } 282 return temp; 199 return temp; 283 } 200 } 284 201 285 void G4ParticleDefinition::DumpTable() const 202 void G4ParticleDefinition::DumpTable() const 286 { 203 { 287 G4cout << G4endl; 204 G4cout << G4endl; 288 G4cout << "--- G4ParticleDefinition ---" << 205 G4cout << "--- G4ParticleDefinition ---" << G4endl; 289 G4cout << " Particle Name : " << theParticle 206 G4cout << " Particle Name : " << theParticleName << G4endl; 290 G4cout << " PDG particle code : " << thePDGE 207 G4cout << " PDG particle code : " << thePDGEncoding; 291 G4cout << " [PDG anti-particle code: " << th << 208 G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl; 292 G4cout << " Mass [GeV/c2] : " << thePDGMass << 209 G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ; 293 G4cout << " Width : " << thePDGWidth / G << 210 G4cout << " Width : " << thePDGWidth/GeV << G4endl; 294 G4cout << " Lifetime [nsec] : " << thePDGLif << 211 G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl; 295 G4cout << " Charge [e]: " << thePDGCharge / << 212 G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl; 296 G4cout << " Spin : " << thePDGiSpin << "/2" 213 G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl; 297 G4cout << " Parity : " << thePDGiParity << G 214 G4cout << " Parity : " << thePDGiParity << G4endl; 298 G4cout << " Charge conjugation : " << thePDG 215 G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl; 299 G4cout << " Isospin : (I,Iz): (" << thePDGiI << 216 G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2"; 300 G4cout << " , " << thePDGiIsospin3 << "/2 ) 217 G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl; 301 G4cout << " GParity : " << thePDGiGParity << 218 G4cout << " GParity : " << thePDGiGParity << G4endl; 302 if (thePDGMagneticMoment != 0.0) { << 303 G4cout << " MagneticMoment [MeV/T] : " << << 304 } << 305 G4cout << " Quark contents (d,u,s,c,b,t) 219 G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0]; 306 G4cout << ", " << theQuarkContent[1]; 220 G4cout << ", " << theQuarkContent[1]; 307 G4cout << ", " << theQuarkContent[2]; 221 G4cout << ", " << theQuarkContent[2]; 308 G4cout << ", " << theQuarkContent[3]; 222 G4cout << ", " << theQuarkContent[3]; 309 G4cout << ", " << theQuarkContent[4]; 223 G4cout << ", " << theQuarkContent[4]; 310 G4cout << ", " << theQuarkContent[5] << G4en 224 G4cout << ", " << theQuarkContent[5] << G4endl; 311 G4cout << " AntiQuark contents 225 G4cout << " AntiQuark contents : " << theAntiQuarkContent[0]; 312 G4cout << ", " << theAntiQuarkContent[1]; 226 G4cout << ", " << theAntiQuarkContent[1]; 313 G4cout << ", " << theAntiQuarkContent[2]; 227 G4cout << ", " << theAntiQuarkContent[2]; 314 G4cout << ", " << theAntiQuarkContent[3]; 228 G4cout << ", " << theAntiQuarkContent[3]; 315 G4cout << ", " << theAntiQuarkContent[4]; 229 G4cout << ", " << theAntiQuarkContent[4]; 316 G4cout << ", " << theAntiQuarkContent[5] << 230 G4cout << ", " << theAntiQuarkContent[5] << G4endl; 317 G4cout << " Lepton number : " << theLeptonNu 231 G4cout << " Lepton number : " << theLeptonNumber; 318 G4cout << " Baryon number : " << theBaryonNu 232 G4cout << " Baryon number : " << theBaryonNumber << G4endl; 319 G4cout << " Particle type : " << theParticle << 233 G4cout << " Particle type : " << theParticleType ; 320 G4cout << " [" << theParticleSubType << "]" 234 G4cout << " [" << theParticleSubType << "]" << G4endl; 321 235 322 if ((theParticleTable->GetIonTable()->IsIon( << 236 if ( fShortLivedFlag ){ 323 || (theParticleTable->GetIonTable()->IsA << 324 { << 325 G4cout << " Atomic Number : " << GetAtomic << 326 G4cout << " Atomic Mass : " << GetAtomicM << 327 } << 328 if (fShortLivedFlag) { << 329 G4cout << " ShortLived : ON" << G4endl; 237 G4cout << " ShortLived : ON" << G4endl; 330 } 238 } 331 239 332 if (IsGeneralIon()) { << 240 if ( thePDGStable ){ 333 G4double lftm = GetIonLifeTime(); << 241 G4cout << " Stable : stable" << G4endl; 334 if (lftm < -1000.) { << 242 } else { 335 G4cout << " Stable : No data found -- un << 243 if( theDecayTable != 0 ){ 336 } << 244 theDecayTable->DumpInfo(); 337 else if (lftm < 0.) { << 245 } else { 338 G4cout << " Stable : stable" << G4endl; << 246 G4cout << "Decay Table is not defined !!" <<G4endl; 339 } << 340 else { << 341 G4cout << " Stable : unstable -- lifetim << 342 << "\n Decay table should be con << 343 } << 344 } << 345 else { << 346 if (thePDGStable) { << 347 G4cout << " Stable : stable" << G4endl; << 348 } << 349 else { << 350 if (theDecayTable != nullptr) { << 351 theDecayTable->DumpInfo(); << 352 } << 353 else { << 354 G4cout << "Decay Table is not defined << 355 } << 356 } 247 } 357 } 248 } >> 249 358 } 250 } 359 251 360 void G4ParticleDefinition::SetApplyCutsFlag(G4 252 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg) 361 { 253 { 362 if (theParticleName == "gamma" || theParticl << 254 if(theParticleName=="gamma" 363 || theParticleName == "proton") << 255 || theParticleName=="e-" >> 256 || theParticleName=="e+") >> 257 { fApplyCutsFlag = flg; } >> 258 else 364 { 259 { 365 fApplyCutsFlag = flg; << 260 G4cerr 366 } << 261 << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName 367 else { << 262 << G4endl; 368 G4cout << "G4ParticleDefinition::SetApplyC << 263 G4cerr 369 G4cout << "becomes obsolete. Production th << 264 << "becomes obsolete. Production threshold is applied only for " 370 << "gamma, e- ,e+ and proton." << G << 265 << "gamma, e- and e+." << G4endl; 371 } 266 } 372 } 267 } 373 268 374 G4double G4ParticleDefinition::CalculateAnomal << 375 { << 376 G4Exception("G4ParticleDefinition::G4Particl << 377 "CalculateAnomaly() method will << 378 269 379 // gives the anomaly of magnetic moment for << 380 if (thePDGiSpin == 1) { << 381 G4double muB = 0.5 * CLHEP::eplus * CLHEP: << 382 return 0.5 * std::fabs(thePDGMagneticMomen << 383 } << 384 270 385 return 0.0; << 386 } << 387 271 388 void G4ParticleDefinition::SetParticleDefiniti << 389 { << 390 if (id < 0) { << 391 g4particleDefinitionInstanceID = subInstan << 392 G4MT_pmanager = nullptr; << 393 } << 394 else { << 395 if (isGeneralIon || isMuonicAtom) { << 396 g4particleDefinitionInstanceID = id; << 397 } << 398 else { << 399 G4ExceptionDescription ed; << 400 ed << "ParticleDefinitionID should not b << 401 G4Exception("G4ParticleDefintion::SetPar << 402 } << 403 } << 404 } << 405 272 406 void G4ParticleDefinition::SetProcessManager(G << 407 { << 408 if (g4particleDefinitionInstanceID < 0 && !i << 409 if (G4Threading::G4GetThreadId() >= 0) { << 410 G4ExceptionDescription ed; << 411 ed << "ProcessManager is being set to " << 412 << " without proper initialization of << 413 << "This operation is thread-unsafe." << 414 G4Exception("G4ParticleDefintion::SetPro << 415 } << 416 SetParticleDefinitionID(); << 417 } << 418 G4MT_pmanager = aProcessManager; << 419 } << 420 273 421 void G4ParticleDefinition::SetTrackingManager( << 274 422 { << 275 423 if (g4particleDefinitionInstanceID < 0 && !i << 276 424 if (G4Threading::G4GetThreadId() >= 0) { << 277 425 G4ExceptionDescription ed; << 426 ed << "TrackingManager is being set to " << 427 << " without proper initialization of << 428 << "This operation is thread-unsafe." << 429 G4Exception("G4ParticleDefintion::SetTra << 430 } << 431 SetParticleDefinitionID(); << 432 } << 433 G4MT_tmanager = aTrackingManager; << 434 } << 435 278