| 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 | //
|
|---|
| 28 | // MODULE: G4RIsotopeTable.cc
|
|---|
| 29 | //
|
|---|
| 30 | // Version: 0.b.4
|
|---|
| 31 | // Date: 14/04/00
|
|---|
| 32 | // Author: F Lei & P R Truscott
|
|---|
| 33 | // Organisation: DERA UK
|
|---|
| 34 | // Customer: ESA/ESTEC, NOORDWIJK
|
|---|
| 35 | // Contract: 12115/96/JG/NL Work Order No. 3
|
|---|
| 36 | //
|
|---|
| 37 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 38 | //
|
|---|
| 39 | // CHANGE HISTORY
|
|---|
| 40 | // --------------
|
|---|
| 41 | //
|
|---|
| 42 | // 29 February 2000, P R Truscott, DERA UK
|
|---|
| 43 | // 0.b.3 release.
|
|---|
| 44 | //
|
|---|
| 45 | // 14 April 2000, F Lei, DERA UK
|
|---|
| 46 | // 0.b.4 release. Minor changes to
|
|---|
| 47 | // 1) levelTolerance = 2.0 keV
|
|---|
| 48 | // 2) changes to verbose control
|
|---|
| 49 | //
|
|---|
| 50 | // 18,July 2001 F.Lei
|
|---|
| 51 | // tidy up the print out at run level
|
|---|
| 52 | //
|
|---|
| 53 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 54 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 55 | //
|
|---|
| 56 | #include "G4DecayTable.hh"
|
|---|
| 57 | #include "G4ParticleTable.hh"
|
|---|
| 58 | #include "G4IsotopeProperty.hh"
|
|---|
| 59 | #include "G4RIsotopeTable.hh"
|
|---|
| 60 |
|
|---|
| 61 | #include "G4HadronicException.hh"
|
|---|
| 62 |
|
|---|
| 63 | /*
|
|---|
| 64 | #include "G4RadioactiveDecayMode.hh"
|
|---|
| 65 | #include "G4ITDecayChannel.hh"
|
|---|
| 66 | #include "G4BetaMinusDecayChannel.hh"
|
|---|
| 67 | #include "G4BetaPlusDecayChannel.hh"
|
|---|
| 68 | #include "G4KshellECDecayChannel.hh"
|
|---|
| 69 | #include "G4LshellECDecayChannel.hh"
|
|---|
| 70 | #include "G4AlphaDecayChannel.hh"
|
|---|
| 71 | */
|
|---|
| 72 | #include "G4ios.hh"
|
|---|
| 73 | #include "globals.hh"
|
|---|
| 74 | #include <iomanip>
|
|---|
| 75 | #include <fstream>
|
|---|
| 76 | #include <sstream>
|
|---|
| 77 |
|
|---|
| 78 | const G4double G4RIsotopeTable::levelTolerance = 2.0*keV;
|
|---|
| 79 |
|
|---|
| 80 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 81 | //
|
|---|
| 82 | G4RIsotopeTable::G4RIsotopeTable()
|
|---|
| 83 | {
|
|---|
| 84 | ;
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 88 | //
|
|---|
| 89 | G4RIsotopeTable::~G4RIsotopeTable()
|
|---|
| 90 | {
|
|---|
| 91 | fIsotopeList.clear();
|
|---|
| 92 | fIsotopeNameList.clear();
|
|---|
| 93 | }
|
|---|
| 94 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 95 | //
|
|---|
| 96 | G4int G4RIsotopeTable::GetVerboseLevel() const
|
|---|
| 97 | {
|
|---|
| 98 | return G4ParticleTable::GetParticleTable()->GetVerboseLevel();
|
|---|
| 99 | }
|
|---|
| 100 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 101 | //
|
|---|
| 102 | G4bool G4RIsotopeTable::FindIsotope(G4IsotopeProperty* )
|
|---|
| 103 | {
|
|---|
| 104 | // do nothing, it is here just for the compiler
|
|---|
| 105 | // it is required by the base class
|
|---|
| 106 | return true;
|
|---|
| 107 | }
|
|---|
| 108 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 109 | //
|
|---|
| 110 | G4IsotopeProperty* G4RIsotopeTable::GetIsotope(G4int Z, G4int A, G4double E)
|
|---|
| 111 | {
|
|---|
| 112 | G4String fname = GetIsotopeName(Z, A, E);
|
|---|
| 113 | G4int j = -1;
|
|---|
| 114 | for (G4int i = 0 ; i< Entries(); i++) {
|
|---|
| 115 | if(fIsotopeNameList[i] == fname) j = i;}
|
|---|
| 116 | if (j >=0) {
|
|---|
| 117 | if (GetVerboseLevel()>1) {
|
|---|
| 118 | G4cout <<"G4RIsotopeTable::GetIsotope No. : ";
|
|---|
| 119 | G4cout <<j<<G4endl;
|
|---|
| 120 | }
|
|---|
| 121 | return GetIsotope(j);}
|
|---|
| 122 | // isotope property data has been loaded already and just return the pointer
|
|---|
| 123 | else{
|
|---|
| 124 | G4double meanlife = GetMeanLifeTime(Z, A, E);
|
|---|
| 125 | // E is pass as a refence hence on entry E is supplied by the user and it
|
|---|
| 126 | // could be slightly different from the returned value which is the one
|
|---|
| 127 | // defined in the database.
|
|---|
| 128 | // this call is to ensure the code uses a consistane E value through out.
|
|---|
| 129 | //
|
|---|
| 130 |
|
|---|
| 131 | G4IsotopeProperty* fProperty = new G4IsotopeProperty();
|
|---|
| 132 | // Set Isotope Property
|
|---|
| 133 | fProperty->SetLifeTime(meanlife);
|
|---|
| 134 | fProperty->SetAtomicNumber(Z);
|
|---|
| 135 | fProperty->SetAtomicMass(A);
|
|---|
| 136 | // Notic that the value of E may have been changed
|
|---|
| 137 | fProperty->SetEnergy(E);
|
|---|
| 138 | // The spin is not being used in the current implementation
|
|---|
| 139 | fProperty->SetiSpin(0);
|
|---|
| 140 | // the decaytable will be loaded later in G4RadioactiveDecay when it is needed
|
|---|
| 141 | fProperty->SetDecayTable(0);
|
|---|
| 142 |
|
|---|
| 143 | fIsotopeList.push_back(fProperty);
|
|---|
| 144 | fname = GetIsotopeName(Z, A, E);
|
|---|
| 145 | fIsotopeNameList.push_back(fname);
|
|---|
| 146 | if (GetVerboseLevel()>1) {
|
|---|
| 147 | G4cout <<"G4RIsotopeTable::GetIsotope create: ";
|
|---|
| 148 | G4cout <<fname <<G4endl;
|
|---|
| 149 | }
|
|---|
| 150 | return fProperty;
|
|---|
| 151 |
|
|---|
| 152 | }
|
|---|
| 153 | }
|
|---|
| 154 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 155 | //
|
|---|
| 156 | G4String G4RIsotopeTable::GetIsotopeName(G4int Z, G4int A, G4double E)
|
|---|
| 157 | {
|
|---|
| 158 | std::ostringstream os;
|
|---|
| 159 | os.setf(std::ios::fixed);
|
|---|
| 160 | os <<"A"<< A << "Z" << Z <<'[' << std::setprecision(1) << E/keV << ']';
|
|---|
| 161 | G4String name = os.str();
|
|---|
| 162 | if (GetVerboseLevel()>1) {
|
|---|
| 163 | G4cout <<"G4RIsotopeTable::GetIsotope Name: ";
|
|---|
| 164 | G4cout <<name <<G4endl;
|
|---|
| 165 | }
|
|---|
| 166 | return name;
|
|---|
| 167 | }
|
|---|
| 168 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 169 | //
|
|---|
| 170 | G4double G4RIsotopeTable::GetMeanLifeTime (G4int Z, G4int A, G4double& aE)
|
|---|
| 171 | {
|
|---|
| 172 | G4double lifetime = -1.0;
|
|---|
| 173 | // G4double levelTolerance = 1.0 * keV ;
|
|---|
| 174 | if ( !getenv("G4RADIOACTIVEDATA")) {
|
|---|
| 175 | G4cout << "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files." << G4endl;
|
|---|
| 176 | throw G4HadronicException(__FILE__, __LINE__,
|
|---|
| 177 | "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files.");
|
|---|
| 178 | }
|
|---|
| 179 | G4String dirName = getenv("G4RADIOACTIVEDATA");
|
|---|
| 180 |
|
|---|
| 181 | std::ostringstream os;
|
|---|
| 182 | os <<dirName <<"/z" <<Z <<".a" <<A ;
|
|---|
| 183 | G4String file = os.str();
|
|---|
| 184 | std::ifstream DecaySchemeFile(file);
|
|---|
| 185 |
|
|---|
| 186 | if (!DecaySchemeFile )
|
|---|
| 187 | {
|
|---|
| 188 | if (GetVerboseLevel()>1) {
|
|---|
| 189 | G4cout <<"G4RIsotopeTable::GetMeanLife() : "
|
|---|
| 190 | <<"cannot find ion radioactive decay file: "
|
|---|
| 191 | <<file <<G4endl;
|
|---|
| 192 | G4cout <<"The nucleus is assumed to be stable " <<G4endl;
|
|---|
| 193 | }
|
|---|
| 194 | }
|
|---|
| 195 | else
|
|---|
| 196 | {
|
|---|
| 197 | G4bool found(false);
|
|---|
| 198 | char inputChars[80]={' '};
|
|---|
| 199 | G4String inputLine;
|
|---|
| 200 | G4String recordType("");
|
|---|
| 201 | G4double a(0.0);
|
|---|
| 202 | G4double b(0.0);
|
|---|
| 203 |
|
|---|
| 204 | // while (!found && -DecaySchemeFile.getline(inputChars, 80).eof() != EOF)
|
|---|
| 205 | while (!found && !DecaySchemeFile.getline(inputChars, 80).eof())
|
|---|
| 206 | {
|
|---|
| 207 | inputLine = inputChars;
|
|---|
| 208 | //G4String::stripType stripend(1);
|
|---|
| 209 | //G4String::stripType stripend =trailing;
|
|---|
| 210 | inputLine = inputLine.strip(1);
|
|---|
| 211 |
|
|---|
| 212 | if (inputChars[0] != '#' && inputLine.length() != 0)
|
|---|
| 213 | {
|
|---|
| 214 | std::istringstream tmpstream(inputLine);
|
|---|
| 215 | // tmpstream = inputLine;
|
|---|
| 216 | tmpstream >>recordType >>a >>b;
|
|---|
| 217 | if (recordType == "P")
|
|---|
| 218 | {
|
|---|
| 219 | if (std::abs(a*keV-aE) < levelTolerance)
|
|---|
| 220 | {
|
|---|
| 221 | found = true;
|
|---|
| 222 | lifetime = b/0.693147*s ;
|
|---|
| 223 | // in the database was half-life!
|
|---|
| 224 | // aE = a*keV;
|
|---|
| 225 | // pass back the correct energy
|
|---|
| 226 | }
|
|---|
| 227 | }
|
|---|
| 228 | }
|
|---|
| 229 | }
|
|---|
| 230 | if (!found && aE )
|
|---|
| 231 | {
|
|---|
| 232 | if (GetVerboseLevel()>1) {
|
|---|
| 233 | G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
|
|---|
| 234 | G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
|
|---|
| 235 | G4cout <<"state in radioactive data file " <<G4endl;
|
|---|
| 236 | G4cout <<"The nucleus is assumed to be IT decayed with life = 1E-20 s" <<G4endl;
|
|---|
| 237 | G4cout <<" -----------* THIS MAY CAUSE PROBLEM IN ITS DECAY-----------" <<G4endl;
|
|---|
| 238 | lifetime = 1.0E-20*s;
|
|---|
| 239 | }
|
|---|
| 240 | }
|
|---|
| 241 | if (!found && !aE )
|
|---|
| 242 | {
|
|---|
| 243 | if (GetVerboseLevel()>1) {
|
|---|
| 244 | G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
|
|---|
| 245 | G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
|
|---|
| 246 | G4cout <<"state in radioactive data file " <<G4endl;
|
|---|
| 247 | G4cout <<"The nucleus is assumed to be stable" <<G4endl;
|
|---|
| 248 | lifetime = -1.0;
|
|---|
| 249 | }
|
|---|
| 250 | }
|
|---|
| 251 | DecaySchemeFile.close();
|
|---|
| 252 | }
|
|---|
| 253 | if (GetVerboseLevel()>1) {
|
|---|
| 254 | G4cout <<"G4RIsotopeTable::GetMeanLifeTime: ";
|
|---|
| 255 | G4cout <<lifetime << " for " << GetIsotopeName(Z, A, aE) <<G4endl;
|
|---|
| 256 | }
|
|---|
| 257 | return lifetime;
|
|---|
| 258 | }
|
|---|
| 259 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 260 | //
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|