BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvtGen/bak-BesEvtGen-00-04-08/src/ReadME.cxx
Go to the documentation of this file.
1//======= Lianjin WU <[email protected]> ======
2#include "ReadME.h"
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;
9
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;
14
15 char stmt[400];
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);
17
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; }
21 else{
22 DatabaseRecord* records=res[0];
23 std::cout<<"MeasuredEcmsSvc first read the runNo, read the MeasuredEcms database"<<runNo<<std::endl;
24 m_runFrom=records->GetDouble("RunFrom");
25 m_runTo=records->GetDouble("RunTo");
26 m_sampleName=records->GetDouble("sample");
27 m_ecms=records->GetDouble("Ecms");
28 // m_ecmsErr=records->GetDouble("Ecms_err");
29 // m_aveEcms=records->GetDouble("Ave_Ecms");
30 // m_aveEcmsErr=records->GetDouble("Ave_Ecms_err");
31 m_runNoValid=true;
32 }
33}
34
36 RunParamsMin=11414;
37 RunParamsMax=23454;
38 MeasuredEcmsMin=23463;
39 MeasuredEcmsMax=38140;
40 DsRunParamsMin=43716;
41 DsRunParamsMax=47066;
42 runxyzMin=47543;
43 runxyzMax=51498;
44 if(std::abs(runNo)>=RunParamsMin&&std::abs(runNo)<=RunParamsMax) readRunParams(runNo);
45 if(std::abs(runNo)>=MeasuredEcmsMin&&std::abs(runNo)<=MeasuredEcmsMax) readMeasuredEcms(runNo);
46 if(std::abs(runNo)>=DsRunParamsMin&&std::abs(runNo)<=DsRunParamsMax) readRunParams(runNo);
47 if(std::abs(runNo)>=runxyzMin&&std::abs(runNo)<=runxyzMax) readMeasuredEcms(runNo);
48}
49
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;
55
56 std::cout<<"MeasuredEcmsSvc begin read database RunParams"<<std::endl;
57 int runNum=std::abs(runNo);
58
59 if(runNo<0) std::cout<<"MeasuredEcmsSvc for MC events"<<std::endl;
60 else std::cout<<"MeasuredEcmsSvc for DT events"<<std::endl;
61
62 char stmt1[400];
63 snprintf(stmt1, 1024, "select beam_energy, px, py, pz from RunParams where run_number = %d", runNum);
64
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;}
68 else{
69 DatabaseRecord* records = res[0];
70 std::cout<<"MeasuredEcmsSvc first read the runNo, read the RunParams database"<<runNo<<std::endl;
71 double bE=0;
72 bE=records->GetDouble("beam_energy");
73 m_px=records->GetDouble("px");
74 m_py=records->GetDouble("py");
75 m_pz=records->GetDouble("pz");
76 m_ecms=bE*2.00;
77 m_runNoValid=true;
78 }
79}
80
int runNo
Definition: DQA_TO_DB.cxx:12
double GetDouble(std::string key)
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0