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

MJDatabaseElement.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: MJDatabaseElement.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJDatabaseElement.cc
00026 //
00027 //---------------------------------------------------------------------------//
00033 // 
00034 //---------------------------------------------------------------------------//
00044 //---------------------------------------------------------------------------//
00045 //
00046 
00047 //---------------------------------------------------------------------------//
00048 
00049 #include "database/MJDatabaseElement.hh"      //Present MJ Class Headers 
00050 #include "database/MJDatabaseUtil.hh"
00051 //---------------------------------------------------------------------------//
00052 
00053 MJDatabaseElement::MJDatabaseElement()
00054 {
00055 
00056 }
00057 MJDatabaseElement::MJDatabaseElement(string name , string symb, int z,
00058                                      int nIso, string isoName[], 
00059                                      double isoAban[], string comment)
00060   :fName (name),
00061    fSymb (symb),
00062    fZ(z),
00063    fNoIsotopes(nIso),
00064    fComments(comment)
00065 {
00066   for (int i = 0; i < fNoIsotopes; i++){
00067     fIsoNames.push_back( isoName[i] );
00068     fIsoAbundance.push_back( isoAban[i] );
00069   }
00070 }
00071 MJDatabaseElement::MJDatabaseElement(const MJDatabaseElement & other)
00072 {
00073 
00074 }
00075 
00076 MJDatabaseElement::~MJDatabaseElement()
00077 {
00078 }
00079 MJDatabaseElement*
00080 MJDatabaseElement::createElement(PGresult* res){
00081 
00082   MJDatabaseUtil dbutil;
00083   for (int i = 0; i < PQntuples(res); i++)
00084     {
00085 
00086       fName = PQgetvalue(res, i, 0);
00087       fSymb = PQgetvalue(res, i, 1);
00088       fZ=dbutil.c_Int(PQgetvalue(res, i, 2));
00089       fNoIsotopes = dbutil.c_Int(PQgetvalue(res, i, 3));
00090       fIsoNames.push_back(PQgetvalue(res, i, 4));
00091       fIsoSymb.push_back(PQgetvalue(res, i, 5));
00092       fIsoAbundance.push_back(dbutil.c_Float(PQgetvalue(res, i, 6)));
00093 
00094     }
00095   return this;
00096 
00097 }
00098 
00099 ostream& 
00100 operator << (ostream& os, MJDatabaseElement& ele){
00101 
00102   os << '\n' 
00103      << "******* Element: " << ele.GetName() 
00104      << " ******" << '\n'
00105      << "Symbol      : " << ele.GetSymbol() << "\n"
00106      << "Z number    : " << ele.GetZ() << "\n"
00107      << "Isotopes    : {";
00108     vector<string>::iterator strIt;  
00109   for(strIt=ele.fIsoNames.begin(); strIt != ele.fIsoNames.end(); strIt++)
00110     os << *strIt << " " ;
00111   os << "}\n";
00112 
00113   vector<double>::iterator dIt;
00114   os<< "Abundance   : {" ;
00115 
00116   for(dIt=ele.fIsoAbundance.begin(); dIt != ele.fIsoAbundance.end(); dIt++)
00117     os << *dIt << " " ;
00118   os << "}\n";
00119 
00120 
00121     return os;
00122 }

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