00001 00002 // $Id: CalibFeeSpec.cc,v 1.0 2009/7/4 16:40:00 $ 00003 // 00004 // CalibFeeSpec 00005 // 00006 // Package: Dbi (Database Interface). 00007 // 00008 // Concept: A concrete data type corresponding to a single row in a 00009 // database table of non-aggregated data. 00010 // 00011 // based on DataModel/DataSvc/ and Database/DbiSimDataSvc 00012 // XiaoSu Chen 2/2010 00013 // 00014 // 00016 00017 #include "DbiDataSvc/CalibFeeSpec.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(CalibFeeSpec) 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<CalibFeeSpec>; 00035 00036 #include "DatabaseInterface/DbiWriter.tpl" 00037 template class DbiWriter<CalibFeeSpec>; 00038 #include<iostream> 00039 using namespace std; 00040 // Definition of member functions (alphabetical order) 00041 // *************************************************** 00042 00043 00044 //..................................................................... 00045 00046 void CalibFeeSpec::Fill(DbiResultSet& rs, 00047 const DbiValidityRec* /* vrec */) { 00048 // 00049 // 00050 // Purpose: Fill object from Result Set 00051 // 00052 // Arguments: 00053 // rs in Result Set used to fill object 00054 // vrec in Associated validity record (or 0 if filling 00055 // DbiValidityRec) 00056 // Return: 00057 // 00058 // Modified from the SimPmtSpec 00059 // 00060 // Specification:- 00061 // ============= 00062 // 00063 // o Fill object from current row of Result Set. 00064 00065 // Program Notes:- 00066 // ============= 00067 00068 Int_t numCol = rs.NumCols(); 00069 // The first column (SeqNo) has already been processed. 00070 for (Int_t curCol = 2; curCol <= numCol; ++curCol) { 00071 string colName = rs.CurColName(); 00072 if (colName == "CHANNELID"){ 00073 int channelId = 0; rs >> channelId; //???? 00074 m_channelId = DayaBay::FeeChannelId( channelId );//???? 00075 00076 } 00077 else if ( colName == "STATUS" ) rs >> m_status; 00078 else if ( colName == "ADCTHRESHOLDHIGH" ) rs >> m_adcThresholdHigh; 00079 else if ( colName == "ADCTHRESHOLDLOW" ) rs >> m_adcThresholdLow; 00080 else if ( colName == "ADCPEDESTALHIGH" ) rs >> m_adcPedestalHigh; 00081 else if ( colName == "ADCPEDESTALLOW" ) rs >> m_adcPedestalLow; 00082 else if ( colName == "ADCPETESTALHIGHSIGMA" ) rs >> m_adcPedestalHighSigma; 00083 else if ( colName == "ADCPETESTALLOWSIGMA" ) rs >> m_adcPedestalLowSigma; 00084 else { 00085 LOG(dbi,Logging::kDebug1) << "Ignoring column " << curCol 00086 << "(" << colName << ")" 00087 << "; not part of CalibFeeSpec" << std::endl; 00088 rs.IncrementCurCol(); 00089 } 00090 } 00091 } 00092 //..................................................................... 00093 00094 void CalibFeeSpec::Store(DbiOutRowStream& ors, 00095 const DbiValidityRec* /* vrec */) const { 00096 cout<<"storeing------"<<endl; 00097 // 00098 // 00099 // Purpose: Stream object to output row stream 00100 // 00101 // Arguments: 00102 // ors in Output row stream. 00103 // vrec in Associated validity record (or 0 if filling 00104 // DbiValidityRec) 00105 // 00106 // Return: 00107 // 00108 // Contact: N. West 00109 // 00110 // Specification:- 00111 // ============= 00112 // 00113 // o Stream object to output row stream. 00114 00115 // Program Notes:- 00116 // ============= 00117 00118 // None. 00119 00120 00121 00122 ors << m_channelId.fullPackedData() << m_status 00123 << m_adcPedestalHigh << m_adcPedestalHighSigma << m_adcPedestalLow<< m_adcPedestalLowSigma 00124 << m_adcThresholdHigh<< m_adcThresholdLow; 00125 /* 00126 ors << m_channelId<< m_status 00127 << m_adcThresholdHigh << m_adcThresholdLow << m_adcPedestalHigh << m_adcPedestalHighSigma 00128 << m_adcPedestalLow << m_adcPedestalLowSigma; 00129 */ 00130 } 00131