G4IsotopeMagneticMomentTable Class Reference

#include <G4IsotopeMagneticMomentTable.hh>

Inheritance diagram for G4IsotopeMagneticMomentTable:

G4VIsotopeTable

Public Types

typedef std::vector< G4IsotopeProperty * > G4IsotopeList
typedef std::vector< G4StringG4IsotopeNameList

Public Member Functions

 G4IsotopeMagneticMomentTable ()
virtual ~G4IsotopeMagneticMomentTable ()
virtual G4bool FindIsotope (G4IsotopeProperty *property)
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E)

Protected Member Functions

 G4IsotopeMagneticMomentTable (const G4IsotopeMagneticMomentTable &right)
G4IsotopeMagneticMomentTableoperator= (const G4IsotopeMagneticMomentTable &right)

Detailed Description

Definition at line 52 of file G4IsotopeMagneticMomentTable.hh.


Member Typedef Documentation

typedef std::vector<G4IsotopeProperty*> G4IsotopeMagneticMomentTable::G4IsotopeList

Definition at line 61 of file G4IsotopeMagneticMomentTable.hh.

typedef std::vector<G4String> G4IsotopeMagneticMomentTable::G4IsotopeNameList

Definition at line 62 of file G4IsotopeMagneticMomentTable.hh.


Constructor & Destructor Documentation

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable (  ) 

Definition at line 55 of file G4IsotopeMagneticMomentTable.cc.

References G4cout, G4endl, G4Exception(), JustWarning, G4IsotopeProperty::SetAtomicMass(), G4IsotopeProperty::SetAtomicNumber(), G4IsotopeProperty::SetEnergy(), G4IsotopeProperty::SetiSpin(), and G4IsotopeProperty::SetMagneticMoment().

00056   :G4VIsotopeTable("MagneticMoment")
00057 {
00058   if ( !getenv("G4IONMAGNETICMOMENT")) {
00059 #ifdef G4VERBOSE
00060     if (GetVerboseLevel()>1) {
00061       G4cout << "G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable():  " 
00062              <<  "Please setenv G4IONMAGNETICMOMENT for the magnetic moment data." 
00063              << G4endl;
00064       G4Exception( "G4IsotopeMagneticMomentTable",
00065                    "File Not Found",
00066                    JustWarning, 
00067                    "Please setenv G4IONMAGNETICMOMENT");
00068     }
00069 #endif
00070     G4Exception( "G4IsotopeMagneticMomentTable",
00071                  "File Not Found",
00072                  JustWarning, 
00073                  "Please setenv G4IONMAGNETICMOMENT");
00074     return;
00075   }
00076   
00077   G4String file = getenv("G4IONMAGNETICMOMENT");
00078   std::ifstream DataFile(file);
00079 
00080   if (!DataFile ) {
00081 #ifdef G4VERBOSE
00082     if (GetVerboseLevel()>0) {
00083       G4cout << "G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable():  " 
00084             << file << " is not found " << G4endl;
00085     }
00086 #endif
00087     G4Exception( "G4IsotopeMagneticMomentTable",
00088                  "File Not Found",
00089                  JustWarning, 
00090                  "Can not open G4IONMAGNETICMOMENT file");
00091     return;
00092   }
00093   
00094   char inputChars[80]={' '};
00095    
00096   while ( !DataFile.eof() ) {
00097     DataFile.getline(inputChars, 80);
00098     G4String inputLine = inputChars;
00099     G4int ionA, ionZ, ionJ;
00100     G4double ionE, ionMu, ionLife;
00101     G4String ionName, ionLifeUnit;
00102  
00103     if (inputChars[0] != '#' && inputLine.length() != 0) {
00104       std::istringstream tmpstream(inputLine);
00105       tmpstream >> ionZ >>  ionName >> ionA >>  ionE 
00106                 >> ionLife >> ionLifeUnit
00107                 >> ionJ >> ionMu;
00108           
00109       G4IsotopeProperty* fProperty = new G4IsotopeProperty();   
00110       // Set Isotope Property
00111       fProperty->SetAtomicNumber(ionZ);
00112       fProperty->SetAtomicMass(ionA);
00113       fProperty->SetEnergy(ionE * MeV);
00114       fProperty->SetiSpin(ionJ);
00115       fProperty->SetMagneticMoment(ionMu*nuclearMagneton);
00116       
00117       fIsotopeList.push_back(fProperty);
00118 
00119       //if (GetVerboseLevel()>2) {
00120       // fProperty->DumpInfo();
00121       //}
00122         
00123     }
00124   }
00125 
00126   DataFile.close();
00127 }

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( const G4IsotopeMagneticMomentTable right  )  [protected]

