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