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 << 27 // 26 // 28 // Authors: G.Cosmo, 2 December 1995 - Design, << 27 // $Id: G4ParticleDefinition.icc,v 1.14 2009/03/27 20:33:50 gum Exp $ 29 // M.Asai, 29 January 1996 - First im << 28 // GEANT4 tag $Name: geant4-09-03-patch-02 $ 30 // ------------------------------------------- << 29 // 31 << 32 inline G4int G4ParticleDefinition::GetInstance << 33 { << 34 return g4particleDefinitionInstanceID; << 35 } << 36 << 37 inline G4bool G4ParticleDefinition::GetPDGStab << 38 { << 39 if (IsGeneralIon()) { << 40 return (GetIonLifeTime() < 0.); << 41 } << 42 << 43 return thePDGStable; << 44 } << 45 << 46 inline G4double G4ParticleDefinition::GetPDGLi << 47 { << 48 return thePDGLifeTime; << 49 } << 50 << 51 inline G4double G4ParticleDefinition::GetIonLi << 52 { << 53 //-- No longer needed to access to G4IonTabl << 54 //-- Method GetIonLifeTime() itself is kept << 55 30 56 return thePDGLifeTime; << 31 inline >> 32 G4ParticleTable* G4ParticleDefinition::GetParticleTable() >> 33 { >> 34 return theParticleTable; 57 } 35 } 58 36 59 inline G4ParticleTable* G4ParticleDefinition:: << 37 inline 60 { << 38 G4DecayTable* G4ParticleDefinition::GetDecayTable() 61 return theParticleTable; << 39 { >> 40 return theDecayTable; 62 } 41 } 63 42 64 inline G4DecayTable* G4ParticleDefinition::Get << 43 inline 65 { << 44 void G4ParticleDefinition::SetDecayTable(G4DecayTable* aDecayTable) 66 return theDecayTable; << 45 { >> 46 theDecayTable = aDecayTable; 67 } 47 } 68 48 69 inline void G4ParticleDefinition::SetDecayTabl << 70 { << 71 theDecayTable = aDecayTable; << 72 } << 73 49 74 inline void G4ParticleDefinition::SetVerboseLe << 50 inline >> 51 void G4ParticleDefinition::SetVerboseLevel(G4int value) 75 { 52 { 76 verboseLevel = value; << 53 verboseLevel = value; 77 } 54 } 78 55 79 inline G4int G4ParticleDefinition::GetVerboseL << 56 inline >> 57 G4int G4ParticleDefinition::GetVerboseLevel() const 80 { 58 { 81 return verboseLevel; << 59 return verboseLevel; 82 } 60 } 83 61 84 inline G4ProcessManager* G4ParticleDefinition: << 62 inline >> 63 G4ProcessManager* G4ParticleDefinition::GetProcessManager() const 85 { 64 { 86 return theProcessManagerShadow; << 65 return theProcessManager; 87 } 66 } 88 67 89 inline void G4ParticleDefinition::SetMasterPro << 68 inline >> 69 void G4ParticleDefinition::SetProcessManager(G4ProcessManager *aProcessManager) 90 { 70 { 91 theProcessManagerShadow = aNewPM; << 71 theProcessManager = aProcessManager; 92 } 72 } 93 73 94 inline G4int G4ParticleDefinition::GetQuarkCon << 74 inline >> 75 G4int G4ParticleDefinition::GetQuarkContent(G4int flavor) const 95 { 76 { 96 G4int content = 0; << 77 G4int content = 0; 97 if ((flavor > 0) && (flavor <= NumberOfQuark << 78 if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)){ 98 content = theQuarkContent[flavor - 1]; << 79 content = theQuarkContent[flavor-1]; 99 } << 80 }else { 100 else { << 101 #ifdef G4VERBOSE 81 #ifdef G4VERBOSE 102 if (verboseLevel > 0) { << 82 if (verboseLevel >0) { 103 std::ostringstream message; << 83 G4cout << "Invalid Quark Flavor for G4ParticleDefinition::GetQuarkContent"; 104 message << "Invalid Quark Flavor: " << f << 84 G4cout << ": flavor=" << flavor <<G4endl; 105 G4Exception("G4ParticleDefinition::GetQu << 85 } 106 } << 86 #endif 107 #endif << 108 } 87 } 109 return content; << 88 return content; 110 } 89 } 111 90 112 inline G4int G4ParticleDefinition::GetAntiQuar << 91 inline >> 92 G4int G4ParticleDefinition::GetAntiQuarkContent(G4int flavor) const 113 { 93 { 114 G4int content = 0; 94 G4int content = 0; 115 if ((flavor > 0) && (flavor <= NumberOfQuark << 95 if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)){ 116 content = theAntiQuarkContent[flavor - 1]; << 96 content = theAntiQuarkContent[flavor-1]; 117 } << 97 }else { 118 else { << 119 #ifdef G4VERBOSE 98 #ifdef G4VERBOSE 120 if (verboseLevel > 0) { << 99 if (verboseLevel >0) { 121 std::ostringstream message; << 100 G4cout <<"Invalid Quark Flavor for G4ParticleDefinition::GetAntiQuarkContent"; 122 message << "Invalid Quark Flavor: " << f << 101 G4cout << ": flavor=" << flavor <<G4endl; 123 G4Exception("G4ParticleDefinition::GetAn << 124 message); << 125 } 102 } 126 #endif 103 #endif 127 } << 104 } 128 return content; 105 return content; 129 } 106 } 130 107 131 inline void G4ParticleDefinition::SetParticleS << 108 >> 109 inline >> 110 void G4ParticleDefinition::SetParticleSubType(const G4String& subtype) 132 { 111 { 133 theParticleSubType = subtype; 112 theParticleSubType = subtype; 134 } 113 } 135 << 114 136 inline void G4ParticleDefinition::SetAntiPDGEn << 115 inline 137 { << 116 void G4ParticleDefinition::SetAntiPDGEncoding(G4int aEncoding) 138 theAntiPDGEncoding = aEncoding; << 117 { >> 118 theAntiPDGEncoding = aEncoding; 139 } 119 } 140 120 141 inline G4bool G4ParticleDefinition::GetApplyCu << 121 inline >> 122 G4bool G4ParticleDefinition::GetApplyCutsFlag() const 142 { 123 { 143 return fApplyCutsFlag; 124 return fApplyCutsFlag; 144 } 125 } 145 126 146 inline void G4ParticleDefinition::SetAtomicNum << 127 inline >> 128 void G4ParticleDefinition::SetAtomicNumber(G4int i) 147 { 129 { 148 theAtomicNumber = i; 130 theAtomicNumber = i; 149 } 131 } 150 132 151 inline G4int G4ParticleDefinition::GetAtomicNu << 133 inline >> 134 G4int G4ParticleDefinition::GetAtomicNumber() const 152 { 135 { 153 return theAtomicNumber; 136 return theAtomicNumber; 154 } 137 } 155 138 156 inline void G4ParticleDefinition::SetAtomicMas << 139 inline >> 140 void G4ParticleDefinition::SetAtomicMass(G4int i) 157 { 141 { 158 theAtomicMass = i; 142 theAtomicMass = i; 159 } 143 } 160 144 161 inline G4int G4ParticleDefinition::GetAtomicMa << 145 inline >> 146 G4int G4ParticleDefinition::GetAtomicMass() const 162 { 147 { 163 return theAtomicMass; 148 return theAtomicMass; 164 } 149 } 165 150 166 inline void G4ParticleDefinition::SetPDGMagnet << 151 inline 167 { << 152 void G4ParticleDefinition::SetPDGMagneticMoment(G4double magneticMoment) 168 thePDGMagneticMoment = magneticMoment; << 169 } << 170 << 171 inline G4bool G4ParticleDefinition::IsGeneralI << 172 { << 173 return isGeneralIon; << 174 } << 175 << 176 inline G4bool G4ParticleDefinition::IsMuonicAt << 177 { << 178 return isMuonicAtom; << 179 } << 180 << 181 inline G4int G4ParticleDefinition::GetParticle << 182 { << 183 return g4particleDefinitionInstanceID; << 184 } << 185 << 186 inline G4bool G4ParticleDefinition::IsHypernuc << 187 { << 188 return GetNumberOfLambdasInHypernucleus() > << 189 } << 190 << 191 inline G4int G4ParticleDefinition::GetNumberOf << 192 { << 193 G4int numberOfLambdas = 0; << 194 // PDG code of hypernuclei: 10LZZZAAAI << 195 if (thePDGEncoding > 0 && thePDGEncoding / 1 << 196 numberOfLambdas = (thePDGEncoding / 100000 << 197 } << 198 return numberOfLambdas; << 199 } << 200 << 201 inline G4bool G4ParticleDefinition::IsAntiHype << 202 { 153 { 203 return GetNumberOfAntiLambdasInAntiHypernucl << 154 thePDGMagneticMoment = magneticMoment; 204 } 155 } 205 156 206 inline G4int G4ParticleDefinition::GetNumberOf << 157 inline >> 158 G4double G4ParticleDefinition::CalculateAnomaly() const 207 { 159 { 208 G4int numberOfAntiLambdas = 0; << 160 // gives the anomaly of magnetic moment for spin 1/2 particles 209 // PDG code of anti-hypernuclei: -10LZZZAAAI << 161 if (thePDGiSpin==1) { 210 if (thePDGEncoding < 0 && thePDGEncoding / 1 << 162 G4double muB = 0.5*eplus*hbar_Planck/(thePDGMass/c_squared); 211 numberOfAntiLambdas = (std::abs(thePDGEnco << 163 return 0.5*std::fabs(thePDGMagneticMoment/muB - 2.*thePDGCharge/eplus); 212 } << 164 } else { 213 return numberOfAntiLambdas; << 165 return 0.0; >> 166 } 214 } 167 } 215 168