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

MJDatabaseSimple800g.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: MJDatabaseSimple800g.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJDatabaseSimple800g.cc
00026 //
00027 //---------------------------------------------------------------------------//
00033 // 
00034 //---------------------------------------------------------------------------//
00044 //---------------------------------------------------------------------------//
00045 //
00046 #include <iostream>
00047 
00048 #include "database/MJDatabase.hh"
00049 using namespace std;
00050 //---------------------------------------------------------------------------//
00051 
00052 #include "database/MJDatabaseSimple800g.hh"      //Present MJ Class Headers 
00053 #include "database/MJDatabaseUtil.hh"
00054 //---------------------------------------------------------------------------//
00055 
00056 MJDatabaseSimple800g::MJDatabaseSimple800g()
00057 {
00058 
00059 }
00060 
00061 MJDatabaseSimple800g::MJDatabaseSimple800g(const MJDatabaseSimple800g & other)
00062   :fCrystalMat(other.fCrystalMat),
00063    fInnerContactMat(other.fInnerContactMat)
00064 {
00065   fSerialNo = other.fSerialNo;
00066   fHeight = other.fHeight;
00067   fRadius = other.fRadius;
00068   fCoreRadius = other.fCoreRadius;
00069   fCornerR = other.fCornerR;
00070   fCoreDepth = other.fCoreDepth;
00071   fInnerContactW = other.fInnerContactW;
00072   fInnerDeadThickness = other.fInnerDeadThickness;
00073   fOuterDeadThickness = other.fOuterDeadThickness;
00074   fDiodType = other.fDiodType;
00075   fDepletionVolt = other.fDepletionVolt;
00076   fResolution = other.fResolution;
00077   fEfficiencies= other.fEfficiencies;
00078   fInnerBkgModel = other.fInnerBkgModel;
00079   fBkgModel = other.fBkgModel;
00080 }
00081 
00082 MJDatabaseSimple800g::~MJDatabaseSimple800g()
00083 {
00084 }
00085 MJDatabaseSimple800g*
00086 MJDatabaseSimple800g::createCrystal(PGresult * res){
00087 
00088   MJDatabaseUtil dbutil;
00089   for (int i = 0; i < PQntuples(res); i++)
00090     {
00091       fSerialNo = PQgetvalue(res, i, 0);
00092       string matName =  PQgetvalue(res, i, 1);
00093       fHeight = dbutil.c_Float(PQgetvalue(res, i, 2));
00094       fRadius = dbutil.c_Float(PQgetvalue(res, i, 3));
00095 
00096       fBkgModel = PQgetvalue(res, i, 4);
00097       fCoreRadius = dbutil.c_Float(PQgetvalue(res, i, 5));
00098       fCoreDepth = dbutil.c_Float(PQgetvalue(res, i, 6));
00099       fCornerR = dbutil.c_Float(PQgetvalue(res, i, 7));
00100 
00101       fInnerContactW = dbutil.c_Float(PQgetvalue(res, i, 8));
00102  
00103       string innerMat = PQgetvalue(res, i, 9);
00104       fInnerDeadThickness = dbutil.c_Float(PQgetvalue(res, i, 10));
00105       fOuterDeadThickness = dbutil.c_Float(PQgetvalue(res, i, 11));
00106       fInnerBkgModel = PQgetvalue(res, i, 12);
00107       fDiodType = *(char*)PQgetvalue(res, i, 13);
00108       fDepletionVolt = dbutil.c_Float(PQgetvalue(res, i, 14));
00109 
00110       //get the matrials
00111       fCrystalMat = *(MJDatabase::GetMaterial(matName));
00112       fInnerContactMat = *(MJDatabase::GetMaterial(innerMat));
00113 
00114       //get resolution at different energies
00115       int len = PQgetlength(res,i, 15);
00116       float * ener ;
00117       if( len > 0) dbutil.fillArray(ener, PQgetvalue(res, i, 15));
00118       len = PQgetlength(res,i, 16);
00119       float * resol;
00120       if( len > 0) dbutil.fillArray(resol, PQgetvalue(res, i, 16));
00121       //create the vector of resolutions
00122       int num =dbutil.getNoEle(PQgetvalue(res, i, 15));  
00123       for (int j=0; j< num; j++){
00124         fResolution.push_back(CrystalRes(ener[j], resol[j]));
00125       }
00126 
00127       //get efficiencies at different energies
00128 
00129       len = PQgetlength(res,i, 17);
00130       if( len > 0) dbutil.fillArray(ener, PQgetvalue(res, i, 17));
00131       len = PQgetlength(res,i, 18);
00132       float * eff;
00133       if( len > 0) dbutil.fillArray(eff, PQgetvalue(res, i, 18));
00134       //create the vector of efficiencies
00135       num =dbutil.getNoEle(PQgetvalue(res, i, 17));
00136       for (int j=0; j< num; j++){
00137         fEfficiencies.push_back(CrystalEff(ener[j], eff[j]));
00138       }
00139 
00140       fcomment = PQgetvalue(res, i, 19);
00141 
00142 
00143     }
00144   return this;
00145 } 
00146 void 
00147 MJDatabaseSimple800g::print(ostream &os){
00148 
00149   os << '\n' 
00150      << "******* Simple 800g Crystal: " << GetCrystalSerialNo() 
00151      << " ******" << '\n'
00152      << "Radius       : " << GetCrystalRadius() << '\n'
00153      << "Height       : " << GetCrystalHeight() <<'\n'
00154      << "Core Radius  : " << GetCoreRadius() << '\n'
00155      << "Corner Radius: " << GetCornerRadius() << '\n'
00156      << "Core Depth   : " << GetCoreDepth() << '\n';
00157 
00158   vector<CrystalRes>::iterator itr;
00159   os<< "Resolution   : " ;
00160   for(itr = fResolution.begin(); itr != fResolution.end(); itr++)
00161     os <<  itr->resolution() << "(" << itr->energy() << ") "; 
00162   os << '\n';
00163 
00164   vector<CrystalEff>::iterator it;
00165   os<< "Efficiencies   : " ;
00166   for(it = fEfficiencies.begin(); it != fEfficiencies.end(); it++)
00167     os <<  it->efficiency () << "(" << it->energy() << ") "; 
00168   os <<endl;
00169 
00170   fCrystalMat.print(os);
00171   fInnerContactMat.print(os);
00172 
00173 }
00174 ostream& 
00175 operator << (ostream& os, MJDatabaseSimple800g& crys){
00176  
00177   os << '\n' 
00178      << "******* Simple 800g Crystal: " << crys.GetCrystalSerialNo() 
00179      << " ******" << '\n'
00180      << "Radius       : " << crys.GetCrystalRadius() << '\n'
00181      << "Height       : " << crys.GetCrystalHeight() <<'\n'
00182      << "Core Radius  : " << crys.GetCoreRadius() << '\n'
00183      << "Corner Radius: " << crys.GetCornerRadius() << '\n'
00184      << "Core Depth   : " << crys.GetCoreDepth() << '\n';
00185 
00186   vector<CrystalRes>::iterator itr;
00187   os<< "Resolution   : " ;
00188   for(itr = crys.fResolution.begin(); itr != crys.fResolution.end(); itr++)
00189     os <<  itr->resolution() << "(" << itr->energy() << ") "; 
00190   os << '\n';
00191 
00192   vector<CrystalEff>::iterator it;
00193   os<< "Efficiencies   : " ;
00194   for(it = crys.fEfficiencies.begin(); it != crys.fEfficiencies.end(); it++)
00195     os <<  it->efficiency () << "(" << it->energy() << ") "; 
00196   os <<endl;
00197 
00198   os << crys.fCrystalMat;
00199   os << crys.fInnerContactMat;
00200  
00201   return os;
00202 }

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