CMS 3D CMS Logo

DCSPTMTempList Class Reference

#include <OnlineDB/EcalCondDB/interface/DCSPTMTempList.h>

Inheritance diagram for DCSPTMTempList:

IDBObject

List of all members.

Public Member Functions

 DCSPTMTempList ()
void fetchValuesForECID (EcalLogicID ecid) throw (std::runtime_error)
void fetchValuesForECIDAndTime (EcalLogicID ecid, Tm start, Tm end) throw (std::runtime_error)
std::vector< DCSPTMTempgetList ()
 ~DCSPTMTempList ()

Private Attributes

std::vector< DCSPTMTempm_vec_temp

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 15 of file DCSPTMTempList.h.


Constructor & Destructor Documentation

DCSPTMTempList::DCSPTMTempList (  ) 

Definition at line 15 of file DCSPTMTempList.cc.

References IDBObject::m_conn, and NULL.

00016 {
00017   m_conn = NULL;
00018 }

DCSPTMTempList::~DCSPTMTempList (  ) 

Definition at line 20 of file DCSPTMTempList.cc.

00021 {
00022 }


Member Function Documentation

void DCSPTMTempList::fetchValuesForECID ( EcalLogicID  ecid  )  throw (std::runtime_error)

Definition at line 31 of file DCSPTMTempList.cc.

References IDBObject::checkConnection(), GenMuonPlsPt100GeV_cfg::cout, DateHandler::dateToTm(), e, lat::endl(), i, IDBObject::m_conn, IDBObject::m_env, m_vec_temp, r, DCSPTMTemp::setEcalLogicID(), DCSPTMTemp::setEnd(), DCSPTMTemp::setStart(), DCSPTMTemp::setTemperature(), and x.

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

00033 {
00034 
00035   this->checkConnection();
00036   int nruns=0;
00037 
00038   int ecid_id=ecid.getLogicID();
00039 
00040   try {
00041     Statement* stmt0 = m_conn->createStatement();
00042     stmt0->setSQL("SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
00043                  "WHERE logic_id = :logic_id  " );
00044     stmt0->setInt(1, ecid_id);
00045   
00046     ResultSet* rset0 = stmt0->executeQuery();
00047     if (rset0->next()) {
00048       nruns = rset0->getInt(1);
00049     }
00050     m_conn->terminateStatement(stmt0);
00051 
00052     cout <<"DCSPTMTempList::fetchValuesForECID>> Number of records in DB="<< nruns << endl;
00053     m_vec_temp.reserve(nruns);
00054     
00055     Statement* stmt = m_conn->createStatement();
00056     stmt->setSQL("SELECT  "
00057                  "since, till, temperature  FROM PVSS_TEMPERATURE_DAT "
00058                  "WHERE logic_id = :logic_id  order by since " );
00059     stmt->setInt(1, ecid_id);
00060 
00061     DateHandler dh(m_env, m_conn);
00062     Tm runStart;
00063     Tm runEnd;
00064   
00065     ResultSet* rset = stmt->executeQuery();
00066     int i=0;
00067     while (i<nruns) {
00068       rset->next();
00069      
00070        Date startDate = rset->getDate(1);
00071        Date endDate = rset->getDate(2);  
00072        float x = rset->getFloat(3);      
00073        runStart = dh.dateToTm( startDate );
00074        runEnd = dh.dateToTm( endDate );
00075        
00076        DCSPTMTemp r ;
00077        r.setTemperature(x);
00078        r.setStart(runStart);
00079        r.setEnd(runEnd);
00080        r.setEcalLogicID(ecid);
00081        m_vec_temp.push_back(r);
00082       
00083       i++;
00084     }
00085    
00086     cout <<"DCSPTMTempList::fetchValuesForECID>> loop done " << endl;
00087 
00088     m_conn->terminateStatement(stmt);
00089   } catch (SQLException &e) {
00090     throw(runtime_error("DCSPTMTempList:  "+e.getMessage()));
00091   }
00092 
00093 
00094 }

