00001 #ifndef REALDBUTIL_CONNECTIONPROVIDER_H
00002 #define REALDBUTIL_CONNECTIONPROVIDER_H
00003
00004 #include "DatabaseSvc/IDatabaseSvc.h"
00005 #include "DatabaseSvc/DatabaseSvc.h"
00006 #include "DatabaseSvc/DatabaseRecord.h"
00007 #include <vector>
00008 #include <string>
00009
00010 namespace RealDBUtil {
00011
00012 template <class type>
00013 std::string toString(type obj)
00014 {
00015 std::ostringstream tmp;
00016 tmp<<obj;
00017 return tmp.str();
00018 }
00019
00020 class ConnectionProvider {
00021 public:
00023
00024
00025
00026
00027 ConnectionProvider();
00028
00029 ~ConnectionProvider();
00030
00031 enum eRet {
00032 RETOk = 0,
00033 RETBadCnfFile = 1,
00034 RETBadHost = 2,
00035 RETNoConnect = 3,
00036 RETWrongState = 4,
00037 RETBadValue = 5,
00038 RETMySQLError = 6,
00039 RETNoSchemaMatch = 7
00040 };
00042 enum eLevel {
00043 LEVELProd = 1,
00044 LEVELDev = 2,
00045 LEVELTest = 4,
00046 LEVELSuperseded = 8
00047 };
00048
00049 ConnectionProvider::eRet getReadLumInfo( std::string& Lum, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease);
00050 ConnectionProvider::eRet getReadBunchInfo( std::vector<std::string>& bunch, int runNo,std::string SftVer, std::string ParVer, std::string BossRelease);
00051 ConnectionProvider::eRet getReadTrgTableInfo( std::vector<std::string>& trgTable, int runNo);
00052
00053
00054 ConnectionProvider::eRet getReadBackgroundInfo( std::vector<std::string>& fileInfor, int runNo);
00055
00056 ConnectionProvider::eRet getReadBackgroundInfo( std::vector<std::string>& fileInfor, std::string query);
00057 ConnectionProvider::eRet getReadTofThreshInfo( std::vector<std::string>& tofThresh, int runNo);
00058 ConnectionProvider::eRet getRunInfo( std::vector<std::string>& runInfo, int runNo);
00059 ConnectionProvider::eRet getLumCurvePar(std::string& runTotalTime, std::string& tau_value, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease);
00060 ConnectionProvider::eRet getEmcGain(std::vector<double>& emcGain, int runNo);
00061
00062 std::vector<std::string> split(const std::string& src, std::string delimit, std::string null_subst="");
00063 bool getcal(int runNo, std::string ids);
00064
00065 ConnectionProvider::eRet getTrgConfigInfo(int runNo);
00066
00067 int getEtotDataSteps() { return m_EtotDataSteps; }
00068 int getVthBEtotH() { return m_VthBEtotH; }
00069 int getVthEEtotH() { return m_VthEEtotH; }
00070 int getVthEtotL() { return m_VthEtotL; }
00071 int getVthEtotM() { return m_VthEtotM; }
00072 int getVthBLZ() { return m_VthBLZ; }
00073 int getVthDiffB() { return m_VthDiffB; }
00074 int getVthDiffE() { return m_VthDiffE; }
00075 int getVthBalBLK() { return m_VthBalBLK; }
00076 int getVthBalEEMC() { return m_VthBalEEMC; }
00077 int getVthDiffMin() { return m_VthDiffMin; }
00078
00079 private:
00080 IDatabaseSvc* m_dbsvc;
00081
00082 int m_trgTpye;
00083 int m_tfee_fileid;
00084 std::vector<std::string> m_trgTable;
00085 std::vector<std::string> m_tofThresh;
00086
00087 int id_num;
00088 std::string* trgGain[6500];
00089
00090
00091 int m_EtotDataSteps;
00092 int m_VthBEtotH;
00093 int m_VthEEtotH;
00094 int m_VthEtotL;
00095 int m_VthEtotM;
00096 int m_VthBLZ;
00097 int m_VthDiffB;
00098 int m_VthDiffE;
00099 int m_VthBalBLK;
00100 int m_VthBalEEMC;
00101 int m_VthDiffMin;
00102
00103 };
00104 }
00105
00106 #endif