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 // G4IsotopeProperty class implementation << 27 // 26 // 28 // Author: H.Kurashige, 5 October 1999 << 27 // $Id: G4IsotopeProperty.cc,v 1.7 2007/03/16 05:25:08 kurasige Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-09-02-patch-04 $ >> 29 // >> 30 // >> 31 // ---------------------------------------------------------------------- >> 32 // GEANT 4 class implementation file >> 33 // >> 34 // ********************************************************************** >> 35 // New design using G4VIsotopeTable 5 Oct. 99 H.Kurashige 30 36 31 #include "G4IsotopeProperty.hh" << 37 #include "G4ios.hh" >> 38 #include <iomanip> 32 39 >> 40 #include "G4IsotopeProperty.hh" 33 #include "G4DecayTable.hh" 41 #include "G4DecayTable.hh" 34 #include "G4PhysicalConstants.hh" << 35 #include "G4SystemOfUnits.hh" << 36 #include "G4ios.hh" << 37 42 38 #include <iomanip> << 43 // ###################################################################### >> 44 // ### IsotopeProperty ### >> 45 // ###################################################################### >> 46 >> 47 G4IsotopeProperty::G4IsotopeProperty(): >> 48 fAtomicNumber(0),fAtomicMass(0), >> 49 fISpin(0),fEnergy(0.0), >> 50 fLifeTime(-1.0),fDecayTable(0), >> 51 fMagneticMoment(0.0) >> 52 { >> 53 } >> 54 39 55 40 G4IsotopeProperty::~G4IsotopeProperty() 56 G4IsotopeProperty::~G4IsotopeProperty() 41 { 57 { 42 delete fDecayTable; << 58 if (fDecayTable != 0) delete fDecayTable; 43 fDecayTable = nullptr; << 44 } 59 } 45 60 46 G4IsotopeProperty::G4IsotopeProperty(const G4I << 61 G4IsotopeProperty::G4IsotopeProperty(const G4IsotopeProperty& right) 47 : fAtomicNumber(right.fAtomicNumber), << 48 fAtomicMass(right.fAtomicMass), << 49 fISpin(right.fISpin), << 50 fEnergy(right.fEnergy), << 51 fLifeTime(right.fLifeTime), << 52 << 53 fMagneticMoment(right.fMagneticMoment), << 54 fIsomerLevel(right.fIsomerLevel), << 55 fFloatLevelBase(right.fFloatLevelBase) << 56 { 62 { >> 63 fAtomicNumber = right.fAtomicNumber; >> 64 fAtomicMass = right.fAtomicMass; >> 65 fISpin = right.fISpin; >> 66 fMagneticMoment = right.fMagneticMoment; >> 67 fEnergy = right.fEnergy; >> 68 fLifeTime = right.fLifeTime; 57 // decay table is not copied because G4Decay 69 // decay table is not copied because G4DecayTable has no copy constructor >> 70 fDecayTable = 0; 58 } 71 } 59 72 60 G4IsotopeProperty& G4IsotopeProperty::operator << 73 // Assignment operator >> 74 G4IsotopeProperty & G4IsotopeProperty::operator=(G4IsotopeProperty& right) 61 { 75 { 62 if (this != &right) { 76 if (this != &right) { 63 fAtomicNumber = right.fAtomicNumber; << 77 fAtomicNumber = right.fAtomicNumber; 64 fAtomicMass = right.fAtomicMass; << 78 fAtomicMass = right.fAtomicMass; 65 fISpin = right.fISpin; << 79 fISpin = right.fISpin; 66 fMagneticMoment = right.fMagneticMoment; << 80 fMagneticMoment = right.fMagneticMoment; 67 fEnergy = right.fEnergy; << 81 fEnergy = right.fEnergy; 68 fLifeTime = right.fLifeTime; << 82 fLifeTime = right.fLifeTime; 69 fIsomerLevel = right.fIsomerLevel; << 70 fFloatLevelBase = right.fFloatLevelBase; << 71 // decay table is not copied because G4Dec 83 // decay table is not copied because G4DecayTable has no copy constructor 72 fDecayTable = nullptr; << 84 fDecayTable = 0; 73 } 85 } 74 return *this; 86 return *this; 75 } 87 } 76 88 77 G4bool G4IsotopeProperty::operator==(const G4I << 89 >> 90 // equal / unequal operator >> 91 G4int G4IsotopeProperty::operator==(const G4IsotopeProperty &right) const 78 { 92 { 79 G4bool value = true; 93 G4bool value = true; 80 value = value && (fAtomicNumber == right.fAt << 94 value = value && ( fAtomicNumber == right.fAtomicNumber); 81 value = value && (fAtomicMass == right.fAtom << 95 value = value && ( fAtomicMass == right.fAtomicMass); 82 value = value && (fISpin == right.fISpin); << 96 value = value && ( fISpin == right.fISpin); 83 value = value && (fMagneticMoment == right.f << 97 value = value && ( fMagneticMoment == right.fMagneticMoment); 84 value = value && (fEnergy == right.fEnergy); << 98 value = value && ( fEnergy == right.fEnergy); 85 value = value && (fLifeTime == right.fLifeTi << 99 value = value && ( fLifeTime == right.fLifeTime); 86 value = value && (fIsomerLevel == right.fIso << 87 value = value && (fFloatLevelBase == right.f << 88 return value; 100 return value; 89 } 101 } 90 << 102 G4int G4IsotopeProperty::operator!=(const G4IsotopeProperty &right) const 91 G4bool G4IsotopeProperty::operator!=(const G4I << 92 { 103 { 93 return !(*this == right); 104 return !(*this == right); 94 } 105 } 95 106 96 void G4IsotopeProperty::DumpInfo() const 107 void G4IsotopeProperty::DumpInfo() const 97 { 108 { 98 #ifdef G4VERBOSE << 109 G4cout << "AtomicNumber: " << fAtomicNumber << G4endl; 99 G4cout << "AtomicNumber: " << fAtomicNumber << 110 G4cout << "AtomicMass: " << fAtomicMass << G4endl; 100 << "AtomicMass: " << fAtomicMass << G << 111 if (fISpin %2){ 101 if ((fISpin % 2) != 0) { << 112 G4cout << "Spin: " << fISpin << "/2" << G4endl; 102 G4cout << "Spin: " << fISpin << "/2"; << 113 } else { 103 } << 114 G4cout << "Spin: " << fISpin /2 << G4endl; 104 else { << 115 } 105 G4cout << "Spin: " << fISpin / 2; << 116 G4cout << "MagneticMoment: " << fMagneticMoment/MeV*tesla << "[MeV/T]" <<G4endl; 106 } << 117 G4cout << "Excited Energy: " << std::setprecision(1) << fEnergy/keV << "[keV]" << G4endl; 107 G4cout << ", " << 118 G4cout << "Life Time: " << fLifeTime/ns << "[ns]" << G4endl; 108 << "MagneticMoment: " << fMagneticMom << 119 if (fDecayTable != 0) { 109 G4cout << "Isomer Level: " << fIsomerLevel < << 110 << fEnergy / keV; << 111 if (fFloatLevelBase != G4Ions::G4FloatLevelB << 112 G4cout << " +" << G4Ions::FloatLevelBaseCh << 113 } << 114 G4cout << " [keV]" << 115 << ", " << std::setprecision(6) << << 116 if (fDecayTable != nullptr) { << 117 fDecayTable->DumpInfo(); 120 fDecayTable->DumpInfo(); >> 121 } else { >> 122 G4cout << "Decay Table is not defined !" << G4endl; 118 } 123 } 119 else { << 120 // G4cout << "Decay Table is not defined ! << 121 } << 122 #endif << 123 } 124 } >> 125 >> 126 >> 127 >> 128 >> 129 >> 130 >> 131 124 132