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 100425 2016-10-21 12:57:06Z gcosmo $ 29 // M.Asai, 29 January 1996 - First im << 28 // 30 // History: << 29 // 31 // - 1996-2003, H.Kurashige - Revisions << 30 // -------------------------------------------------------------- 32 // - 11.03.2003, H.Kurashige - Restructuring f << 31 // GEANT 4 class implementation file 33 // - 25.01.2013, G.Cosmo, A.Dotti - Introduced << 32 // 34 // - 15.06.2017, K.L.Genser - Added support fo << 33 // History: first implementation, based on object model of 35 // ------------------------------------------- << 34 // 2nd December 1995, G.Cosmo >> 35 // ---------------- G4ParticleDefinition ----------------- >> 36 // first implementation by Makoto Asai, 29 January 1996 >> 37 // revised by G.Cosmo, 29 February 1996 >> 38 // revised by H.Kurashige, 19 April 1996 >> 39 // Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96 >> 40 // revised by H.Kurashige, 4 July 1996 >> 41 // revised by H.Kurashige, 16 Feb 1997 >> 42 // revised by H.Kurashige, 10 Nov 1997 >> 43 // remove new/delete G4ProcessManager by H.Kurashige 06 June 1998 >> 44 // added Resonance flag and ApplyCuts flag H.Kurashige 27 June 1998 >> 45 // modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998 >> 46 // modify encoding rule H.Kurashige 23 Oct. 98 >> 47 // modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige >> 48 // >> 49 // modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige >> 50 // modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013 >> 51 // -------------------------------------------------------------- 36 52 37 #include "G4ParticleDefinition.hh" << 38 53 39 #include "G4DecayTable.hh" << 54 #include "G4ParticleDefinition.hh" >> 55 #include "G4PhysicalConstants.hh" >> 56 #include "G4SystemOfUnits.hh" >> 57 #include "G4ParticleTable.hh" 40 #include "G4IonTable.hh" 58 #include "G4IonTable.hh" >> 59 #include "G4DecayTable.hh" 41 #include "G4PDGCodeChecker.hh" 60 #include "G4PDGCodeChecker.hh" 42 #include "G4ParticleTable.hh" << 43 #include "G4PhysicalConstants.hh" << 44 #include "G4StateManager.hh" 61 #include "G4StateManager.hh" 45 #include "G4SystemOfUnits.hh" << 46 #include "G4Threading.hh" << 47 #include "G4UnitsTable.hh" 62 #include "G4UnitsTable.hh" 48 63 49 // This new field helps to use the class G4PDe 64 // This new field helps to use the class G4PDefManager. 50 // 65 // 51 G4PDefManager G4ParticleDefinition::subInstanc 66 G4PDefManager G4ParticleDefinition::subInstanceManager; 52 67 53 // This macro changes the references to fields 68 // This macro changes the references to fields that are now encapsulated 54 // in the class G4PDefData. 69 // in the class G4PDefData. 55 // 70 // 56 #define G4MT_pmanager \ << 71 #define G4MT_pmanager ((subInstanceManager.offset[g4particleDefinitionInstanceID]).theProcessManager) 57 ((subInstanceManager.offset()[g4particleDefi << 72 58 #define G4MT_tmanager \ << 73 // Returns the private data instance manager. 59 ((subInstanceManager.offset()[g4particleDefi << 74 // >> 75 const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager() >> 76 { >> 77 return subInstanceManager; >> 78 } 60 79 61 // ------------------------------------------- << 62 // clang-format off << 63 G4ParticleDefinition::G4ParticleDefinition( 80 G4ParticleDefinition::G4ParticleDefinition( 64 const G4String& aName, << 81 const G4String& aName, 65 G4double mass, << 82 G4double mass, 66 G4double width, << 83 G4double width, 67 G4double charge, << 84 G4double charge, 68 G4int iSpin, << 85 G4int iSpin, 69 G4int iParity, << 86 G4int iParity, 70 G4int iConjugation, << 87 G4int iConjugation, 71 G4int iIsospin, << 88 G4int iIsospin, 72 G4int iIsospin3, << 89 G4int iIsospin3, 73 G4int gParity, << 90 G4int gParity, 74 const G4String& pType, << 91 const G4String& pType, 75 G4int lepton, << 92 G4int lepton, 76 G4int baryon, << 93 G4int baryon, 77 G4int encoding, << 94 G4int encoding, 78 G4bool stable, << 95 G4bool stable, 79 G4double lifetime, << 96 G4double lifetime, 80 G4DecayTable* decaytable, << 97 G4DecayTable *decaytable, 81 G4bool shortlived, << 98 G4bool shortlived, 82 const G4String& subType, << 99 const G4String& subType, 83 G4int anti_encoding, << 100 G4int anti_encoding, 84 G4double magneticMoment) << 101 G4double magneticMoment) 85 << 102 86 : theParticleName(aName), << 103 : theParticleName(aName), 87 thePDGMass(mass), << 104 thePDGMass(mass), 88 thePDGWidth(width), << 105 thePDGWidth(width), 89 thePDGCharge(charge), << 106 thePDGCharge(charge), 90 thePDGiSpin(iSpin), << 107 thePDGiSpin(iSpin), 91 thePDGSpin(iSpin*0.5), << 108 thePDGSpin(iSpin*0.5), 92 thePDGiParity(iParity), << 109 thePDGiParity(iParity), 93 thePDGiConjugation(iConjugation), << 110 thePDGiConjugation(iConjugation), 94 thePDGiGParity(gParity), << 111 thePDGiGParity(gParity), 95 thePDGiIsospin(iIsospin), << 112 thePDGiIsospin(iIsospin), 96 thePDGiIsospin3(iIsospin3), << 113 thePDGiIsospin3(iIsospin3), 97 thePDGIsospin(iIsospin*0.5), << 114 thePDGIsospin(iIsospin*0.5), 98 thePDGIsospin3(iIsospin3*0.5), << 115 thePDGIsospin3(iIsospin3*0.5), 99 thePDGMagneticMoment(magneticMoment), << 116 thePDGMagneticMoment(magneticMoment), 100 theLeptonNumber(lepton), << 117 theLeptonNumber(lepton), 101 theBaryonNumber(baryon), << 118 theBaryonNumber(baryon), 102 theParticleType(pType), << 119 theParticleType(pType), 103 theParticleSubType(subType), << 120 theParticleSubType(subType), 104 thePDGEncoding(encoding), << 121 thePDGEncoding(encoding), 105 theAntiPDGEncoding(-1*encoding), << 122 theAntiPDGEncoding(-1*encoding), 106 fShortLivedFlag(shortlived), << 123 fShortLivedFlag(shortlived), 107 thePDGStable(stable), << 124 thePDGStable(stable), 108 thePDGLifeTime(lifetime), << 125 thePDGLifeTime(lifetime), 109 theDecayTable(decaytable) << 126 theDecayTable(decaytable), 110 // clang-format on << 127 theAtomicNumber(0), 111 { << 128 theAtomicMass(0), 112 static const G4String nucleus("nucleus"); << 129 verboseLevel(1), 113 static const G4String muAtom("MuonicAtom"); << 130 fApplyCutsFlag(false), 114 << 131 isGeneralIon(false) 115 g4particleDefinitionInstanceID = -1; << 132 { 116 theProcessManagerShadow = nullptr; << 133 static G4String nucleus("nucleus"); 117 << 134 118 theParticleTable = G4ParticleTable::GetParti << 135 g4particleDefinitionInstanceID = -1; >> 136 theProcessManagerShadow = 0; >> 137 >> 138 theParticleTable = G4ParticleTable::GetParticleTable(); 119 139 120 // set verboseLevel equal to ParticleTable << 140 //set verboseLevel equal to ParticleTable 121 verboseLevel = theParticleTable->GetVerboseL << 141 verboseLevel = theParticleTable->GetVerboseLevel(); 122 142 123 if (anti_encoding != 0) theAntiPDGEncoding = << 143 if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding; 124 144 125 // check quark contents << 145 // check quark contents 126 if (this->FillQuarkContents() != thePDGEncod << 146 if (this->FillQuarkContents() != thePDGEncoding) { 127 #ifdef G4VERBOSE 147 #ifdef G4VERBOSE 128 if (verboseLevel > 0) { << 148 if (verboseLevel>0) { 129 // Using G4cout expecting that it is ava << 149 // Using G4cout expecting that it is available in construction of static objects 130 // in construction of static objects << 150 G4cout << "Particle " << aName << " has a strange PDGEncoding " <<G4endl; 131 G4cout << "Particle " << aName << " has << 151 } 132 } << 133 #endif 152 #endif 134 G4Exception("G4ParticleDefintion::G4Partic << 153 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 135 "Strange PDGEncoding "); << 154 "PART102", JustWarning, 136 } << 155 "Strange PDGEncoding "); >> 156 } 137 157 138 // check initialization is in Pre_Init state << 158 // check initialization is in Pre_Init state except for ions 139 G4ApplicationState currentState = G4StateMan << 159 G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState(); 140 160 141 if (!fShortLivedFlag && (theParticleType != << 161 if ( !fShortLivedFlag && (theParticleType!=nucleus) && (currentState!=G4State_PreInit)){ 142 && (currentState != G4State_PreInit)) << 143 { << 144 #ifdef G4VERBOSE 162 #ifdef G4VERBOSE 145 if (GetVerboseLevel() > 0) { << 163 if (GetVerboseLevel()>0) { 146 G4cout << "G4ParticleDefinition (other t << 164 G4cout << "G4ParticleDefintion (other than ions and shortlived) should be created in Pre_Init state " 147 << " should be created in Pre_Ini << 165 << aName << G4endl; 148 } << 166 } 149 #endif 167 #endif 150 G4Exception("G4ParticleDefintion::G4Partic << 168 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 151 "G4ParticleDefinition should b << 169 "PART101", JustWarning, 152 } << 170 "G4ParticleDefinition should be created in PreInit state"); >> 171 } >> 172 >> 173 >> 174 if (theParticleTable->GetIonTable()->IsIon(this)) { >> 175 SetAtomicNumber( G4int(GetPDGCharge()/eplus) ); >> 176 SetAtomicMass( GetBaryonNumber() ); >> 177 } >> 178 >> 179 if (theParticleTable->GetIonTable()->IsAntiIon(this)) { >> 180 SetAtomicNumber( std::abs(G4int(GetPDGCharge()/eplus)) ); >> 181 SetAtomicMass( std::abs(GetBaryonNumber()) ); >> 182 } >> 183 >> 184 // check name and register this particle into ParticleTable >> 185 theParticleTable->Insert(this); 153 186 154 if (theParticleTable->GetIonTable()->IsIon(t << 187 } 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 188 164 // check name and register this particle int << 189 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &) 165 theParticleTable->Insert(this); << 190 { >> 191 G4Exception("G4ParticleDefinition::G4ParticleDefinition()", >> 192 "PART001", FatalException, >> 193 "Illegal call of copy Constructor for G4ParticleDefinition "); 166 } 194 } 167 195 168 G4ParticleDefinition::G4ParticleDefinition() 196 G4ParticleDefinition::G4ParticleDefinition() 169 { 197 { 170 G4Exception("G4ParticleDefinition::G4Particl << 198 G4Exception("G4ParticleDefinition::G4ParticleDefinition()", 171 "Illegal call of default constru << 199 "PART001", FatalException, >> 200 "Illegal call of default Constructor for G4ParticleDefinition "); 172 } 201 } 173 202 174 G4ParticleDefinition::~G4ParticleDefinition() << 203 >> 204 G4ParticleDefinition::~G4ParticleDefinition() 175 { 205 { 176 if (G4ParticleTable::GetParticleTable()->Get 206 if (G4ParticleTable::GetParticleTable()->GetReadiness()) { 177 G4StateManager* pStateManager = G4StateMan 207 G4StateManager* pStateManager = G4StateManager::GetStateManager(); 178 G4ApplicationState currentState = pStateMa 208 G4ApplicationState currentState = pStateManager->GetCurrentState(); 179 if (currentState != G4State_PreInit) { 209 if (currentState != G4State_PreInit) { 180 G4String msg = "Request of deletion for 210 G4String msg = "Request of deletion for "; 181 msg += GetParticleName(); << 211 msg += GetParticleName(); 182 msg += " has No effects because readyToU 212 msg += " has No effects because readyToUse is true."; 183 G4Exception("G4ParticleDefinition::~G4Pa << 213 G4Exception("G4ParticleDefinition::~G4ParticleDefinition()", 184 return; << 214 "PART117", JustWarning, msg); 185 } << 215 return ; 186 << 216 } else { 187 #ifdef G4VERBOSE 217 #ifdef G4VERBOSE 188 if (verboseLevel > 0) { << 218 if (verboseLevel>0){ 189 G4cout << GetParticleName() << " will be << 219 G4cout << GetParticleName() 190 } << 220 << " will be deleted " << G4endl; >> 221 } 191 #endif 222 #endif >> 223 } 192 } 224 } 193 delete theDecayTable; << 194 } << 195 225 196 G4bool G4ParticleDefinition::operator==(const << 226 if (theDecayTable!= 0) delete theDecayTable; 197 { << 198 return (this->theParticleName == right.thePa << 199 } 227 } 200 228 201 G4bool G4ParticleDefinition::operator!=(const << 202 { << 203 return (this->theParticleName != right.thePa << 204 } << 205 229 206 const G4PDefManager& G4ParticleDefinition::Get << 230 const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right) 207 { 231 { 208 // Returns the private data instance manager << 232 if (this != &right) { 209 return subInstanceManager; << 233 } >> 234 return *this; 210 } 235 } 211 236 212 void G4ParticleDefinition::Clean() << 237 G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const 213 { 238 { 214 // Clears memory allocated by sub-instance m << 239 return (this->theParticleName == right.theParticleName); 215 subInstanceManager.FreeSlave(); << 216 } 240 } 217 241 218 G4ProcessManager* G4ParticleDefinition::GetPro << 242 G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const 219 { 243 { 220 if (g4particleDefinitionInstanceID < 0) retu << 244 return (this->theParticleName != right.theParticleName); 221 return G4MT_pmanager; << 222 } 245 } 223 246 224 G4VTrackingManager* G4ParticleDefinition::GetT << 247 G4ProcessManager* G4ParticleDefinition::GetProcessManager() const 225 { 248 { 226 if (g4particleDefinitionInstanceID < 0) retu << 249 if(g4particleDefinitionInstanceID<0) return 0; 227 return G4MT_tmanager; << 250 return G4MT_pmanager; 228 } 251 } 229 252 230 G4int G4ParticleDefinition::FillQuarkContents( 253 G4int G4ParticleDefinition::FillQuarkContents() >> 254 // calculate quark and anti-quark contents >> 255 // return value is PDG encoding for this particle. >> 256 // It means error if the return value is differnt from >> 257 // this->thePDGEncoding. 231 { 258 { 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; 259 G4int flavor; 238 for (flavor = 0; flavor < NumberOfQuarkFlavo << 260 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 239 theQuarkContent[flavor] = 0; << 261 theQuarkContent[flavor] = 0; 240 theAntiQuarkContent[flavor] = 0; 262 theAntiQuarkContent[flavor] = 0; 241 } 263 } 242 264 243 G4PDGCodeChecker checker; 265 G4PDGCodeChecker checker; 244 checker.SetVerboseLevel(verboseLevel); 266 checker.SetVerboseLevel(verboseLevel); 245 267 246 G4int temp = checker.CheckPDGCode(thePDGEnco 268 G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType); 247 269 248 if (temp != 0) { << 270 if ( temp != 0) { 249 for (flavor = 0; flavor < NumberOfQuarkFla << 271 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ 250 theQuarkContent[flavor] = checker.GetQua << 272 theQuarkContent[flavor] = checker.GetQuarkContent(flavor); 251 theAntiQuarkContent[flavor] = checker.Ge 273 theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor); 252 } 274 } 253 if ((theParticleType == "meson") || (thePa << 275 if ((theParticleType == "meson")||(theParticleType == "baryon")) { 254 // check charge 276 // check charge 255 if (!checker.CheckCharge(thePDGCharge)) << 277 if (!checker.CheckCharge(thePDGCharge) ){ 256 temp = 0; << 278 temp = 0; 257 G4Exception("G4ParticleDefintion::G4Pa << 279 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 258 "Inconsistent charge again << 280 "PART103", JustWarning, >> 281 "Inconsistent charge against PDG code "); 259 #ifdef G4VERBOSE 282 #ifdef G4VERBOSE 260 if (verboseLevel > 0) { << 283 if (verboseLevel>0) { 261 G4cout << "G4ParticleDefinition::Fil << 284 G4cout << "G4ParticleDefinition::FillQuarkContents : " 262 << " illegal charge (" << the << 285 << " illegal charge (" << thePDGCharge/eplus 263 << G4endl; << 286 << " PDG code=" << thePDGEncoding <<G4endl; 264 } << 287 } 265 #endif 288 #endif 266 } 289 } 267 // check spin << 290 // check spin 268 if (checker.GetSpin() != thePDGiSpin) { 291 if (checker.GetSpin() != thePDGiSpin) { 269 temp = 0; << 292 temp=0; 270 G4Exception("G4ParticleDefintion::G4Pa << 293 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 271 "Inconsistent spin against << 294 "PART104", JustWarning, >> 295 "Inconsistent spin against PDG code "); 272 #ifdef G4VERBOSE 296 #ifdef G4VERBOSE 273 if (verboseLevel > 0) { << 297 if (verboseLevel>0) { 274 G4cout << "G4ParticleDefinition::Fil << 298 G4cout << "G4ParticleDefinition::FillQuarkContents : " 275 << " illegal SPIN (" << thePD << 299 << " illegal SPIN (" << thePDGiSpin << "/2" 276 << " PDG code=" << thePDGEnco << 300 << " PDG code=" << thePDGEncoding <<G4endl; 277 } << 301 } 278 #endif 302 #endif 279 } 303 } 280 } 304 } 281 } 305 } 282 return temp; 306 return temp; 283 } 307 } 284 308 >> 309 //-- No longer needed to access to G4IonTable. >> 310 //-- Method GetIonLifeTime() itself is kept for compatibility >> 311 //-- but moved to icc file as an inlined method. >> 312 //G4double G4ParticleDefinition::GetIonLifeTime() const >> 313 //{ >> 314 // if(!isGeneralIon) return thePDGLifeTime; >> 315 // >> 316 // G4IonTable* ionTable = G4IonTable::GetIonTable(); >> 317 // return ionTable->GetLifeTime(this); >> 318 //} >> 319 285 void G4ParticleDefinition::DumpTable() const 320 void G4ParticleDefinition::DumpTable() const 286 { 321 { 287 G4cout << G4endl; 322 G4cout << G4endl; 288 G4cout << "--- G4ParticleDefinition ---" << 323 G4cout << "--- G4ParticleDefinition ---" << G4endl; 289 G4cout << " Particle Name : " << theParticle 324 G4cout << " Particle Name : " << theParticleName << G4endl; 290 G4cout << " PDG particle code : " << thePDGE 325 G4cout << " PDG particle code : " << thePDGEncoding; 291 G4cout << " [PDG anti-particle code: " << th << 326 G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl; 292 G4cout << " Mass [GeV/c2] : " << thePDGMass << 327 G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ; 293 G4cout << " Width : " << thePDGWidth / G << 328 G4cout << " Width : " << thePDGWidth/GeV << G4endl; 294 G4cout << " Lifetime [nsec] : " << thePDGLif << 329 G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl; 295 G4cout << " Charge [e]: " << thePDGCharge / << 330 G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl; 296 G4cout << " Spin : " << thePDGiSpin << "/2" 331 G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl; 297 G4cout << " Parity : " << thePDGiParity << G 332 G4cout << " Parity : " << thePDGiParity << G4endl; 298 G4cout << " Charge conjugation : " << thePDG 333 G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl; 299 G4cout << " Isospin : (I,Iz): (" << thePDGiI << 334 G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2"; 300 G4cout << " , " << thePDGiIsospin3 << "/2 ) 335 G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl; 301 G4cout << " GParity : " << thePDGiGParity << 336 G4cout << " GParity : " << thePDGiGParity << G4endl; 302 if (thePDGMagneticMoment != 0.0) { 337 if (thePDGMagneticMoment != 0.0) { 303 G4cout << " MagneticMoment [MeV/T] : " << << 338 G4cout << " MagneticMoment [MeV/T] : " << thePDGMagneticMoment/MeV*tesla << G4endl; 304 } 339 } 305 G4cout << " Quark contents (d,u,s,c,b,t) 340 G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0]; 306 G4cout << ", " << theQuarkContent[1]; 341 G4cout << ", " << theQuarkContent[1]; 307 G4cout << ", " << theQuarkContent[2]; 342 G4cout << ", " << theQuarkContent[2]; 308 G4cout << ", " << theQuarkContent[3]; 343 G4cout << ", " << theQuarkContent[3]; 309 G4cout << ", " << theQuarkContent[4]; 344 G4cout << ", " << theQuarkContent[4]; 310 G4cout << ", " << theQuarkContent[5] << G4en 345 G4cout << ", " << theQuarkContent[5] << G4endl; 311 G4cout << " AntiQuark contents 346 G4cout << " AntiQuark contents : " << theAntiQuarkContent[0]; 312 G4cout << ", " << theAntiQuarkContent[1]; 347 G4cout << ", " << theAntiQuarkContent[1]; 313 G4cout << ", " << theAntiQuarkContent[2]; 348 G4cout << ", " << theAntiQuarkContent[2]; 314 G4cout << ", " << theAntiQuarkContent[3]; 349 G4cout << ", " << theAntiQuarkContent[3]; 315 G4cout << ", " << theAntiQuarkContent[4]; 350 G4cout << ", " << theAntiQuarkContent[4]; 316 G4cout << ", " << theAntiQuarkContent[5] << 351 G4cout << ", " << theAntiQuarkContent[5] << G4endl; 317 G4cout << " Lepton number : " << theLeptonNu 352 G4cout << " Lepton number : " << theLeptonNumber; 318 G4cout << " Baryon number : " << theBaryonNu 353 G4cout << " Baryon number : " << theBaryonNumber << G4endl; 319 G4cout << " Particle type : " << theParticle << 354 G4cout << " Particle type : " << theParticleType ; 320 G4cout << " [" << theParticleSubType << "]" 355 G4cout << " [" << theParticleSubType << "]" << G4endl; 321 356 322 if ((theParticleTable->GetIonTable()->IsIon( << 357 if ( (theParticleTable->GetIonTable()->IsIon(this)) 323 || (theParticleTable->GetIonTable()->IsA << 358 || (theParticleTable->GetIonTable()->IsAntiIon(this)) ) { 324 { << 325 G4cout << " Atomic Number : " << GetAtomic 359 G4cout << " Atomic Number : " << GetAtomicNumber(); 326 G4cout << " Atomic Mass : " << GetAtomicM << 360 G4cout << " Atomic Mass : " << GetAtomicMass() << G4endl; 327 } 361 } 328 if (fShortLivedFlag) { << 362 if ( fShortLivedFlag ){ 329 G4cout << " ShortLived : ON" << G4endl; 363 G4cout << " ShortLived : ON" << G4endl; 330 } 364 } 331 365 332 if (IsGeneralIon()) { << 366 if ( IsGeneralIon() ) { 333 G4double lftm = GetIonLifeTime(); 367 G4double lftm = GetIonLifeTime(); 334 if (lftm < -1000.) { << 368 if(lftm<-1000.) 335 G4cout << " Stable : No data found -- un << 369 { G4cout << " Stable : No data found -- unknown" << G4endl; } 336 } << 370 else if(lftm<0.) 337 else if (lftm < 0.) { << 371 { G4cout << " Stable : stable" << G4endl; } 338 G4cout << " Stable : stable" << G4endl; << 372 else 339 } << 373 { 340 else { << 374 G4cout << " Stable : unstable -- lifetime = " << G4BestUnit(lftm,"Time") 341 G4cout << " Stable : unstable -- lifetim << 375 << "\n Decay table should be consulted to G4RadioactiveDecayProcess." 342 << "\n Decay table should be con << 376 << G4endl; 343 } 377 } 344 } 378 } 345 else { << 379 else 346 if (thePDGStable) { << 380 { >> 381 if ( thePDGStable ){ 347 G4cout << " Stable : stable" << G4endl; 382 G4cout << " Stable : stable" << G4endl; 348 } << 383 } else { 349 else { << 384 if( theDecayTable != 0 ){ 350 if (theDecayTable != nullptr) { << 351 theDecayTable->DumpInfo(); 385 theDecayTable->DumpInfo(); 352 } << 386 } else { 353 else { << 387 G4cout << "Decay Table is not defined !!" <<G4endl; 354 G4cout << "Decay Table is not defined << 355 } 388 } 356 } 389 } 357 } 390 } 358 } 391 } 359 392 360 void G4ParticleDefinition::SetApplyCutsFlag(G4 393 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg) 361 { 394 { 362 if (theParticleName == "gamma" || theParticl << 395 if(theParticleName=="gamma" 363 || theParticleName == "proton") << 396 || theParticleName=="e-" >> 397 || theParticleName=="e+" >> 398 || theParticleName=="proton") >> 399 { fApplyCutsFlag = flg; } >> 400 else 364 { 401 { 365 fApplyCutsFlag = flg; << 402 G4cout 366 } << 403 << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName 367 else { << 404 << G4endl; 368 G4cout << "G4ParticleDefinition::SetApplyC << 405 G4cout 369 G4cout << "becomes obsolete. Production th << 406 << "becomes obsolete. Production threshold is applied only for " 370 << "gamma, e- ,e+ and proton." << G << 407 << "gamma, e- ,e+ and proton." << G4endl; 371 } 408 } 372 } 409 } 373 410 374 G4double G4ParticleDefinition::CalculateAnomal << 411 G4double G4ParticleDefinition::CalculateAnomaly() const 375 { << 412 { 376 G4Exception("G4ParticleDefinition::G4Particl << 413 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 377 "CalculateAnomaly() method will << 414 "PART114", JustWarning, 378 << 415 "CalculateAnomaly() method will be removed in next release"); 379 // gives the anomaly of magnetic moment for << 416 380 if (thePDGiSpin == 1) { << 417 // gives the anomaly of magnetic moment for spin 1/2 particles 381 G4double muB = 0.5 * CLHEP::eplus * CLHEP: << 418 if (thePDGiSpin==1) { 382 return 0.5 * std::fabs(thePDGMagneticMomen << 419 G4double muB = 0.5*CLHEP::eplus*CLHEP::hbar_Planck/(thePDGMass/CLHEP::c_squared); >> 420 return 0.5*std::fabs(thePDGMagneticMoment/muB - 2.*thePDGCharge/CLHEP::eplus); >> 421 } else { >> 422 return 0.0; 383 } 423 } 384 << 385 return 0.0; << 386 } 424 } 387 425 388 void G4ParticleDefinition::SetParticleDefiniti 426 void G4ParticleDefinition::SetParticleDefinitionID(G4int id) 389 { 427 { 390 if (id < 0) { << 428 if(id<0) 391 g4particleDefinitionInstanceID = subInstan << 429 { 392 G4MT_pmanager = nullptr; << 430 g4particleDefinitionInstanceID = subInstanceManager.CreateSubInstance(); 393 } << 431 G4MT_pmanager = 0; 394 else { << 432 } 395 if (isGeneralIon || isMuonicAtom) { << 433 else 396 g4particleDefinitionInstanceID = id; << 434 { 397 } << 435 if(isGeneralIon) 398 else { << 436 { g4particleDefinitionInstanceID = id; } >> 437 else >> 438 { 399 G4ExceptionDescription ed; 439 G4ExceptionDescription ed; 400 ed << "ParticleDefinitionID should not b << 440 ed << "ParticleDefinitionID should not be set for the particles <" 401 G4Exception("G4ParticleDefintion::SetPar << 441 << theParticleName << ">."; >> 442 G4Exception( "G4ParticleDefintion::SetParticleDefinitionID","PART10114", >> 443 FatalException,ed); 402 } 444 } 403 } 445 } 404 } 446 } 405 447 406 void G4ParticleDefinition::SetProcessManager(G << 448 #include "G4Threading.hh" >> 449 >> 450 void G4ParticleDefinition::SetProcessManager(G4ProcessManager *aProcessManager) 407 { 451 { 408 if (g4particleDefinitionInstanceID < 0 && !i << 452 if(g4particleDefinitionInstanceID<0 && !isGeneralIon) 409 if (G4Threading::G4GetThreadId() >= 0) { << 453 { >> 454 if(G4Threading::G4GetThreadId() >= 0) >> 455 { 410 G4ExceptionDescription ed; 456 G4ExceptionDescription ed; 411 ed << "ProcessManager is being set to " 457 ed << "ProcessManager is being set to " << theParticleName 412 << " without proper initialization of 458 << " without proper initialization of TLS pointer vector.\n" 413 << "This operation is thread-unsafe." 459 << "This operation is thread-unsafe."; 414 G4Exception("G4ParticleDefintion::SetPro << 460 G4Exception( "G4ParticleDefintion::SetProcessManager","PART10116", >> 461 JustWarning,ed); 415 } 462 } 416 SetParticleDefinitionID(); 463 SetParticleDefinitionID(); 417 } 464 } 418 G4MT_pmanager = aProcessManager; 465 G4MT_pmanager = aProcessManager; 419 } << 420 << 421 void G4ParticleDefinition::SetTrackingManager( << 422 { << 423 if (g4particleDefinitionInstanceID < 0 && !i << 424 if (G4Threading::G4GetThreadId() >= 0) { << 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 } 466 } 435 467