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 26 // G4ParticleDefinition class implementation 27 // 27 // 28 // Authors: G.Cosmo, 2 December 1995 - Design, 28 // Authors: G.Cosmo, 2 December 1995 - Design, based on object model 29 // M.Asai, 29 January 1996 - First im 29 // M.Asai, 29 January 1996 - First implementation 30 // History: 30 // History: 31 // - 1996-2003, H.Kurashige - Revisions 31 // - 1996-2003, H.Kurashige - Revisions 32 // - 11.03.2003, H.Kurashige - Restructuring f 32 // - 11.03.2003, H.Kurashige - Restructuring for Cuts per Region 33 // - 25.01.2013, G.Cosmo, A.Dotti - Introduced 33 // - 25.01.2013, G.Cosmo, A.Dotti - Introduced thread-safety for MT 34 // - 15.06.2017, K.L.Genser - Added support fo 34 // - 15.06.2017, K.L.Genser - Added support for MuonicAtom 35 // ------------------------------------------- 35 // -------------------------------------------------------------------- 36 36 37 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleDefinition.hh" 38 << 38 #include "G4PhysicalConstants.hh" 39 #include "G4DecayTable.hh" << 39 #include "G4SystemOfUnits.hh" >> 40 #include "G4ParticleTable.hh" 40 #include "G4IonTable.hh" 41 #include "G4IonTable.hh" >> 42 #include "G4DecayTable.hh" 41 #include "G4PDGCodeChecker.hh" 43 #include "G4PDGCodeChecker.hh" 42 #include "G4ParticleTable.hh" << 43 #include "G4PhysicalConstants.hh" << 44 #include "G4StateManager.hh" 44 #include "G4StateManager.hh" 45 #include "G4SystemOfUnits.hh" << 46 #include "G4Threading.hh" << 47 #include "G4UnitsTable.hh" 45 #include "G4UnitsTable.hh" >> 46 #include "G4Threading.hh" 48 47 49 // This new field helps to use the class G4PDe 48 // This new field helps to use the class G4PDefManager. 50 // 49 // 51 G4PDefManager G4ParticleDefinition::subInstanc 50 G4PDefManager G4ParticleDefinition::subInstanceManager; 52 51 53 // This macro changes the references to fields 52 // This macro changes the references to fields that are now encapsulated 54 // in the class G4PDefData. 53 // in the class G4PDefData. 55 // 54 // 56 #define G4MT_pmanager \ << 55 #define G4MT_pmanager ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theProcessManager) 57 ((subInstanceManager.offset()[g4particleDefi << 56 #define G4MT_tmanager ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theTrackingManager) 58 #define G4MT_tmanager \ << 59 ((subInstanceManager.offset()[g4particleDefi << 60 57 61 // ------------------------------------------- 58 // -------------------------------------------------------------------- 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 << 111 { 106 { 112 static const G4String nucleus("nucleus"); << 107 static const G4String nucleus("nucleus"); 113 static const G4String muAtom("MuonicAtom"); << 108 static const G4String muAtom("MuonicAtom"); 114 109 115 g4particleDefinitionInstanceID = -1; << 110 g4particleDefinitionInstanceID = -1; 116 theProcessManagerShadow = nullptr; << 111 theProcessManagerShadow = 0; 117 112 118 theParticleTable = G4ParticleTable::GetParti << 113 theParticleTable = G4ParticleTable::GetParticleTable(); 119 114 120 // set verboseLevel equal to ParticleTable << 115 //set verboseLevel equal to ParticleTable 121 verboseLevel = theParticleTable->GetVerboseL << 116 verboseLevel = theParticleTable->GetVerboseLevel(); 122 117 123 if (anti_encoding != 0) theAntiPDGEncoding = << 118 if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding; 124 119 125 // check quark contents << 120 // check quark contents 126 if (this->FillQuarkContents() != thePDGEncod << 121 if (this->FillQuarkContents() != thePDGEncoding) >> 122 { 127 #ifdef G4VERBOSE 123 #ifdef G4VERBOSE 128 if (verboseLevel > 0) { << 124 if (verboseLevel>0) 129 // Using G4cout expecting that it is ava << 125 { 130 // in construction of static objects << 126 // Using G4cout expecting that it is available 131 G4cout << "Particle " << aName << " has << 127 // in construction of static objects 132 } << 128 G4cout << "Particle " << aName >> 129 << " has a strange PDGEncoding " << G4endl; >> 130 } 133 #endif 131 #endif 134 G4Exception("G4ParticleDefintion::G4Partic << 132 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 135 "Strange PDGEncoding "); << 133 "PART102", JustWarning, 136 } << 134 "Strange PDGEncoding "); 137 << 135 } 138 // check initialization is in Pre_Init state << 136 139 G4ApplicationState currentState = G4StateMan << 137 // check initialization is in Pre_Init state except for ions 140 << 138 G4ApplicationState currentState 141 if (!fShortLivedFlag && (theParticleType != << 139 = G4StateManager::GetStateManager()->GetCurrentState(); 142 && (currentState != G4State_PreInit)) << 140 143 { << 141 if ( !fShortLivedFlag && (theParticleType!=nucleus) >> 142 && (theParticleType!=muAtom) && (currentState!=G4State_PreInit)) >> 143 { 144 #ifdef G4VERBOSE 144 #ifdef G4VERBOSE 145 if (GetVerboseLevel() > 0) { << 145 if (GetVerboseLevel()>0) 146 G4cout << "G4ParticleDefinition (other t << 146 { 147 << " should be created in Pre_Ini << 147 G4cout << "G4ParticleDefinition (other than ions and shortlived)" 148 } << 148 << " should be created in Pre_Init state - " >> 149 << aName << G4endl; >> 150 } 149 #endif 151 #endif 150 G4Exception("G4ParticleDefintion::G4Partic << 152 G4Exception("G4ParticleDefintion::G4ParticleDefinition()", 151 "G4ParticleDefinition should b << 153 "PART101", JustWarning, 152 } << 154 "G4ParticleDefinition should be created in PreInit state"); 153 << 155 } 154 if (theParticleTable->GetIonTable()->IsIon(t << 156 155 SetAtomicNumber(G4int(GetPDGCharge() / epl << 157 156 SetAtomicMass(GetBaryonNumber()); << 158 if (theParticleTable->GetIonTable()->IsIon(this)) 157 } << 159 { 158 << 160 SetAtomicNumber( G4int(GetPDGCharge()/eplus) ); 159 if (theParticleTable->GetIonTable()->IsAntiI << 161 SetAtomicMass( GetBaryonNumber() ); 160 SetAtomicNumber(std::abs(G4int(GetPDGCharg << 162 } 161 SetAtomicMass(std::abs(GetBaryonNumber())) << 163 162 } << 164 if (theParticleTable->GetIonTable()->IsAntiIon(this)) 163 << 165 { 164 // check name and register this particle int << 166 SetAtomicNumber( std::abs(G4int(GetPDGCharge()/eplus)) ); 165 theParticleTable->Insert(this); << 167 SetAtomicMass( std::abs(GetBaryonNumber()) ); >> 168 } >> 169 >> 170 // check name and register this particle into ParticleTable >> 171 theParticleTable->Insert(this); 166 } 172 } 167 173 >> 174 // -------------------------------------------------------------------- 168 G4ParticleDefinition::G4ParticleDefinition() 175 G4ParticleDefinition::G4ParticleDefinition() 169 { 176 { 170 G4Exception("G4ParticleDefinition::G4Particl << 177 G4Exception("G4ParticleDefinition::G4ParticleDefinition()", >> 178 "PART001", FatalException, 171 "Illegal call of default constru 179 "Illegal call of default constructor for G4ParticleDefinition!"); 172 } 180 } 173 181 174 G4ParticleDefinition::~G4ParticleDefinition() << 182 // -------------------------------------------------------------------- >> 183 G4ParticleDefinition::~G4ParticleDefinition() 175 { 184 { 176 if (G4ParticleTable::GetParticleTable()->Get << 185 if (G4ParticleTable::GetParticleTable()->GetReadiness()) >> 186 { 177 G4StateManager* pStateManager = G4StateMan 187 G4StateManager* pStateManager = G4StateManager::GetStateManager(); 178 G4ApplicationState currentState = pStateMa 188 G4ApplicationState currentState = pStateManager->GetCurrentState(); 179 if (currentState != G4State_PreInit) { << 189 if (currentState != G4State_PreInit) >> 190 { 180 G4String msg = "Request of deletion for 191 G4String msg = "Request of deletion for "; 181 msg += GetParticleName(); << 192 msg += GetParticleName(); 182 msg += " has No effects because readyToU 193 msg += " has No effects because readyToUse is true."; 183 G4Exception("G4ParticleDefinition::~G4Pa << 194 G4Exception("G4ParticleDefinition::~G4ParticleDefinition()", 184 return; << 195 "PART117", JustWarning, msg); >> 196 return ; 185 } 197 } 186 << 198 else >> 199 { 187 #ifdef G4VERBOSE 200 #ifdef G4VERBOSE 188 if (verboseLevel > 0) { << 201 if (verboseLevel>0) 189 G4cout << GetParticleName() << " will be << 202 { 190 } << 203 G4cout << GetParticleName() << " will be deleted..." << G4endl; >> 204 } 191 #endif 205 #endif >> 206 } 192 } 207 } 193 delete theDecayTable; 208 delete theDecayTable; 194 } 209 } 195 210 196 G4bool G4ParticleDefinition::operator==(const << 211 // -------------------------------------------------------------------- >> 212 G4bool G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const 197 { 213 { 198 return (this->theParticleName == right.thePa 214 return (this->theParticleName == right.theParticleName); 199 } 215 } 200 216 201 G4bool G4ParticleDefinition::operator!=(const << 217 // -------------------------------------------------------------------- >> 218 G4bool G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const 202 { 219 { 203 return (this->theParticleName != right.thePa 220 return (this->theParticleName != right.theParticleName); 204 } 221 } 205 222 >> 223 // -------------------------------------------------------------------- 206 const G4PDefManager& G4ParticleDefinition::Get 224 const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager() 207 { 225 { 208 // Returns the private data instance manager 226 // Returns the private data instance manager 209 return subInstanceManager; 227 return subInstanceManager; 210 } 228 } 211 229 >> 230 // -------------------------------------------------------------------- 212 void G4ParticleDefinition::Clean() 231 void G4ParticleDefinition::Clean() 213 { 232 { 214 // Clears memory allocated by sub-instance m 233 // Clears memory allocated by sub-instance manager 215 subInstanceManager.FreeSlave(); 234 subInstanceManager.FreeSlave(); 216 } 235 } 217 236 >> 237 // -------------------------------------------------------------------- 218 G4ProcessManager* G4ParticleDefinition::GetPro 238 G4ProcessManager* G4ParticleDefinition::GetProcessManager() const 219 { 239 { 220 if (g4particleDefinitionInstanceID < 0) retu << 240 if(g4particleDefinitionInstanceID<0) return nullptr; 221 return G4MT_pmanager; 241 return G4MT_pmanager; 222 } 242 } 223 243 >> 244 // -------------------------------------------------------------------- 224 G4VTrackingManager* G4ParticleDefinition::GetT 245 G4VTrackingManager* G4ParticleDefinition::GetTrackingManager() const 225 { 246 { 226 if (g4particleDefinitionInstanceID < 0) retu << 247 if(g4particleDefinitionInstanceID<0) return nullptr; 227 return G4MT_tmanager; 248 return G4MT_tmanager; 228 } 249 } 229 250 >> 251 // -------------------------------------------------------------------- 230 G4int G4ParticleDefinition::FillQuarkContents( 252 G4int G4ParticleDefinition::FillQuarkContents() 231 { 253 { 232 // Calculate quark and anti-quark contents 254 // Calculate quark and anti-quark contents 233 // Returned value is the PDG encoding for th 255 // Returned value is the PDG encoding for this particle. 234 // It means error if the return value is dif 256 // It means error if the return value is different from 235 // this->thePDGEncoding 257 // this->thePDGEncoding 236 258 237 G4int flavor; 259 G4int flavor; 238 for (flavor = 0; flavor < NumberOfQuarkFlavo << 260 for (flavor= 0; flavor<NumberOfQuarkFlavor; ++flavor) 239 theQuarkContent[flavor] = 0; << 261 { >> 262 theQuarkContent[flavor] = 0; 240 theAntiQuarkContent[flavor] = 0; 263 theAntiQuarkContent[flavor] = 0; 241 } 264 } 242 265 243 G4PDGCodeChecker checker; 266 G4PDGCodeChecker checker; 244 checker.SetVerboseLevel(verboseLevel); 267 checker.SetVerboseLevel(verboseLevel); 245 268 246 G4int temp = checker.CheckPDGCode(thePDGEnco 269 G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType); 247 270 248 if (temp != 0) { << 271 if ( temp != 0) 249 for (flavor = 0; flavor < NumberOfQuarkFla << 272 { 250 theQuarkContent[flavor] = checker.GetQua << 273 for (flavor= 0; flavor<NumberOfQuarkFlavor; ++flavor) >> 274 { >> 275 theQuarkContent[flavor] = checker.GetQuarkContent(flavor); 251 theAntiQuarkContent[flavor] = checker.Ge 276 theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor); 252 } 277 } 253 if ((theParticleType == "meson") || (thePa << 278 if ((theParticleType == "meson")||(theParticleType == "baryon")) >> 279 { 254 // check charge 280 // check charge 255 if (!checker.CheckCharge(thePDGCharge)) << 281 if ( !checker.CheckCharge(thePDGCharge) ) >> 282 { 256 temp = 0; 283 temp = 0; 257 G4Exception("G4ParticleDefintion::G4Pa << 284 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 258 "Inconsistent charge again << 285 "PART103", JustWarning, >> 286 "Inconsistent charge against PDG code "); 259 #ifdef G4VERBOSE 287 #ifdef G4VERBOSE 260 if (verboseLevel > 0) { << 288 if (verboseLevel>0) >> 289 { 261 G4cout << "G4ParticleDefinition::Fil 290 G4cout << "G4ParticleDefinition::FillQuarkContents : " 262 << " illegal charge (" << the << 291 << " illegal charge (" << thePDGCharge/eplus 263 << G4endl; << 292 << " PDG code=" << thePDGEncoding << G4endl; 264 } 293 } 265 #endif 294 #endif 266 } 295 } 267 // check spin << 296 // check spin 268 if (checker.GetSpin() != thePDGiSpin) { << 297 if (checker.GetSpin() != thePDGiSpin) >> 298 { 269 temp = 0; 299 temp = 0; 270 G4Exception("G4ParticleDefintion::G4Pa << 300 G4Exception( "G4ParticleDefintion::G4ParticleDefintion", 271 "Inconsistent spin against << 301 "PART104", JustWarning, >> 302 "Inconsistent spin against PDG code "); 272 #ifdef G4VERBOSE 303 #ifdef G4VERBOSE 273 if (verboseLevel > 0) { << 304 if (verboseLevel>0) >> 305 { 274 G4cout << "G4ParticleDefinition::Fil 306 G4cout << "G4ParticleDefinition::FillQuarkContents : " 275 << " illegal SPIN (" << thePD 307 << " illegal SPIN (" << thePDGiSpin << "/2" 276 << " PDG code=" << thePDGEnco << 308 << " PDG code=" << thePDGEncoding <<G4endl; 277 } 309 } 278 #endif 310 #endif 279 } 311 } 280 } 312 } 281 } 313 } 282 return temp; 314 return temp; 283 } 315 } 284 316 >> 317 // -------------------------------------------------------------------- 285 void G4ParticleDefinition::DumpTable() const 318 void G4ParticleDefinition::DumpTable() const 286 { 319 { 287 G4cout << G4endl; 320 G4cout << G4endl; 288 G4cout << "--- G4ParticleDefinition ---" << 321 G4cout << "--- G4ParticleDefinition ---" << G4endl; 289 G4cout << " Particle Name : " << theParticle 322 G4cout << " Particle Name : " << theParticleName << G4endl; 290 G4cout << " PDG particle code : " << thePDGE 323 G4cout << " PDG particle code : " << thePDGEncoding; 291 G4cout << " [PDG anti-particle code: " << th << 324 G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl; 292 G4cout << " Mass [GeV/c2] : " << thePDGMass << 325 G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ; 293 G4cout << " Width : " << thePDGWidth / G << 326 G4cout << " Width : " << thePDGWidth/GeV << G4endl; 294 G4cout << " Lifetime [nsec] : " << thePDGLif << 327 G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl; 295 G4cout << " Charge [e]: " << thePDGCharge / << 328 G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl; 296 G4cout << " Spin : " << thePDGiSpin << "/2" 329 G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl; 297 G4cout << " Parity : " << thePDGiParity << G 330 G4cout << " Parity : " << thePDGiParity << G4endl; 298 G4cout << " Charge conjugation : " << thePDG 331 G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl; 299 G4cout << " Isospin : (I,Iz): (" << thePDGiI << 332 G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2"; 300 G4cout << " , " << thePDGiIsospin3 << "/2 ) 333 G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl; 301 G4cout << " GParity : " << thePDGiGParity << 334 G4cout << " GParity : " << thePDGiGParity << G4endl; 302 if (thePDGMagneticMoment != 0.0) { << 335 if (thePDGMagneticMoment != 0.0) 303 G4cout << " MagneticMoment [MeV/T] : " << << 336 { >> 337 G4cout << " MagneticMoment [MeV/T] : " >> 338 << 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 { 359 { 325 G4cout << " Atomic Number : " << GetAtomic 360 G4cout << " Atomic Number : " << GetAtomicNumber(); 326 G4cout << " Atomic Mass : " << GetAtomicM << 361 G4cout << " Atomic Mass : " << GetAtomicMass() << G4endl; 327 } 362 } 328 if (fShortLivedFlag) { << 363 if ( fShortLivedFlag ) >> 364 { 329 G4cout << " ShortLived : ON" << G4endl; 365 G4cout << " ShortLived : ON" << G4endl; 330 } 366 } 331 367 332 if (IsGeneralIon()) { << 368 if ( IsGeneralIon() ) >> 369 { 333 G4double lftm = GetIonLifeTime(); 370 G4double lftm = GetIonLifeTime(); 334 if (lftm < -1000.) { << 371 if(lftm<-1000.) 335 G4cout << " Stable : No data found -- un << 372 { G4cout << " Stable : No data found -- unknown" << G4endl; } 336 } << 373 else if(lftm<0.) 337 else if (lftm < 0.) { << 374 { G4cout << " Stable : stable" << G4endl; } 338 G4cout << " Stable : stable" << G4endl; << 375 else 339 } << 376 { 340 else { << 377 G4cout << " Stable : unstable -- lifetime = " << G4BestUnit(lftm,"Time") 341 G4cout << " Stable : unstable -- lifetim << 378 << "\n Decay table should be consulted to G4RadioactiveDecayProcess." 342 << "\n Decay table should be con << 379 << G4endl; 343 } 380 } 344 } 381 } 345 else { << 382 else 346 if (thePDGStable) { << 383 { >> 384 if ( thePDGStable ) >> 385 { 347 G4cout << " Stable : stable" << G4endl; 386 G4cout << " Stable : stable" << G4endl; 348 } 387 } 349 else { << 388 else 350 if (theDecayTable != nullptr) { << 389 { >> 390 if( theDecayTable != nullptr ) >> 391 { 351 theDecayTable->DumpInfo(); 392 theDecayTable->DumpInfo(); 352 } 393 } 353 else { << 394 else 354 G4cout << "Decay Table is not defined << 395 { >> 396 G4cout << "Decay Table is not defined !!" <<G4endl; 355 } 397 } 356 } 398 } 357 } 399 } 358 } 400 } 359 401 >> 402 // -------------------------------------------------------------------- 360 void G4ParticleDefinition::SetApplyCutsFlag(G4 403 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg) 361 { 404 { 362 if (theParticleName == "gamma" || theParticl << 405 if (theParticleName=="gamma" 363 || theParticleName == "proton") << 406 || theParticleName=="e-" >> 407 || theParticleName=="e+" >> 408 || theParticleName=="proton") 364 { 409 { 365 fApplyCutsFlag = flg; 410 fApplyCutsFlag = flg; 366 } 411 } 367 else { << 412 else 368 G4cout << "G4ParticleDefinition::SetApplyC << 413 { 369 G4cout << "becomes obsolete. Production th << 414 G4cout 370 << "gamma, e- ,e+ and proton." << G << 415 << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName >> 416 << G4endl; >> 417 G4cout >> 418 << "becomes obsolete. Production threshold is applied only for " >> 419 << "gamma, e- ,e+ and proton." << G4endl; 371 } 420 } 372 } 421 } 373 422 374 G4double G4ParticleDefinition::CalculateAnomal << 423 // -------------------------------------------------------------------- >> 424 G4double G4ParticleDefinition::CalculateAnomaly() const 375 { 425 { 376 G4Exception("G4ParticleDefinition::G4Particl << 426 G4Exception("G4ParticleDefinition::G4ParticleDefinition", >> 427 "PART114", JustWarning, 377 "CalculateAnomaly() method will 428 "CalculateAnomaly() method will be removed in future releases"); 378 << 429 379 // gives the anomaly of magnetic moment for << 430 // gives the anomaly of magnetic moment for spin 1/2 particles 380 if (thePDGiSpin == 1) { << 431 if (thePDGiSpin==1) 381 G4double muB = 0.5 * CLHEP::eplus * CLHEP: << 432 { 382 return 0.5 * std::fabs(thePDGMagneticMomen << 433 G4double muB = 0.5*CLHEP::eplus*CLHEP::hbar_Planck >> 434 / (thePDGMass/CLHEP::c_squared); >> 435 return 0.5*std::fabs(thePDGMagneticMoment/muB >> 436 - 2.*thePDGCharge/CLHEP::eplus); >> 437 } >> 438 else >> 439 { >> 440 return 0.0; 383 } 441 } 384 << 385 return 0.0; << 386 } 442 } 387 443 >> 444 // -------------------------------------------------------------------- 388 void G4ParticleDefinition::SetParticleDefiniti 445 void G4ParticleDefinition::SetParticleDefinitionID(G4int id) 389 { 446 { 390 if (id < 0) { << 447 if(id<0) 391 g4particleDefinitionInstanceID = subInstan << 448 { >> 449 g4particleDefinitionInstanceID = subInstanceManager.CreateSubInstance(); 392 G4MT_pmanager = nullptr; 450 G4MT_pmanager = nullptr; 393 } 451 } 394 else { << 452 else 395 if (isGeneralIon || isMuonicAtom) { << 453 { 396 g4particleDefinitionInstanceID = id; << 454 if( isGeneralIon || isMuonicAtom ) 397 } << 455 { g4particleDefinitionInstanceID = id; } 398 else { << 456 else >> 457 { 399 G4ExceptionDescription ed; 458 G4ExceptionDescription ed; 400 ed << "ParticleDefinitionID should not b << 459 ed << "ParticleDefinitionID should not be set for the particles <" 401 G4Exception("G4ParticleDefintion::SetPar << 460 << theParticleName << ">."; >> 461 G4Exception("G4ParticleDefintion::SetParticleDefinitionID", >> 462 "PART10114", FatalException, ed); 402 } 463 } 403 } 464 } 404 } 465 } 405 466 >> 467 // -------------------------------------------------------------------- 406 void G4ParticleDefinition::SetProcessManager(G 468 void G4ParticleDefinition::SetProcessManager(G4ProcessManager* aProcessManager) 407 { 469 { 408 if (g4particleDefinitionInstanceID < 0 && !i << 470 if(g4particleDefinitionInstanceID<0 && !isGeneralIon) 409 if (G4Threading::G4GetThreadId() >= 0) { << 471 { >> 472 if(G4Threading::G4GetThreadId() >= 0) >> 473 { 410 G4ExceptionDescription ed; 474 G4ExceptionDescription ed; 411 ed << "ProcessManager is being set to " 475 ed << "ProcessManager is being set to " << theParticleName 412 << " without proper initialization of 476 << " without proper initialization of TLS pointer vector.\n" 413 << "This operation is thread-unsafe." 477 << "This operation is thread-unsafe."; 414 G4Exception("G4ParticleDefintion::SetPro << 478 G4Exception("G4ParticleDefintion::SetProcessManager", >> 479 "PART10116", JustWarning, ed); 415 } 480 } 416 SetParticleDefinitionID(); 481 SetParticleDefinitionID(); 417 } 482 } 418 G4MT_pmanager = aProcessManager; 483 G4MT_pmanager = aProcessManager; 419 } 484 } 420 485 >> 486 // -------------------------------------------------------------------- 421 void G4ParticleDefinition::SetTrackingManager( 487 void G4ParticleDefinition::SetTrackingManager(G4VTrackingManager* aTrackingManager) 422 { 488 { 423 if (g4particleDefinitionInstanceID < 0 && !i << 489 if(g4particleDefinitionInstanceID<0 && !isGeneralIon) 424 if (G4Threading::G4GetThreadId() >= 0) { << 490 { >> 491 if(G4Threading::G4GetThreadId() >= 0) >> 492 { 425 G4ExceptionDescription ed; 493 G4ExceptionDescription ed; 426 ed << "TrackingManager is being set to " 494 ed << "TrackingManager is being set to " << theParticleName 427 << " without proper initialization of 495 << " without proper initialization of TLS pointer vector.\n" 428 << "This operation is thread-unsafe." 496 << "This operation is thread-unsafe."; 429 G4Exception("G4ParticleDefintion::SetTra << 497 G4Exception("G4ParticleDefintion::SetTrackingManager", >> 498 "PART10118", JustWarning, ed); 430 } 499 } 431 SetParticleDefinitionID(); 500 SetParticleDefinitionID(); 432 } 501 } 433 G4MT_tmanager = aTrackingManager; 502 G4MT_tmanager = aTrackingManager; 434 } 503 } 435 504