00001 00002 // $Id: SimPmtSpec.cc,v 1.0 2008/11/30 18:00:00 Lin Exp $ 00003 // 00004 // SimPmtSpec 00005 // 00006 // Package: Dbi (Database Interface). 00007 // 00008 // C.-J. Lin 11/2008 00009 // 00010 // Concept: A concrete data type corresponding to a single row in a 00011 // database table of non-aggregated data. 00012 // 00013 // Purpose: 00014 // 00016 00017 #include "DbiDataSvc/SimPmtSpec.h" 00018 #include "DatabaseInterface/DbiLog.h" 00019 #include "DatabaseInterface/DbiOutRowStream.h" 00020 #include "DatabaseInterface/DbiResultSet.h" 00021 #include "DatabaseInterface/DbiValidityRec.h" 00022 00023 // Removed: ClassImp(SimPmtSpec) 00024 00025 00026 // Definition of static data members 00027 // ********************************* 00028 00029 00030 // Instantiate associated Result Pointer and writer classes. 00031 // ******************************************************** 00032 00033 #include "DatabaseInterface/DbiResultPtr.tpl" 00034 template class DbiResultPtr<SimPmtSpec>; 00035 00036 #include "DatabaseInterface/DbiWriter.tpl" 00037 template class DbiWriter<SimPmtSpec>; 00038 00039 // Definition of member functions (alphabetical order) 00040 // *************************************************** 00041 00042 00043 //..................................................................... 00044 00045 void SimPmtSpec::Fill(DbiResultSet& rs, 00046 const DbiValidityRec* /* vrec */) { 00047 // 00048 // 00049 // Purpose: Fill object from Result Set 00050 // 00051 // Arguments: 00052 // rs in Result Set used to fill object 00053 // vrec in Associated validity record (or 0 if filling 00054 // DbiValidityRec) 00055 // Return: 00056 // 00057 // Contact: C.-J. Lin 00058 // 00059 // Specification:- 00060 // ============= 00061 // 00062 // o Fill object from current row of Result Set. 00063 00064 // Program Notes:- 00065 // ============= 00066 00067 Int_t numCol = rs.NumCols(); 00068 // The first column (SeqNo) has already been processed. 00069 for (Int_t curCol = 2; curCol <= numCol; ++curCol) { 00070 string colName = rs.CurColName(); 00071 if ( colName == "PMTID" ){ 00072 int pmtId = 0; rs >> pmtId; 00073 m_pmtId = DayaBay::DetectorSensor( pmtId ); 00074 } 00075 else if ( colName == "PMTDESCRIB" ) rs >> m_describ; 00076 else if ( colName == "PMTGAIN" ) rs >> m_gain; 00077 else if ( colName == "PMTSIGMAG" ) rs >> m_sigmaGain; 00078 else if ( colName == "PMTTOFFSET" ) rs >> m_timeOffset; 00079 else if ( colName == "PMTTSPREAD" ) rs >> m_timeSpread; 00080 else if ( colName == "PMTEFFIC" ) rs >> m_efficiency; 00081 else if ( colName == "PMTPREPULSE" ) rs >> m_prePulseProb; 00082 else if ( colName == "PMTAFTERPULSE") rs >> m_afterPulseProb; 00083 else if ( colName == "PMTDARKRATE" ) rs >> m_darkRate; 00084 else { 00085 LOG(dbi,Logging::kDebug1) << "Ignoring column " << curCol 00086 << "(" << colName << ")" 00087 << "; not part of SimPmtSpec" << std::endl; 00088 rs.IncrementCurCol(); 00089 } 00090 } 00091 } 00092 //..................................................................... 00093 00094 void SimPmtSpec::Store(DbiOutRowStream& ors, 00095 const DbiValidityRec* /* vrec */) const { 00096 // 00097 // 00098 // Purpose: Stream object to output row stream 00099 // 00100 // Arguments: 00101 // ors in Output row stream. 00102 // vrec in Associated validity record (or 0 if filling 00103 // DbiValidityRec) 00104 // 00105 // Return: 00106 // 00107 // Contact: N. West 00108 // 00109 // Specification:- 00110 // ============= 00111 // 00112 // o Stream object to output row stream. 00113 00114 // Program Notes:- 00115 // ============= 00116 00117 // None. 00118 00119 00120 ors << m_pmtId.sensorId() << m_gain 00121 << m_sigmaGain << m_timeOffset << m_timeSpread << m_efficiency 00122 << m_prePulseProb << m_afterPulseProb << m_darkRate; 00123 } 00124