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");
38 MeasuredEcmsMin=23463;
39 MeasuredEcmsMax=38140;
51 m_sampleName=0; m_ecms=0; m_ecmsErr=0;
52 m_aveEcms=0; m_aveEcmsErr=0; m_runFrom=0;
53 m_runTo=0; m_runNoValid=
false;
54 m_px=0; m_py=0; m_pz=0;
56 std::cout<<
"MeasuredEcmsSvc begin read database RunParams"<<std::endl;
57 int runNum=std::abs(
runNo);
59 if(
runNo<0) std::cout<<
"MeasuredEcmsSvc for MC events"<<std::endl;
60 else std::cout<<
"MeasuredEcmsSvc for DT events"<<std::endl;
63 snprintf(stmt1, 1024,
"select beam_energy, px, py, pz from RunParams where run_number = %d", runNum);
66 int row_no = m_dbSvc->
query(
"offlinedb", stmt1, res);
67 if(row_no==0){std::cout<<
"RowNo can not be 0 for RunParams, failed to read DB"<<std::endl;}
70 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)