Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJMaterialIsotope.cc

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00003 //                                                                           //
00004 //                         MAJORANA Simulation                               //
00005 //                                                                           //
00006 //      This code implementation is the intellectual property of the         //
00007 //      MAJORANA Collaboration. It is based on Geant4, an intellectual       //
00008 //      property of the RD44 GEANT4 collaboration.                           //
00009 //                                                                           //
00010 //                        *********************                              //
00011 //                                                                           //
00012 //    Neither the authors of this software system, nor their employing       //
00013 //    institutes, nor the agencies providing financial support for this      //
00014 //    work  make  any representation or  warranty, express or implied,       //
00015 //    regarding this software system or assume any liability for its use.    //
00016 //    By copying, distributing or modifying the Program (or any work based   //
00017 //    on on the Program) you indicate your acceptance of this statement,     //
00018 //    and all its terms.                                                     //
00019 //                                                                           //
00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00021 //---------------------------------------------------------------------------//
00022 //                                                          
00023 // $Id: MJMaterialIsotope.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJMaterialIsotope.cc
00026 //
00027 //---------------------------------------------------------------------------//
00033 // 
00034 //---------------------------------------------------------------------------//
00044 //---------------------------------------------------------------------------//
00045 
00046 #include <string.h>
00047 
00048 #include "globals.hh"
00049 #include "G4Isotope.hh"
00050 
00051 #include "database/MJDatabase.hh"
00052 #include "database/MJDatabaseIsotope.hh"
00053 #include "io/MJLogger.hh"
00054 
00055 //---------------------------------------------------------------------------//
00056 
00057 #include "materials/MJMaterialIsotope.hh"      //Present MJ Class Headers 
00058 
00059 //---------------------------------------------------------------------------//
00060 
00061 MJMaterialIsotope::MJMaterialIsotope():
00062  fExists(false), fG4Isotope(0)
00063 {;}
00064 
00065 //---------------------------------------------------------------------------//
00066 
00067 MJMaterialIsotope::MJMaterialIsotope(const G4String name, 
00068                                      G4bool registerG4):
00069  fName(name), fG4Isotope(0)
00070 {
00071   CreateFromDatabase();
00072   if(registerG4) RegisterWithG4();
00073 }
00074 
00075 //---------------------------------------------------------------------------//
00076 
00077 MJMaterialIsotope::MJMaterialIsotope(const MJMaterialIsotope & other)
00078 {
00079     fName = other.fName;
00080     fSymbol = other.fSymbol;
00081     fZ = other.fZ;
00082     fN = other.fN;
00083     fMolarMass = other.fMolarMass;
00084     fPNNLKey = other.fPNNLKey;
00085     fDECAY5Key = other.fDECAY5Key;
00086     fComment = other.fComment;
00087     fG4Isotope = other.fG4Isotope; 
00088 }
00089 
00090 //---------------------------------------------------------------------------//
00091 
00092 MJMaterialIsotope::~MJMaterialIsotope()
00093 {;}
00094 
00095 //---------------------------------------------------------------------------//
00096 
00097 void MJMaterialIsotope::CreateFromDatabase()
00098 {
00099   MJDatabaseIsotope *theDBIsotope = MJDatabase::GetIsotope(fName);
00100   if(theDBIsotope) {
00101     fName = theDBIsotope->GetName();
00102     fSymbol = theDBIsotope->GetSymbol();
00103     fZ = theDBIsotope->GetZ();
00104     fN = theDBIsotope->GetN();
00105     fMolarMass = theDBIsotope->GetMolarMass() * g / mole;
00106     fPNNLKey = theDBIsotope->GetPnnlKey();
00107     fDECAY5Key = theDBIsotope->GetDecay();
00108     fComment = theDBIsotope->GetComment();
00109     fExists = true;
00110     MJLog(trace) << fName << " MJ isotope created from database." << endlog;
00111   } else {
00112     fExists = false;
00113     MJLog(error) << "Could not find isotope "<<fName<<" in database."<<endlog;
00114   }
00115 }
00116 
00117 //---------------------------------------------------------------------------//
00118 
00119 void MJMaterialIsotope::RegisterWithG4() 
00120 {
00121   if(fExists) {
00122     if((fG4Isotope = G4Isotope::GetIsotope(fName))) {
00123       MJLog(debugging)<<fName<<" isotope already registered with G4."<<endlog;
00124     } else {
00125       fG4Isotope = new G4Isotope(fName, fZ, fN, fMolarMass);
00126       MJLog(trace)<<fName<<" isotope registered with G4."<<endlog;
00127     }
00128   } else {
00129     MJLog(error) << "Cannot register isotope " << fName << " with G4 before"
00130                  << " defining it." << endlog;
00131   }
00132 }
00133 
00134 //---------------------------------------------------------------------------//
00135 //---------------------------------------------------------------------------//

Generated on Mon Nov 29 16:58:53 2004 for Majorana Simulation by  doxygen 1.3.9.1