[824] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4ParticleTable.icc,v 1.11 2007/09/14 07:04:09 kurasige Exp $ |
---|
[1196] | 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
[824] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | // implement new version for using STL map instaed of RW PtrHashedDictionary |
---|
| 33 | // 28 ct., 99 H.Kurashige |
---|
| 34 | |
---|
| 35 | inline |
---|
| 36 | const G4ShortLivedTable* G4ParticleTable::GetShortLivedTable() |
---|
| 37 | { |
---|
| 38 | return fShortLivedTable; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | inline |
---|
| 42 | G4IonTable* G4ParticleTable::GetIonTable() |
---|
| 43 | { |
---|
| 44 | return fIonTable; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | inline |
---|
| 48 | void G4ParticleTable::SetVerboseLevel(G4int value ) |
---|
| 49 | { |
---|
| 50 | verboseLevel = value; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | inline |
---|
| 54 | G4int G4ParticleTable::GetVerboseLevel() const |
---|
| 55 | { |
---|
| 56 | return verboseLevel; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | inline |
---|
| 60 | G4ParticleTable::G4PTblDictionary* G4ParticleTable::GetDictionary() |
---|
| 61 | { |
---|
| 62 | return fDictionary; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | inline |
---|
| 66 | G4ParticleTable::G4PTblDicIterator* G4ParticleTable::GetIterator() |
---|
| 67 | { |
---|
| 68 | return fIterator; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | inline |
---|
| 72 | const G4ParticleTable::G4PTblEncodingDictionary* G4ParticleTable::GetEncodingDictionary() |
---|
| 73 | { |
---|
| 74 | return fEncodingDictionary; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | inline |
---|
| 78 | const G4String& G4ParticleTable::GetKey(const G4ParticleDefinition *particle) const |
---|
| 79 | { |
---|
| 80 | return particle->GetParticleName(); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | inline |
---|
| 84 | G4ParticleDefinition* G4ParticleTable::FindParticle(const G4String &particle_name) |
---|
| 85 | { |
---|
| 86 | G4PTblDictionary::iterator it = fDictionary->find(particle_name); |
---|
| 87 | if (it != fDictionary->end()) { |
---|
| 88 | return (*it).second; |
---|
| 89 | }else { |
---|
| 90 | return 0; |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | inline |
---|
| 96 | G4ParticleDefinition* G4ParticleTable::FindAntiParticle(G4int aPDGEncoding) |
---|
| 97 | { |
---|
| 98 | return FindParticle( FindParticle(aPDGEncoding)->GetAntiPDGEncoding() ); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | inline |
---|
| 102 | G4ParticleDefinition* G4ParticleTable::FindAntiParticle(const G4String& particle_name) |
---|
| 103 | { |
---|
| 104 | G4int pcode = FindParticle(particle_name) -> GetAntiPDGEncoding(); |
---|
| 105 | return FindParticle(pcode); |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | inline |
---|
| 109 | G4ParticleDefinition* G4ParticleTable::FindAntiParticle(const G4ParticleDefinition *particle) |
---|
| 110 | { |
---|
| 111 | G4int pcode = particle -> GetAntiPDGEncoding(); |
---|
| 112 | return FindParticle(pcode); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | inline |
---|
| 116 | G4bool G4ParticleTable::contains(const G4String& particle_name) |
---|
| 117 | { |
---|
| 118 | G4PTblDictionary::iterator it = fDictionary->find(particle_name); |
---|
| 119 | return (it != fDictionary->end()); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | inline |
---|
| 123 | G4bool G4ParticleTable::contains(const G4ParticleDefinition *particle) |
---|
| 124 | { |
---|
| 125 | return contains(GetKey(particle)); |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | inline |
---|
| 129 | const G4String& G4ParticleTable::GetParticleName(G4int index) |
---|
| 130 | { |
---|
| 131 | G4ParticleDefinition* aParticle =GetParticle(index); |
---|
| 132 | if (aParticle != 0) { |
---|
| 133 | return aParticle->GetParticleName(); |
---|
| 134 | } else { |
---|
| 135 | return noName; |
---|
| 136 | } |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | inline |
---|
| 140 | G4int G4ParticleTable::entries() const |
---|
| 141 | { |
---|
| 142 | return fDictionary->size(); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | inline |
---|
| 146 | G4int G4ParticleTable::size() const |
---|
| 147 | { |
---|
| 148 | return fDictionary->size(); |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | inline |
---|
| 152 | void G4ParticleTable::SetReadiness() |
---|
| 153 | { |
---|
| 154 | readyToUse = true; |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | inline |
---|
| 158 | G4bool G4ParticleTable::GetReadiness() const |
---|
| 159 | { |
---|
| 160 | return readyToUse; |
---|
| 161 | } |
---|
| 162 | |
---|