/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #include "DBWriter/CalibPmtWriter.h" 00002 #include "DBWriter/RunInfoQuary.h" 00003 #include "Context/ContextRange.h" 00004 00005 #include "DatabaseInterface/DbiResultPtr.h" 00006 #include "DatabaseInterface/DbiSqlContext.h" 00007 00008 #ifdef I_LIKE_DUPLICITY 00009 #include "DaqRunInfoSvc/DaqRunInfo.h" 00010 #else 00011 #include "genDbi/GDaqRunInfo.h" 00012 #endif 00013 00014 #include "iostream" 00015 00016 using namespace std; 00017 00018 int RunInfoQuary::runNo2ContextRange(int runNo , ContextRange& cr) 00019 { 00020 //Get all the raw data files 00021 DbiSqlContext vc("1=1"); //WHERE clause 00022 00023 #ifdef I_LIKE_DUPLICITY 00024 DbiResultPtr<DaqRunInfo> rp("DaqRunInfo", vc); 00025 #else 00026 DbiResultPtr<GDaqRunInfo> rp("DaqRunInfo", vc); 00027 #endif 00028 00029 // Check number of entries in result set 00030 unsigned int numRows = rp.GetNumRows(); 00031 if (numRows < 1) 00032 { 00033 cout<<"No records is found in table DaqRunInfo"<<endl; 00034 return 0; 00035 } 00036 #ifdef I_LIKE_DUPLICITY 00037 const DaqRunInfo* row; 00038 #else 00039 const GDaqRunInfo* row; 00040 #endif 00041 unsigned int idx = 0; 00042 while(idx < numRows) 00043 { 00044 row = rp.GetRow(idx); 00045 if(runNo == row->GetRunNo()) break; 00046 idx++; 00047 } 00048 if(idx == numRows) 00049 { 00050 cout<<"no record of "<<runNo<<" run "<<endl; 00051 return 0; 00052 } 00053 DbiResult* res = row->GetOwner(); 00054 const DbiValidityRec vr = res->GetValidityRec(); 00055 cr = vr.GetContextRange(); 00056 return 1; 00057 } 00058 00059 int RunInfoQuary::ContextRange2runNo(const ContextRange& cr) 00060 { 00061 return 0; 00062 }