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

MJDatabaseClover4x50x80DetCalib.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: MJDatabaseClover4x50x80DetCalib.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJDatabaseClover4x50x80DetCalib.cc
00026 //
00027 //---------------------------------------------------------------------------//
00033 // 
00034 //---------------------------------------------------------------------------//
00044 //---------------------------------------------------------------------------//
00045 //
00046 
00047 
00048 //#include "MJStuff.hh"                   //additional MJ Headers
00049 
00050 //---------------------------------------------------------------------------//
00051 
00052 #include "database/MJDatabaseClover4x50x80DetCalib.hh"      //Present MJ Class Headers 
00053 #include "database/MJDatabaseUtil.hh"
00054 //---------------------------------------------------------------------------//
00055 
00056 MJDatabaseClover4x50x80DetCalib::MJDatabaseClover4x50x80DetCalib()
00057 {
00058 
00059 }
00060 MJDatabaseClover4x50x80DetCalib::MJDatabaseClover4x50x80DetCalib(const MJDatabaseClover4x50x80DetCalib & other)
00061 {
00062 
00063 }
00064 
00065 MJDatabaseClover4x50x80DetCalib::~MJDatabaseClover4x50x80DetCalib()
00066 {
00067 }
00068 MJDatabaseClover4x50x80DetCalib*
00069 MJDatabaseClover4x50x80DetCalib::createCalib(PGresult* res)
00070 {
00071   MJDatabaseUtil dbutil;
00072   for(int i=0; i<PQntuples(res); i++)
00073     {
00074       string name = PQgetvalue(res, i, 0);
00075       fDetName = PQgetvalue(res, i, 1);
00076       float Acoef = dbutil.c_Float(PQgetvalue(res, i, 2));
00077       float Bcoef = dbutil.c_Float(PQgetvalue(res, i, 3));
00078       float Ccoef = dbutil.c_Float(PQgetvalue(res, i, 4));
00079       float stdvA = dbutil.c_Float(PQgetvalue(res, i, 5));
00080       float stdvB = dbutil.c_Float(PQgetvalue(res, i, 6));
00081       
00082       //get list of energies at which measurements were made
00083       int len = PQgetlength(res,i, 7);
00084       float *ener;
00085       if( len > 0) dbutil.fillArray(ener, PQgetvalue(res, i, 7));
00086       float * fwhm;
00087       len = PQgetlength(res,i, 8);
00088       if( len > 0) dbutil.fillArray(fwhm, PQgetvalue(res, i, 8));
00089       int* channel;
00090       len = PQgetlength(res,i, 9);
00091       if( len > 0) dbutil.fillArray(channel, PQgetvalue(res, i, 9));
00092 
00093       //this need fixing. this returns long long and should be 
00094       //converted inot the time 
00095       //char* bt = dbutil.c_Time(PQgetvalue(res, i, 10));
00096       //char* et = dbutil.c_Time(PQgetvalue(res, i, 11));
00097 
00098       char* bt = PQgetvalue(res, i, 10);
00099       char* et = PQgetvalue(res, i, 11);
00100 
00101       //create a calibration object and add it to the vector
00102       fCalib.insert(make_pair(name, CloverDet4x50x80Calib
00103                               ((double)Acoef, 
00104                                (double)Bcoef, (double)Ccoef,
00105                                (double)stdvA, (double)stdvB, bt, et,
00106                                (double*)ener, (double*)fwhm, channel)));
00107       fName.push_back(name);
00108 
00109 
00110     }
00111   return this;
00112 }
00113 ostream& operator << (ostream& os, const CloverDet4x50x80Calib& calib)
00114 {
00115   os << calib.GetA() << "  " <<calib.GetB() << "  " << calib.GetC() 
00116      << "  " << calib.GetSDEVA()
00117      << "  "<< calib.GetSDEVB() << "  " << calib.GetBeginTime() 
00118      << "  " << calib.GetEndTime() 
00119      << "  " << calib.fenergy[0] << " , " << calib.fenergy[1] 
00120      << " , " << calib.fenergy[2] 
00121      << "  " << calib.fFWHM[0] << " , " << calib.fFWHM[1] 
00122      << " , " << calib.fFWHM[2] 
00123      << "  " << calib.fchannelNo[0] << " , " << calib.fchannelNo[1] 
00124      << " , " << calib.fchannelNo[2]
00125      << "    " << calib.GetBeginTime() 
00126      << "    " << calib.GetEndTime() 
00127     ;
00128   return os;
00129 }
00130 
00131 ostream & operator << (ostream& os, MJDatabaseClover4x50x80DetCalib& calib)
00132 {
00133   os << '\n'
00134      <<"****** Clover Detector calibration for: " << calib.GetDetName() << '\n'
00135      <<" E1   :\n " << calib.GetE1()<< '\n'     
00136      <<" E2   :\n " << calib.GetE2() << '\n'
00137      <<" E3   :\n " << calib.GetE3()<< '\n'
00138      <<" E4   :\n " << calib.GetE4()<< '\n'
00139      <<" Pl   :\n " << calib.GetPl()<< '\n'
00140      <<" Pm   :\n " << calib.GetPm()<< '\n'
00141      <<" Pr   :\n " << calib.GetPr()<< '\n'
00142      <<'\n';
00143 
00144   return os;
00145 }

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