3int ReadME::preRunNo=-1;
5 m_sampleName=0; m_ecms=0; m_ecmsErr=0;
6 m_aveEcms=0; m_aveEcmsErr=0; m_runFrom=0;
7 m_runTo=0; m_runNoValid=
false;
8 m_px=0; m_py=0; m_pz=0;
10 std::cout<<
"MeasuredEcmsSvc begin read database MeasuredEcmsSvc"<<std::endl;
11 int runNum=std::abs(
runNo);
12 if(
runNo<0) std::cout<<
"MeasuredEcmsSvc for MC events"<<std::endl;
13 else std::cout<<
"MeasuredEcmsSvc for DT events"<<std::endl;
16 snprintf(stmt, 1024,
"select sample, RunFrom, RunTo, Ecms, Ecms_err, Ave_Ecms, Ave_Ecms_err from MeasuredEcms2 where RunFrom <= %d and RunTo >= %d", runNum, runNum);
19 int rowNo=m_dbSvc->
query(
"offlinedb", stmt, res);
20 if(rowNo==0){ std::cout<<
"RowNo can not be 0 for MeasuredEcmsSvc, failed to read DB"<<std::endl; }
23 std::cout<<
"MeasuredEcmsSvc first read the runNo, read the MeasuredEcms database"<<
runNo<<std::endl;
26 m_sampleName=records->
GetDouble(
"sample");
30 m_aveEcmsErr=records->
GetDouble(
"Ave_Ecms_err");
38 MeasuredEcmsMin=23463;
39 MeasuredEcmsMax=38140;
48 m_sampleName=0; m_ecms=0; m_ecmsErr=0;
49 m_aveEcms=0; m_aveEcmsErr=0; m_runFrom=0;
50 m_runTo=0; m_runNoValid=
false;
51 m_px=0; m_py=0; m_pz=0;
53 std::cout<<
"MeasuredEcmsSvc begin read database RunParams"<<std::endl;
54 int runNum=std::abs(
runNo);
56 if(
runNo<0) std::cout<<
"MeasuredEcmsSvc for MC events"<<std::endl;
57 else std::cout<<
"MeasuredEcmsSvc for DT events"<<std::endl;
60 snprintf(stmt1, 1024,
"select beam_energy, px, py, pz from RunParams where run_number = %d", runNum);
63 int row_no = m_dbSvc->
query(
"offlinedb", stmt1, res);
64 if(row_no==0){std::cout<<
"RowNo can not be 0 for RunParams, failed to read DB"<<std::endl;}
67 std::cout<<
"MeasuredEcmsSvc first read the runNo, read the RunParams database"<<
runNo<<std::endl;
double GetDouble(std::string key)
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0
void readRunParams(int runNo)
void readMeasuredEcms(int runNo)