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 inline methods impleme 26 // G4ParticleDefinition inline methods 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 // ------------------------------------------- 30 // -------------------------------------------------------------------- 31 31 32 inline G4int G4ParticleDefinition::GetInstance << 32 inline 33 { << 33 G4int G4ParticleDefinition::GetInstanceID() const 34 return g4particleDefinitionInstanceID; << 34 { >> 35 return g4particleDefinitionInstanceID; 35 } 36 } 36 37 37 inline G4bool G4ParticleDefinition::GetPDGStab << 38 inline >> 39 G4bool G4ParticleDefinition::GetPDGStable() const 38 { 40 { 39 if (IsGeneralIon()) { << 41 if(IsGeneralIon()) 40 return (GetIonLifeTime() < 0.); << 42 { return (GetIonLifeTime()<0.); } 41 } << 43 else 42 << 44 { return thePDGStable; } 43 return thePDGStable; << 44 } 45 } 45 46 46 inline G4double G4ParticleDefinition::GetPDGLi << 47 inline >> 48 G4double G4ParticleDefinition::GetPDGLifeTime() const 47 { 49 { 48 return thePDGLifeTime; 50 return thePDGLifeTime; 49 } 51 } 50 52 51 inline G4double G4ParticleDefinition::GetIonLi << 53 inline >> 54 G4double G4ParticleDefinition::GetIonLifeTime() const 52 { 55 { 53 //-- No longer needed to access to G4IonTabl 56 //-- No longer needed to access to G4IonTable. 54 //-- Method GetIonLifeTime() itself is kept 57 //-- Method GetIonLifeTime() itself is kept for compatibility 55 58 56 return thePDGLifeTime; 59 return thePDGLifeTime; 57 } 60 } 58 61 59 inline G4ParticleTable* G4ParticleDefinition:: << 62 inline 60 { << 63 G4ParticleTable* G4ParticleDefinition::GetParticleTable() const 61 return theParticleTable; << 64 { >> 65 return theParticleTable; 62 } 66 } 63 67 64 inline G4DecayTable* G4ParticleDefinition::Get << 68 inline 65 { << 69 G4DecayTable* G4ParticleDefinition::GetDecayTable() const 66 return theDecayTable; << 70 { >> 71 return theDecayTable; 67 } 72 } 68 73 69 inline void G4ParticleDefinition::SetDecayTabl << 74 inline 70 { << 75 void G4ParticleDefinition::SetDecayTable(G4DecayTable* aDecayTable) 71 theDecayTable = aDecayTable; << 76 { >> 77 theDecayTable = aDecayTable; 72 } 78 } 73 79 74 inline void G4ParticleDefinition::SetVerboseLe << 80 inline >> 81 void G4ParticleDefinition::SetVerboseLevel(G4int value) 75 { 82 { 76 verboseLevel = value; 83 verboseLevel = value; 77 } 84 } 78 85 79 inline G4int G4ParticleDefinition::GetVerboseL << 86 inline >> 87 G4int G4ParticleDefinition::GetVerboseLevel() const 80 { 88 { 81 return verboseLevel; 89 return verboseLevel; 82 } 90 } 83 91 84 inline G4ProcessManager* G4ParticleDefinition: << 92 inline >> 93 G4ProcessManager* G4ParticleDefinition::GetMasterProcessManager() const 85 { 94 { 86 return theProcessManagerShadow; 95 return theProcessManagerShadow; 87 } 96 } 88 97 89 inline void G4ParticleDefinition::SetMasterPro << 98 inline >> 99 void G4ParticleDefinition::SetMasterProcessManager( G4ProcessManager* aNewPM ) 90 { 100 { 91 theProcessManagerShadow = aNewPM; 101 theProcessManagerShadow = aNewPM; 92 } 102 } 93 103 94 inline G4int G4ParticleDefinition::GetQuarkCon << 104 inline >> 105 G4int G4ParticleDefinition::GetQuarkContent(G4int flavor) const 95 { 106 { 96 G4int content = 0; << 107 G4int content = 0; 97 if ((flavor > 0) && (flavor <= NumberOfQuark << 108 if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)) 98 content = theQuarkContent[flavor - 1]; << 109 { >> 110 content = theQuarkContent[flavor-1]; 99 } 111 } 100 else { << 112 else >> 113 { 101 #ifdef G4VERBOSE 114 #ifdef G4VERBOSE 102 if (verboseLevel > 0) { << 115 if (verboseLevel >0) >> 116 { 103 std::ostringstream message; 117 std::ostringstream message; 104 message << "Invalid Quark Flavor: " << f 118 message << "Invalid Quark Flavor: " << flavor; 105 G4Exception("G4ParticleDefinition::GetQu << 119 G4Exception("G4ParticleDefinition::GetQuarkContent()", >> 120 "InvalidFlavor", JustWarning, message); 106 } 121 } 107 #endif 122 #endif 108 } 123 } 109 return content; << 124 return content; 110 } 125 } 111 126 112 inline G4int G4ParticleDefinition::GetAntiQuar << 127 inline >> 128 G4int G4ParticleDefinition::GetAntiQuarkContent(G4int flavor) const 113 { 129 { 114 G4int content = 0; 130 G4int content = 0; 115 if ((flavor > 0) && (flavor <= NumberOfQuark << 131 if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)) 116 content = theAntiQuarkContent[flavor - 1]; << 132 { >> 133 content = theAntiQuarkContent[flavor-1]; 117 } 134 } 118 else { << 135 else >> 136 { 119 #ifdef G4VERBOSE 137 #ifdef G4VERBOSE 120 if (verboseLevel > 0) { << 138 if (verboseLevel >0) >> 139 { 121 std::ostringstream message; 140 std::ostringstream message; 122 message << "Invalid Quark Flavor: " << f 141 message << "Invalid Quark Flavor: " << flavor; 123 G4Exception("G4ParticleDefinition::GetAn << 142 G4Exception("G4ParticleDefinition::GetAntiQuarkContent()", 124 message); << 143 "InvalidFlavor", JustWarning, message); 125 } 144 } 126 #endif 145 #endif 127 } << 146 } 128 return content; 147 return content; 129 } 148 } 130 149 131 inline void G4ParticleDefinition::SetParticleS << 150 inline >> 151 void G4ParticleDefinition::SetParticleSubType(const G4String& subtype) 132 { 152 { 133 theParticleSubType = subtype; 153 theParticleSubType = subtype; 134 } 154 } 135 << 155 136 inline void G4ParticleDefinition::SetAntiPDGEn << 156 inline 137 { << 157 void G4ParticleDefinition::SetAntiPDGEncoding(G4int aEncoding) 138 theAntiPDGEncoding = aEncoding; << 158 { >> 159 theAntiPDGEncoding = aEncoding; 139 } 160 } 140 161 141 inline G4bool G4ParticleDefinition::GetApplyCu << 162 inline >> 163 G4bool G4ParticleDefinition::GetApplyCutsFlag() const 142 { 164 { 143 return fApplyCutsFlag; 165 return fApplyCutsFlag; 144 } 166 } 145 167 146 inline void G4ParticleDefinition::SetAtomicNum << 168 inline >> 169 void G4ParticleDefinition::SetAtomicNumber(G4int i) 147 { 170 { 148 theAtomicNumber = i; 171 theAtomicNumber = i; 149 } 172 } 150 173 151 inline G4int G4ParticleDefinition::GetAtomicNu << 174 inline >> 175 G4int G4ParticleDefinition::GetAtomicNumber() const 152 { 176 { 153 return theAtomicNumber; 177 return theAtomicNumber; 154 } 178 } 155 179 156 inline void G4ParticleDefinition::SetAtomicMas << 180 inline >> 181 void G4ParticleDefinition::SetAtomicMass(G4int i) 157 { 182 { 158 theAtomicMass = i; 183 theAtomicMass = i; 159 } 184 } 160 185 161 inline G4int G4ParticleDefinition::GetAtomicMa << 186 inline >> 187 G4int G4ParticleDefinition::GetAtomicMass() const 162 { 188 { 163 return theAtomicMass; 189 return theAtomicMass; 164 } 190 } 165 191 166 inline void G4ParticleDefinition::SetPDGMagnet << 192 inline >> 193 void G4ParticleDefinition::SetPDGMagneticMoment(G4double magneticMoment) 167 { 194 { 168 thePDGMagneticMoment = magneticMoment; 195 thePDGMagneticMoment = magneticMoment; 169 } 196 } 170 197 171 inline G4bool G4ParticleDefinition::IsGeneralI << 198 inline >> 199 G4bool G4ParticleDefinition::IsGeneralIon() const 172 { 200 { 173 return isGeneralIon; 201 return isGeneralIon; 174 } 202 } 175 203 176 inline G4bool G4ParticleDefinition::IsMuonicAt << 204 inline >> 205 G4bool G4ParticleDefinition::IsMuonicAtom() const 177 { 206 { 178 return isMuonicAtom; 207 return isMuonicAtom; 179 } 208 } 180 209 181 inline G4int G4ParticleDefinition::GetParticle << 210 inline >> 211 G4int G4ParticleDefinition::GetParticleDefinitionID() const 182 { 212 { 183 return g4particleDefinitionInstanceID; << 213 return g4particleDefinitionInstanceID; 184 } 214 } 185 215 186 inline G4bool G4ParticleDefinition::IsHypernuc << 216 inline >> 217 G4bool G4ParticleDefinition::IsHypernucleus() const 187 { 218 { 188 return GetNumberOfLambdasInHypernucleus() > << 219 if ( GetNumberOfLambdasInHypernucleus() > 0 ) return true; >> 220 return false; 189 } 221 } 190 222 191 inline G4int G4ParticleDefinition::GetNumberOf << 223 inline >> 224 G4int G4ParticleDefinition::GetNumberOfLambdasInHypernucleus() const 192 { 225 { 193 G4int numberOfLambdas = 0; 226 G4int numberOfLambdas = 0; 194 // PDG code of hypernuclei: 10LZZZAAAI 227 // PDG code of hypernuclei: 10LZZZAAAI 195 if (thePDGEncoding > 0 && thePDGEncoding / 1 << 228 if ( thePDGEncoding > 0 && thePDGEncoding/1000000000 != 0 ) { 196 numberOfLambdas = (thePDGEncoding / 100000 << 229 numberOfLambdas = (thePDGEncoding/10000000)%100; 197 } 230 } 198 return numberOfLambdas; 231 return numberOfLambdas; 199 } 232 } 200 233 201 inline G4bool G4ParticleDefinition::IsAntiHype << 234 inline >> 235 G4bool G4ParticleDefinition::IsAntiHypernucleus() const 202 { 236 { 203 return GetNumberOfAntiLambdasInAntiHypernucl << 237 if ( GetNumberOfAntiLambdasInAntiHypernucleus() > 0 ) return true; >> 238 return false; 204 } 239 } 205 240 206 inline G4int G4ParticleDefinition::GetNumberOf << 241 inline >> 242 G4int G4ParticleDefinition::GetNumberOfAntiLambdasInAntiHypernucleus() const 207 { 243 { 208 G4int numberOfAntiLambdas = 0; 244 G4int numberOfAntiLambdas = 0; 209 // PDG code of anti-hypernuclei: -10LZZZAAAI 245 // PDG code of anti-hypernuclei: -10LZZZAAAI 210 if (thePDGEncoding < 0 && thePDGEncoding / 1 << 246 if ( thePDGEncoding < 0 && thePDGEncoding/1000000000 != 0 ) { 211 numberOfAntiLambdas = (std::abs(thePDGEnco << 247 numberOfAntiLambdas = (std::abs(thePDGEncoding)/10000000)%100; 212 } 248 } 213 return numberOfAntiLambdas; 249 return numberOfAntiLambdas; 214 } 250 } 215 251