void DCSPTMTempList::fetchValuesForECIDAndTime ( EcalLogicID  ecid,
Tm  start,
Tm  end 
) throw (std::runtime_error)

Definition at line 96 of file DCSPTMTempList.cc.

References IDBObject::checkConnection(), GenMuonPlsPt100GeV_cfg::cout, DateHandler::dateToTm(), e, end, lat::endl(), i, IDBObject::m_conn, IDBObject::m_env, m_vec_temp, r, DCSPTMTemp::setEcalLogicID(), DCSPTMTemp::setEnd(), DCSPTMTemp::setStart(), DCSPTMTemp::setTemperature(), DateHandler::tmToDate(), and x.

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

00098 {
00099 
00100   this->checkConnection();
00101   int nruns=0;
00102 
00103   int ecid_id=ecid.getLogicID();
00104 
00105   DateHandler dh(m_env, m_conn);
00106   Tm runStart;
00107   Tm runEnd;
00108 
00109 
00110   try {
00111     Statement* stmt0 = m_conn->createStatement();
00112     stmt0->setSQL("SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
00113                  "WHERE logic_id = :logic_id  " 
00114                  "AND since >= :start_time  " 
00115                  "AND since <= :till_time  " 
00116                   );
00117     stmt0->setInt(1, ecid_id);
00118     stmt0->setDate(2, dh.tmToDate(start));
00119     stmt0->setDate(3, dh.tmToDate(end));
00120   
00121     ResultSet* rset0 = stmt0->executeQuery();
00122     if (rset0->next()) {
00123       nruns = rset0->getInt(1);
00124     }
00125     m_conn->terminateStatement(stmt0);
00126 
00127     cout <<"DCSPTMTempList::fetchValuesForECIDAndTime>> Number of records in DB="<< nruns << endl;
00128     m_vec_temp.reserve(nruns);
00129     
00130     Statement* stmt = m_conn->createStatement();
00131     stmt->setSQL("SELECT  "
00132                  "since, till, temperature  FROM PVSS_TEMPERATURE_DAT "
00133                  "WHERE logic_id = :logic_id "
00134                  "AND since >= :start_time  " 
00135                  "AND since <= :till_time  " 
00136                  " order by since " );
00137     stmt->setInt(1, ecid_id);
00138     stmt->setDate(2, dh.tmToDate(start));
00139     stmt->setDate(3, dh.tmToDate(end));
00140 
00141   
00142     ResultSet* rset = stmt->executeQuery();
00143     int i=0;
00144     while (i<nruns) {
00145       rset->next();
00146      
00147        Date startDate = rset->getDate(1);
00148        Date endDate = rset->getDate(2);  
00149        float x = rset->getFloat(3);      
00150        runStart = dh.dateToTm( startDate );
00151        runEnd = dh.dateToTm( endDate );
00152        
00153        DCSPTMTemp r ;
00154        r.setTemperature(x);
00155        r.setStart(runStart);
00156        r.setEnd(runEnd);
00157        r.setEcalLogicID(ecid);
00158        m_vec_temp.push_back(r);
00159       
00160       i++;
00161     }
00162    
00163 
00164     m_conn->terminateStatement(stmt);
00165   } catch (SQLException &e) {
00166     throw(runtime_error("DCSPTMTempList:  "+e.getMessage()));
00167   }
00168 
00169 
00170 }

std::vector< DCSPTMTemp > DCSPTMTempList::getList (  ) 

Definition at line 25 of file DCSPTMTempList.cc.

References m_vec_temp.

00026 {
00027   return m_vec_temp;
00028 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 17 of file DCSPTMTempList.h.


Member Data Documentation

std::vector<DCSPTMTemp> DCSPTMTempList::m_vec_temp [private]

Definition at line 33 of file DCSPTMTempList.h.

Referenced by fetchValuesForECID(), fetchValuesForECIDAndTime(), and getList().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:43 2009 for CMSSW by  doxygen 1.5.4