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