Definition at line 139 of file G4IsotopeMagneticMomentTable.cc.

00140   :G4VIsotopeTable(right),
00141    fIsotopeList(0)
00142 {
00143 }

G4IsotopeMagneticMomentTable::~G4IsotopeMagneticMomentTable (  )  [virtual]

Definition at line 130 of file G4IsotopeMagneticMomentTable.cc.

00131 {
00132   for (size_t i = 0 ; i< fIsotopeList.size(); i++) {
00133     delete fIsotopeList[i];
00134   }
00135   fIsotopeList.clear();
00136 }


Member Function Documentation

G4bool G4IsotopeMagneticMomentTable::FindIsotope ( G4IsotopeProperty property  )  [virtual]

Implements G4VIsotopeTable.

Definition at line 152 of file G4IsotopeMagneticMomentTable.cc.

References G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), and G4IsotopeProperty::GetEnergy().

00153 {
00154   for (size_t i = 0 ; i< fIsotopeList.size(); ++i) {
00155     G4IsotopeProperty*  fP = fIsotopeList[i];
00156     
00157     // check Z
00158     if ( fP->GetAtomicNumber() > pP->GetAtomicNumber()) {
00159       // Not Found
00160       break;
00161     }
00162     if ( fP->GetAtomicNumber() < pP->GetAtomicNumber()) {
00163       // next
00164       continue;
00165     }
00166     
00167     // check A
00168     if ( fP->GetAtomicMass() != pP->GetAtomicMass()) {
00169       // next
00170       continue;
00171     }
00172     
00173     //check E
00174     if (std::fabs(fP->GetEnergy() - pP->GetEnergy()) <= fP->GetEnergy()*levelTolerance) {
00175       // Found
00176       return true;     
00177     }
00178     
00179   }
00180   return false;
00181 }

G4IsotopeProperty * G4IsotopeMagneticMomentTable::GetIsotope ( G4int  Z,
G4int  A,
G4double  E 
) [virtual]

Implements G4VIsotopeTable.

Definition at line 184 of file G4IsotopeMagneticMomentTable.cc.

References G4IsotopeProperty::DumpInfo().

00185 {
00186   G4IsotopeProperty* fProperty = 0;
00187   for (size_t i = 0 ; i< fIsotopeList.size(); ++i) {
00188     G4IsotopeProperty*  fP = fIsotopeList[i];
00189  
00190      // check Z
00191     if ( fP->GetAtomicNumber() > Z) {
00192       // Not Found
00193       break;
00194     }
00195     if ( fP->GetAtomicNumber() < Z) {
00196       // next
00197       continue;
00198     }
00199     
00200     // check A
00201     if ( fP->GetAtomicMass() != A ) {
00202       // next
00203       continue;
00204     }
00205     
00206     //check E
00207     if (std::fabs(fP->GetEnergy() - E) <= fP->GetEnergy()*levelTolerance) {
00208       // Found
00209       fProperty = fP;
00210       fP->DumpInfo();
00211       break;     
00212     }
00213     
00214   }
00215 
00216   return fProperty;
00217   
00218 }

G4IsotopeMagneticMomentTable & G4IsotopeMagneticMomentTable::operator= ( const G4IsotopeMagneticMomentTable right  )  [protected]

Definition at line 146 of file G4IsotopeMagneticMomentTable.cc.

00147 {
00148   return *this;
00149 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:18 2013 for Geant4 by  doxygen 1.4.7