BOSS
7.1.3
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvtGen/BesEvtGen-00-04-30/src/ReadME.cxx
Go to the documentation of this file.
1
//======= Lianjin WU <
[email protected]
> ======
2
#include "ReadME.h"
3
int
ReadME::preRunNo=-1;
4
void
ReadME::readMeasuredEcms
(
int
runNo
){
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
18
DatabaseRecordVector
res;
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
35
void
ReadME::readDB
(
int
runNo
){
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
50
void
ReadME::readRunParams
(
int
runNo
){
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
65
DatabaseRecordVector
res;
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
runNo
int runNo
Definition
DQA_TO_DB.cxx:12
DatabaseRecordVector
Definition
DatabaseRecord.h:75
DatabaseRecord
Definition
DatabaseRecord.h:10
DatabaseRecord::GetDouble
double GetDouble(std::string key)
Definition
DatabaseRecord.h:46
ReadME::readDB
void readDB(int runNo)
Definition
BesEvtGen/BesEvtGen-00-04-30/src/ReadME.cxx:35
ReadME::readRunParams
void readRunParams(int runNo)
Definition
BesEvtGen/BesEvtGen-00-04-30/src/ReadME.cxx:50
ReadME::readMeasuredEcms
void readMeasuredEcms(int runNo)
Definition
BesEvtGen/BesEvtGen-00-04-30/src/ReadME.cxx:4
7.1.3
Generator
BesEvtGen
BesEvtGen-00-04-30
src
ReadME.cxx
Generated by
1.13.2