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.25 2005/08/26 03:40:43 kurasige Exp $ 29 // M.Asai, 29 January 1996 - First im << 25 // GEANT4 tag $Name: geant4-07-01-patch-01 $ 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 const G4String& subType, 83 G4int anti_encoding, << 76 G4int anti_encoding) 84 G4double magneticMoment) << 77 85 << 78 : theParticleName(aName), 86 : theParticleName(aName), << 79 thePDGMass(mass), 87 thePDGMass(mass), << 80 thePDGWidth(width), 88 thePDGWidth(width), << 81 thePDGCharge(charge), 89 thePDGCharge(charge), << 82 thePDGiSpin(iSpin), 90 thePDGiSpin(iSpin), << 83 thePDGSpin(iSpin*0.5), 91 thePDGSpin(iSpin*0.5), << 84 thePDGiParity(iParity), 92 thePDGiParity(iParity), << 85 thePDGiConjugation(iConjugation), 93 thePDGiConjugation(iConjugation), << 86 thePDGiGParity(gParity), 94 thePDGiGParity(gParity), << 87 thePDGiIsospin(iIsospin), 95 thePDGiIsospin(iIsospin), << 88 thePDGiIsospin3(iIsospin3), 96 thePDGiIsospin3(iIsospin3), << 89 thePDGIsospin(iIsospin*0.5), 97 thePDGIsospin(iIsospin*0.5), << 90 thePDGIsospin3(iIsospin3*0.5), 98 thePDGIsospin3(iIsospin3*0.5), << 91 theLeptonNumber(lepton), 99 thePDGMagneticMoment(magneticMoment), << 92 theBaryonNumber(baryon), 100 theLeptonNumber(lepton), << 93 theParticleType(pType), 101 theBaryonNumber(baryon), << 94 theParticleSubType(subType), 102 theParticleType(pType), << 95 thePDGEncoding(encoding), 103 theParticleSubType(subType), << 96 theAntiPDGEncoding(-1*encoding), 104 thePDGEncoding(encoding), << 97 fShortLivedFlag(shortlived), 105 theAntiPDGEncoding(-1*encoding), << 98 thePDGStable(stable), 106 fShortLivedFlag(shortlived), << 99 thePDGLifeTime(lifetime), 107 thePDGStable(stable), << 100 theDecayTable(decaytable), 108 thePDGLifeTime(lifetime), << 101 theProcessManager(0), 109 theDecayTable(decaytable) << 102 theAtomicNumber(0), 110 // clang-format on << 103 theAtomicMass(0), 111 { << 104 verboseLevel(1), 112 static const G4String nucleus("nucleus"); << 105 fApplyCutsFlag(false) 113 static const G4String muAtom("MuonicAtom"); << 106 { 114 << 107 // check name and register this particle into ParticleTable 115 g4particleDefinitionInstanceID = -1; << 108 theParticleTable = G4ParticleTable::GetParticleTable(); 116 theProcessManagerShadow = nullptr; << 109 theParticleTable->Insert(this); 117 << 118 theParticleTable = G4ParticleTable::GetParti << 119 110 120 // set verboseLevel equal to ParticleTable << 111 if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding; 121 verboseLevel = theParticleTable->GetVerboseL << 122 112 123 if (anti_encoding != 0) theAntiPDGEncoding = << 113 // check quark contents 124 << 125 // check quark contents << 126 if (this->FillQuarkContents() != thePDGEncod << 127 #ifdef G4VERBOSE 114 #ifdef G4VERBOSE 128 if (verboseLevel > 0) { << 115 if (this->FillQuarkContents() != thePDGEncoding) { 129 // Using G4cout expecting that it is ava << 116 if (verboseLevel>0) { 130 // in construction of static objects << 117 // Using G4cerr expecting that it is available in construction of static objects 131 G4cout << "Particle " << aName << " has << 118 G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl; 132 } << 119 } >> 120 } 133 #endif 121 #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 } 122 } 167 123 168 G4ParticleDefinition::G4ParticleDefinition() << 124 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &) 169 { 125 { 170 G4Exception("G4ParticleDefinition::G4Particl << 126 G4Exception("G4ParticleDefinition::G4ParticleDefinition()", 171 "Illegal call of default constru << 127 "illegal constructor call", FatalException, >> 128 "You call Copy Constructor of G4ParticleDefinition "); 172 } 129 } 173 130 174 G4ParticleDefinition::~G4ParticleDefinition() << 131 G4ParticleDefinition::G4ParticleDefinition() 175 { 132 { 176 if (G4ParticleTable::GetParticleTable()->Get << 133 G4Exception("G4ParticleDefinition::G4ParticleDefinition()", 177 G4StateManager* pStateManager = G4StateMan << 134 "illegal constructor call", FatalException, 178 G4ApplicationState currentState = pStateMa << 135 "You call Default Constructor of G4ParticleDefinition "); 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 } 136 } 195 137 196 G4bool G4ParticleDefinition::operator==(const << 197 { << 198 return (this->theParticleName == right.thePa << 199 } << 200 138 201 G4bool G4ParticleDefinition::operator!=(const << 139 G4ParticleDefinition::~G4ParticleDefinition() 202 { 140 { 203 return (this->theParticleName != right.thePa << 141 if (theDecayTable!= 0) delete theDecayTable; 204 } 142 } 205 143 206 const G4PDefManager& G4ParticleDefinition::Get << 207 { << 208 // Returns the private data instance manager << 209 return subInstanceManager; << 210 } << 211 144 212 void G4ParticleDefinition::Clean() << 145 const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right) 213 { 146 { 214 // Clears memory allocated by sub-instance m << 147 if (this != &right) { 215 subInstanceManager.FreeSlave(); << 148 } >> 149 return *this; 216 } 150 } 217 151 218 G4ProcessManager* G4ParticleDefinition::GetPro << 152 G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const 219 { 153 { 220 if (g4particleDefinitionInstanceID < 0) retu << 154 return (this->theParticleName == right.theParticleName); 221 return G4MT_pmanager; << 222 } 155 } 223 156 224 G4VTrackingManager* G4ParticleDefinition::GetT << 157 G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const 225 { 158 { 226 if (g4particleDefinitionInstanceID < 0) retu << 159 return (this->theParticleName != right.theParticleName); 227 return G4MT_tmanager; << 228 } 160 } 229 161 >> 162 >> 163 230 G4int G4ParticleDefinition::FillQuarkContents( 164 G4int G4ParticleDefinition::FillQuarkContents() >> 165 // calculate quark and anti-quark contents >> 166 // return value is PDG encoding for this particle. >> 167 // It means error if the return value is differnt from >> 168 // this->thePDGEncoding. 231 { 169 { 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; 170 G4int flavor; 238 for (flavor = 0; flavor < NumberOfQuarkFlavo << 171 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 239 theQuarkContent[flavor] = 0; << 172 theQuarkContent[flavor] = 0; 240 theAntiQuarkContent[flavor] = 0; 173 theAntiQuarkContent[flavor] = 0; 241 } 174 } 242 175 243 G4PDGCodeChecker checker; 176 G4PDGCodeChecker checker; 244 checker.SetVerboseLevel(verboseLevel); << 245 177 246 G4int temp = checker.CheckPDGCode(thePDGEnco 178 G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType); 247 179 248 if (temp != 0) { << 180 if ( temp != 0) { 249 for (flavor = 0; flavor < NumberOfQuarkFla << 181 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 250 theQuarkContent[flavor] = checker.GetQua << 182 theQuarkContent[flavor] = checker.GetQuarkContent(flavor); 251 theAntiQuarkContent[flavor] = checker.Ge 183 theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor); 252 } 184 } 253 if ((theParticleType == "meson") || (thePa << 185 if ((theParticleType == "meson")||(theParticleType == "baryon")) { 254 // check charge 186 // check charge 255 if (!checker.CheckCharge(thePDGCharge)) << 187 if (!checker.CheckCharge(thePDGCharge) ){ 256 temp = 0; << 188 temp = 0; 257 G4Exception("G4ParticleDefintion::G4Pa << 258 "Inconsistent charge again << 259 #ifdef G4VERBOSE 189 #ifdef G4VERBOSE 260 if (verboseLevel > 0) { << 190 if (verboseLevel>1) { 261 G4cout << "G4ParticleDefinition::Fil << 191 G4cout << " illegal charge (" << thePDGCharge/eplus; 262 << " illegal charge (" << the << 192 G4cout << " PDG code=" << thePDGEncoding <<G4endl; 263 << G4endl; << 193 } 264 } << 265 #endif 194 #endif 266 } 195 } 267 // check spin << 196 // check spin 268 if (checker.GetSpin() != thePDGiSpin) { 197 if (checker.GetSpin() != thePDGiSpin) { 269 temp = 0; << 198 temp=0; 270 G4Exception("G4ParticleDefintion::G4Pa << 271 "Inconsistent spin against << 272 #ifdef G4VERBOSE 199 #ifdef G4VERBOSE 273 if (verboseLevel > 0) { << 200 if (verboseLevel>1) { 274 G4cout << "G4ParticleDefinition::Fil << 201 G4cout << " illegal SPIN (" << thePDGiSpin << "/2"; 275 << " illegal SPIN (" << thePD << 202 G4cout << " PDG code=" << thePDGEncoding <<G4endl; 276 << " PDG code=" << thePDGEnco << 203 } 277 } << 278 #endif 204 #endif 279 } 205 } 280 } 206 } 281 } 207 } 282 return temp; 208 return temp; 283 } 209 } 284 210 285 void G4ParticleDefinition::DumpTable() const 211 void G4ParticleDefinition::DumpTable() const 286 { 212 { 287 G4cout << G4endl; 213 G4cout << G4endl; 288 G4cout << "--- G4ParticleDefinition ---" << 214 G4cout << "--- G4ParticleDefinition ---" << G4endl; 289 G4cout << " Particle Name : " << theParticle 215 G4cout << " Particle Name : " << theParticleName << G4endl; 290 G4cout << " PDG particle code : " << thePDGE 216 G4cout << " PDG particle code : " << thePDGEncoding; 291 G4cout << " [PDG anti-particle code: " << th << 217 G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl; 292 G4cout << " Mass [GeV/c2] : " << thePDGMass << 218 G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ; 293 G4cout << " Width : " << thePDGWidth / G << 219 G4cout << " Width : " << thePDGWidth/GeV << G4endl; 294 G4cout << " Lifetime [nsec] : " << thePDGLif << 220 G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl; 295 G4cout << " Charge [e]: " << thePDGCharge / << 221 G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl; 296 G4cout << " Spin : " << thePDGiSpin << "/2" 222 G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl; 297 G4cout << " Parity : " << thePDGiParity << G 223 G4cout << " Parity : " << thePDGiParity << G4endl; 298 G4cout << " Charge conjugation : " << thePDG 224 G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl; 299 G4cout << " Isospin : (I,Iz): (" << thePDGiI << 225 G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2"; 300 G4cout << " , " << thePDGiIsospin3 << "/2 ) 226 G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl; 301 G4cout << " GParity : " << thePDGiGParity << 227 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) 228 G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0]; 306 G4cout << ", " << theQuarkContent[1]; 229 G4cout << ", " << theQuarkContent[1]; 307 G4cout << ", " << theQuarkContent[2]; 230 G4cout << ", " << theQuarkContent[2]; 308 G4cout << ", " << theQuarkContent[3]; 231 G4cout << ", " << theQuarkContent[3]; 309 G4cout << ", " << theQuarkContent[4]; 232 G4cout << ", " << theQuarkContent[4]; 310 G4cout << ", " << theQuarkContent[5] << G4en 233 G4cout << ", " << theQuarkContent[5] << G4endl; 311 G4cout << " AntiQuark contents 234 G4cout << " AntiQuark contents : " << theAntiQuarkContent[0]; 312 G4cout << ", " << theAntiQuarkContent[1]; 235 G4cout << ", " << theAntiQuarkContent[1]; 313 G4cout << ", " << theAntiQuarkContent[2]; 236 G4cout << ", " << theAntiQuarkContent[2]; 314 G4cout << ", " << theAntiQuarkContent[3]; 237 G4cout << ", " << theAntiQuarkContent[3]; 315 G4cout << ", " << theAntiQuarkContent[4]; 238 G4cout << ", " << theAntiQuarkContent[4]; 316 G4cout << ", " << theAntiQuarkContent[5] << 239 G4cout << ", " << theAntiQuarkContent[5] << G4endl; 317 G4cout << " Lepton number : " << theLeptonNu 240 G4cout << " Lepton number : " << theLeptonNumber; 318 G4cout << " Baryon number : " << theBaryonNu 241 G4cout << " Baryon number : " << theBaryonNumber << G4endl; 319 G4cout << " Particle type : " << theParticle << 242 G4cout << " Particle type : " << theParticleType ; 320 G4cout << " [" << theParticleSubType << "]" 243 G4cout << " [" << theParticleSubType << "]" << G4endl; 321 244 322 if ((theParticleTable->GetIonTable()->IsIon( << 245 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; 246 G4cout << " ShortLived : ON" << G4endl; 330 } 247 } 331 248 332 if (IsGeneralIon()) { << 249 if ( thePDGStable ){ 333 G4double lftm = GetIonLifeTime(); << 250 G4cout << " Stable : stable" << G4endl; 334 if (lftm < -1000.) { << 251 } else { 335 G4cout << " Stable : No data found -- un << 252 if( theDecayTable != 0 ){ 336 } << 253 theDecayTable->DumpInfo(); 337 else if (lftm < 0.) { << 254 } else { 338 G4cout << " Stable : stable" << G4endl; << 255 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 } 256 } 357 } 257 } >> 258 358 } 259 } 359 260 360 void G4ParticleDefinition::SetApplyCutsFlag(G4 261 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg) 361 { 262 { 362 if (theParticleName == "gamma" || theParticl << 263 if(theParticleName=="gamma" 363 || theParticleName == "proton") << 264 || theParticleName=="e-" >> 265 || theParticleName=="e+") >> 266 { fApplyCutsFlag = flg; } >> 267 else 364 { 268 { 365 fApplyCutsFlag = flg; << 269 G4cerr 366 } << 270 << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName 367 else { << 271 << G4endl; 368 G4cout << "G4ParticleDefinition::SetApplyC << 272 G4cerr 369 G4cout << "becomes obsolete. Production th << 273 << "becomes obsolete. Production threshold is applied only for " 370 << "gamma, e- ,e+ and proton." << G << 274 << "gamma, e- and e+." << G4endl; 371 } 275 } 372 } 276 } 373 277 374 G4double G4ParticleDefinition::CalculateAnomal << 375 { << 376 G4Exception("G4ParticleDefinition::G4Particl << 377 "CalculateAnomaly() method will << 378 278 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 279 385 return 0.0; << 386 } << 387 280 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 281 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 282 421 void G4ParticleDefinition::SetTrackingManager( << 283 422 { << 284 423 if (g4particleDefinitionInstanceID < 0 && !i << 285 424 if (G4Threading::G4GetThreadId() >= 0) { << 286 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 287