BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvtGen/src/ReadME.cxx
Go to the documentation of this file.
1//======= Lianjin WU <wulj@ihep.ac.cn> ======
2#include "ReadME.h"
3int ReadME::preRunNo = -1;
5 m_sampleName = 0;
6 m_ecms = 0;
7 m_ecmsErr = 0;
8 m_aveEcms = 0;
9 m_aveEcmsErr = 0;
10 m_runFrom = 0;
11 m_runTo = 0;
12 m_runNoValid = false;
13 m_px = 0;
14 m_py = 0;
15 m_pz = 0;
16
17 std::cout << "MeasuredEcmsSvc begin read database MeasuredEcmsSvc" << std::endl;
18 int runNum = std::abs( runNo );
19 if ( runNo < 0 ) std::cout << "MeasuredEcmsSvc for MC events" << std::endl;
20 else std::cout << "MeasuredEcmsSvc for DT events" << std::endl;
21
22 char stmt[400];
23 snprintf( stmt, 1024,
24 "select sample, RunFrom, RunTo, Ecms, Ecms_err, Ave_Ecms, Ave_Ecms_err from "
25 "MeasuredEcms2 where RunFrom <= %d and RunTo >= %d",
26 runNum, runNum );
27
29 int rowNo = m_dbSvc->query( "offlinedb", stmt, res );
30 if ( rowNo == 0 )
31 { std::cout << "RowNo can not be 0 for MeasuredEcmsSvc, failed to read DB" << std::endl; }
32 else
33 {
34 DatabaseRecord* records = res[0];
35 std::cout << "MeasuredEcmsSvc first read the runNo, read the MeasuredEcms database"
36 << runNo << std::endl;
37 m_runFrom = records->GetDouble( "RunFrom" );
38 m_runTo = records->GetDouble( "RunTo" );
39 m_sampleName = records->GetDouble( "sample" );
40 m_ecms = records->GetDouble( "Ecms" );
41 // m_ecmsErr=records->GetDouble("Ecms_err");
42 // m_aveEcms=records->GetDouble("Ave_Ecms");
43 // m_aveEcmsErr=records->GetDouble("Ave_Ecms_err");
44 m_runNoValid = true;
45 }
46}
47
48void ReadME::readDB( int runNo ) {
49 RunParamsMin = 11414;
50 RunParamsMax = 23454;
51 MeasuredEcmsMin = 23463;
52 MeasuredEcmsMax = 38140;
53 DsRunParamsMin = 43716;
54 DsRunParamsMax = 47066;
55 runxyzMin = 47543;
56 runxyzMax = 51498;
57 if ( std::abs( runNo ) >= RunParamsMin && std::abs( runNo ) <= RunParamsMax )
59 if ( std::abs( runNo ) >= MeasuredEcmsMin && std::abs( runNo ) <= MeasuredEcmsMax )
61 if ( std::abs( runNo ) >= DsRunParamsMin && std::abs( runNo ) <= DsRunParamsMax )
63 if ( std::abs( runNo ) >= runxyzMin && std::abs( runNo ) <= runxyzMax )
65}
66
68 m_sampleName = 0;
69 m_ecms = 0;
70 m_ecmsErr = 0;
71 m_aveEcms = 0;
72 m_aveEcmsErr = 0;
73 m_runFrom = 0;
74 m_runTo = 0;
75 m_runNoValid = false;
76 m_px = 0;
77 m_py = 0;
78 m_pz = 0;
79
80 std::cout << "MeasuredEcmsSvc begin read database RunParams" << std::endl;
81 int runNum = std::abs( runNo );
82
83 if ( runNo < 0 ) std::cout << "MeasuredEcmsSvc for MC events" << std::endl;
84 else std::cout << "MeasuredEcmsSvc for DT events" << std::endl;
85
86 char stmt1[400];
87 snprintf( stmt1, 1024, "select beam_energy, px, py, pz from RunParams where run_number = %d",
88 runNum );
89
91 int row_no = m_dbSvc->query( "offlinedb", stmt1, res );
92 if ( row_no == 0 )
93 { std::cout << "RowNo can not be 0 for RunParams, failed to read DB" << std::endl; }
94 else
95 {
96 DatabaseRecord* records = res[0];
97 std::cout << "MeasuredEcmsSvc first read the runNo, read the RunParams database" << runNo
98 << std::endl;
99 double bE = 0;
100 bE = records->GetDouble( "beam_energy" );
101 m_px = records->GetDouble( "px" );
102 m_py = records->GetDouble( "py" );
103 m_pz = records->GetDouble( "pz" );
104 m_ecms = bE * 2.00;
105 m_runNoValid = true;
106 }
107}
int runNo
Definition DQA_TO_DB.cxx:13
void readDB(int runNo)
void readRunParams(int runNo)
void readMeasuredEcms(int runNo)