BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MeasuredEcmsSvc Class Reference

#include <MeasuredEcmsSvc.h>

+ Inheritance diagram for MeasuredEcmsSvc:

Public Member Functions

 MeasuredEcmsSvc (const std::string &name, ISvcLocator *svcLoc)
 
virtual ~MeasuredEcmsSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvIF)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void readMeasuredEcms (int runNo)
 
void readRunParams (int runNo)
 
void readDB (int runNo)
 
int getSampleName (int runNo)
 
int getRunFrom (int runNo)
 
int getRunTo (int runNo)
 
bool isRunNoValid (int runNo)
 
double getEcms (int runNo)
 
double getEcmsErr (int runNo)
 
double getAveEcms (int runNo)
 
double getAveEcmsErr (int runNo)
 
double getPx (int runNo)
 
double getPy (int runNo)
 
double getPz (int runNo)
 
void readInfo (int runNo, char *tab, char *col)
 
double getInfo (int runNo, char *tab, char *col)
 
bool isReadDBValid (int runNo, char *tab, char *col)
 
void readInfo (int runNo)
 
double getInfo (int runNo)
 
bool isReadDBValid (int runNo)
 
 MeasuredEcmsSvc (const std::string &name, ISvcLocator *svcLoc)
 
virtual ~MeasuredEcmsSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvIF)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void readMeasuredEcms (int runNo)
 
void readRunParams (int runNo)
 
void readDB (int runNo)
 
int getSampleName (int runNo)
 
int getRunFrom (int runNo)
 
int getRunTo (int runNo)
 
bool isRunNoValid (int runNo)
 
double getEcms (int runNo)
 
double getEcmsErr (int runNo)
 
double getAveEcms (int runNo)
 
double getAveEcmsErr (int runNo)
 
double getPx (int runNo)
 
double getPy (int runNo)
 
double getPz (int runNo)
 
void readInfo (int runNo, char *tab, char *col)
 
double getInfo (int runNo, char *tab, char *col)
 
bool isReadDBValid (int runNo, char *tab, char *col)
 
void readInfo (int runNo)
 
double getInfo (int runNo)
 
bool isReadDBValid (int runNo)
 
- Public Member Functions inherited from IMeasuredEcmsSvc
virtual ~IMeasuredEcmsSvc ()
 
virtual void readMeasuredEcms (int runNo)=0
 
virtual void readRunParams (int runNo)=0
 
virtual void readDB (int runNo)=0
 
virtual int getSampleName (int runNo)=0
 
virtual int getRunFrom (int runNo)=0
 
virtual int getRunTo (int runNo)=0
 
virtual bool isRunNoValid (int runNo)=0
 
virtual double getEcms (int runNo)=0
 
virtual double getEcmsErr (int runNo)=0
 
virtual double getAveEcms (int runNo)=0
 
virtual double getAveEcmsErr (int runNo)=0
 
virtual double getPx (int runNo)=0
 
virtual double getPy (int runNo)=0
 
virtual double getPz (int runNo)=0
 
virtual void readInfo (int runNo, char *tab, char *col)=0
 
virtual double getInfo (int runNo, char *tab, char *col)=0
 
virtual bool isReadDBValid (int runNo, char *tab, char *col)=0
 
virtual bool isReadDBValid (int runNo)=0
 
virtual void readInfo (int runNo)=0
 
virtual double getInfo (int runNo)=0
 
virtual ~IMeasuredEcmsSvc ()
 
virtual void readMeasuredEcms (int runNo)=0
 
virtual void readRunParams (int runNo)=0
 
virtual void readDB (int runNo)=0
 
virtual int getSampleName (int runNo)=0
 
virtual int getRunFrom (int runNo)=0
 
virtual int getRunTo (int runNo)=0
 
virtual bool isRunNoValid (int runNo)=0
 
virtual double getEcms (int runNo)=0
 
virtual double getEcmsErr (int runNo)=0
 
virtual double getAveEcms (int runNo)=0
 
virtual double getAveEcmsErr (int runNo)=0
 
virtual double getPx (int runNo)=0
 
virtual double getPy (int runNo)=0
 
virtual double getPz (int runNo)=0
 
virtual void readInfo (int runNo, char *tab, char *col)=0
 
virtual double getInfo (int runNo, char *tab, char *col)=0
 
virtual bool isReadDBValid (int runNo, char *tab, char *col)=0
 
virtual bool isReadDBValid (int runNo)=0
 
virtual void readInfo (int runNo)=0
 
virtual double getInfo (int runNo)=0
 

Friends

class CnvFactory< MeasuredEcmsSvc >
 

Additional Inherited Members

- Static Public Member Functions inherited from IMeasuredEcmsSvc
static const InterfaceID & interfaceID ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description

Constructor & Destructor Documentation

◆ MeasuredEcmsSvc() [1/2]

MeasuredEcmsSvc::MeasuredEcmsSvc ( const std::string &  name,
ISvcLocator *  svcLoc 
)

Definition at line 4 of file MeasuredEcmsSvc.cxx.

4 :Service(name, svcLoc){
5 declareProperty("RunParamsMin", RunParamsMin=11414);
6 declareProperty("RunParamsMax", RunParamsMax=23454);
7 declareProperty("MeasuredEcmsMin", MeasuredEcmsMin=23463);
8 declareProperty("MeasuredEcmsMax", MeasuredEcmsMax=38140);
9 declareProperty("TableName", table="RunParams");
10 declareProperty("ColumnName", column="beam_energy");
11}

◆ ~MeasuredEcmsSvc() [1/2]

MeasuredEcmsSvc::~MeasuredEcmsSvc ( )
virtual

Definition at line 13 of file MeasuredEcmsSvc.cxx.

13{}

◆ MeasuredEcmsSvc() [2/2]

MeasuredEcmsSvc::MeasuredEcmsSvc ( const std::string &  name,
ISvcLocator *  svcLoc 
)

◆ ~MeasuredEcmsSvc() [2/2]

virtual MeasuredEcmsSvc::~MeasuredEcmsSvc ( )
virtual

Member Function Documentation

◆ finalize() [1/2]

StatusCode MeasuredEcmsSvc::finalize ( )
virtual

Definition at line 41 of file MeasuredEcmsSvc.cxx.

41 {
42 MsgStream log(msgSvc(), name());
43 log<<MSG::INFO<<"MeasuredEcmsSvc finalize begin here"<<endreq;
44 StatusCode status= Service::finalize();
45 if(!status.isSuccess()){
46 log<<MSG::ERROR<<"MeasuredEcmsSvc Can not finalize"<<endreq;
47 return status;
48 }
49 log<<MSG::INFO<<"MeasuredEcmsSvc finalized successfully"<<endreq;
50 return StatusCode::SUCCESS;
51}

◆ finalize() [2/2]

virtual StatusCode MeasuredEcmsSvc::finalize ( )
virtual

◆ getAveEcms() [1/2]

double MeasuredEcmsSvc::getAveEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 274 of file MeasuredEcmsSvc.cxx.

274 {
275 MsgStream log(msgSvc(), name());
276 log<<MSG::INFO<<"MeasuredEcmsSvc read the average ecms"<<endreq;
277 if(m_recallRead&&m_callRead){
278 readDB(runNo);
279 m_recallRead=false;
280 }
281 return m_aveEcms;
282}
int runNo
Definition: DQA_TO_DB.cxx:12
void readDB(int runNo)

◆ getAveEcms() [2/2]

double MeasuredEcmsSvc::getAveEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getAveEcmsErr() [1/2]

double MeasuredEcmsSvc::getAveEcmsErr ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 284 of file MeasuredEcmsSvc.cxx.

284 {
285 MsgStream log(msgSvc(), name());
286 log<<MSG::INFO<<"MeasuredEcmsSvc read the error of the average ecms"<<endreq;
287 if(m_recallRead&&m_callRead){
288 readDB(runNo);
289 m_recallRead=false;
290 }
291 return m_aveEcmsErr;
292}

◆ getAveEcmsErr() [2/2]

double MeasuredEcmsSvc::getAveEcmsErr ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getEcms() [1/2]

double MeasuredEcmsSvc::getEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 223 of file MeasuredEcmsSvc.cxx.

223 {
224 MsgStream log(msgSvc(), name());
225 log<<MSG::INFO<<"MeasuredEcmsSvc read the ecms"<<endreq;
226 if(m_recallRead&&m_callRead){
227 readDB(runNo);
228 m_recallRead=false;
229 }
230 return m_ecms;
231}

◆ getEcms() [2/2]

double MeasuredEcmsSvc::getEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getEcmsErr() [1/2]

double MeasuredEcmsSvc::getEcmsErr ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 264 of file MeasuredEcmsSvc.cxx.

264 {
265 MsgStream log(msgSvc(), name());
266 log<<MSG::INFO<<"MeasuredEcmsSvc read the error of ecms"<<endreq;
267 if(m_recallRead&&m_callRead){
268 readDB(runNo);
269 m_recallRead=false;
270 }
271 return m_ecmsErr;
272}

◆ getEcmsErr() [2/2]

double MeasuredEcmsSvc::getEcmsErr ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getInfo() [1/4]

double MeasuredEcmsSvc::getInfo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 180 of file MeasuredEcmsSvc.cxx.

180 {
181 char tab[100];
182 char col[100];
183 strcpy(tab, table.c_str());
184 strcpy(col, column.c_str());
185 MsgStream log(msgSvc(), name());
186 log<<MSG::INFO<<"MeasuredEcmsSvc read the "<<tab<<"-"<<col<<endreq;
187 if(m_recallRead&&m_callRead){
189 }
190 return m_info;
191}
void readInfo(int runNo, char *tab, char *col)

◆ getInfo() [2/4]

double MeasuredEcmsSvc::getInfo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getInfo() [3/4]

double MeasuredEcmsSvc::getInfo ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 171 of file MeasuredEcmsSvc.cxx.

171 {
172 MsgStream log(msgSvc(), name());
173 log<<MSG::INFO<<"MeasuredEcmsSvc read the "<<tab<<"-"<<col<<endreq;
174 if(m_recallRead&&m_callRead){
175 readInfo(runNo, tab, col);
176 }
177 return m_info;
178}

◆ getInfo() [4/4]

double MeasuredEcmsSvc::getInfo ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

◆ getPx() [1/2]

double MeasuredEcmsSvc::getPx ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 233 of file MeasuredEcmsSvc.cxx.

233 {
234 MsgStream log(msgSvc(), name());
235 log<<MSG::INFO<<"MeasuredEcmsSvc read the ecms"<<endreq;
236 if(m_recallRead&&m_callRead){
237 readDB(runNo);
238 m_recallRead=false;
239 }
240 return m_px;
241}

◆ getPx() [2/2]

double MeasuredEcmsSvc::getPx ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getPy() [1/2]

double MeasuredEcmsSvc::getPy ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 244 of file MeasuredEcmsSvc.cxx.

244 {
245 MsgStream log(msgSvc(), name());
246 log<<MSG::INFO<<"MeasuredEcmsSvc read the ecms"<<endreq;
247 if(m_recallRead&&m_callRead){
248 readDB(runNo);
249 m_recallRead=false;
250 }
251 return m_py;
252}

◆ getPy() [2/2]

double MeasuredEcmsSvc::getPy ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getPz() [1/2]

double MeasuredEcmsSvc::getPz ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 254 of file MeasuredEcmsSvc.cxx.

254 {
255 MsgStream log(msgSvc(), name());
256 log<<MSG::INFO<<"MeasuredEcmsSvc read the ecms"<<endreq;
257 if(m_recallRead&&m_callRead){
258 readDB(runNo);
259 m_recallRead=false;
260 }
261 return m_pz;
262}

◆ getPz() [2/2]

double MeasuredEcmsSvc::getPz ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getRunFrom() [1/2]

int MeasuredEcmsSvc::getRunFrom ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 203 of file MeasuredEcmsSvc.cxx.

203 {
204 MsgStream log(msgSvc(), name());
205 log<<MSG::INFO<<"MeasuredEcmsSvc read the RunFrom"<<endreq;
206 if(m_recallRead&&m_callRead){
207 readDB(runNo);
208 m_recallRead=false;
209 }
210 return m_runFrom;
211}

◆ getRunFrom() [2/2]

int MeasuredEcmsSvc::getRunFrom ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getRunTo() [1/2]

int MeasuredEcmsSvc::getRunTo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 213 of file MeasuredEcmsSvc.cxx.

213 {
214 MsgStream log(msgSvc(), name());
215 log<<MSG::INFO<<"MeasuredEcmsSvc read the RunTo"<<endreq;
216 if(m_recallRead&&m_callRead){
217 readDB(runNo);
218 m_recallRead=false;
219 }
220 return m_runTo;
221}

◆ getRunTo() [2/2]

int MeasuredEcmsSvc::getRunTo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ getSampleName() [1/2]

int MeasuredEcmsSvc::getSampleName ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 193 of file MeasuredEcmsSvc.cxx.

193 {
194 MsgStream log(msgSvc(), name());
195 log<<MSG::INFO<<"MeasuredEcmsSvc read the sample name"<<endreq;
196 if(m_recallRead&&m_callRead){
197 readDB(runNo);
198 m_recallRead=false;
199 }
200 return m_sampleName;
201}

◆ getSampleName() [2/2]

int MeasuredEcmsSvc::getSampleName ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ handle() [1/2]

void MeasuredEcmsSvc::handle ( const Incident &  inc)

Definition at line 60 of file MeasuredEcmsSvc.cxx.

60 {
61 MsgStream log(messageService(), name());
62 log<<MSG::DEBUG<<"handle: "<<inc.type()<<endreq;
63 m_callRead=false; m_recallRead=true;
64 if(inc.type()=="NewRun"){
65 log<<MSG::INFO<<"RunNo is new, call the readMeasuredEcms again"<<endreq;
66 m_callRead=true;
67 m_sampleName=0; m_ecms=0; m_ecmsErr=0;
68 m_aveEcms=0; m_aveEcmsErr=0; m_runFrom=0;
69 m_runTo=0; m_runNoValid=false;
70 m_px=0; m_py=0; m_pz=0;
71 m_info=0;
72 }
73}

◆ handle() [2/2]

void MeasuredEcmsSvc::handle ( const Incident &  )

◆ initialize() [1/2]

StatusCode MeasuredEcmsSvc::initialize ( )
virtual

Definition at line 15 of file MeasuredEcmsSvc.cxx.

15 {
16 MsgStream log(msgSvc(), name());
17 log<<MSG::INFO<<"MeasuredEcmsSvc initialize begin here"<<endreq;
18 StatusCode status=Service::initialize();
19 if(!status.isSuccess()){
20 log<<MSG::ERROR<<"MeasuredEcmsSvc Can not initialize"<<endreq;
21 return status;
22 }
23 IIncidentSvc* incsvc;
24 status=service("IncidentSvc", incsvc);
25 int priority = 100;
26 if(status.isSuccess()) incsvc->addListener(this, "NewRun", priority);
27 status=serviceLocator()->service("DatabaseSvc", m_dbSvc, true);
28 if(!status.isSuccess()){
29 log<<MSG::ERROR<<"MeasuredEcmsSvc Unable to find DatabaseSvc"<<endreq;
30 return status;
31 }
32 status=serviceLocator()->service("EventDataSvc", m_eventSvc, true);
33 if(!status.isSuccess()){
34 log<<MSG::ERROR<<"MeasuredEcmsSvc Unable to find EventDataSvc "<<endreq;
35 return status;
36 }
37 log<<MSG::INFO<<"MeasuredEcmsSvc initialized successfully"<<endreq;
38 return StatusCode::SUCCESS;
39}

◆ initialize() [2/2]

virtual StatusCode MeasuredEcmsSvc::initialize ( )
virtual

◆ isReadDBValid() [1/4]

bool MeasuredEcmsSvc::isReadDBValid ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 304 of file MeasuredEcmsSvc.cxx.

304 {
305 char tab[100];
306 char col[100];
307 strcpy(tab, table.c_str());
308 strcpy(col, column.c_str());
309 MsgStream log(msgSvc(), name());
310 log<<MSG::INFO<<"MeasuredEcmsSvc judge the valid of "<<tab<<"-"<<col<<endreq;
311 if(m_callRead){
313 m_recallRead=false;
314 }
315 return m_runNoValid;
316}

◆ isReadDBValid() [2/4]

bool MeasuredEcmsSvc::isReadDBValid ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ isReadDBValid() [3/4]

bool MeasuredEcmsSvc::isReadDBValid ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 294 of file MeasuredEcmsSvc.cxx.

294 {
295 MsgStream log(msgSvc(), name());
296 log<<MSG::INFO<<"MeasuredEcmsSvc judge the valid of "<<tab<<"-"<<col<<endreq;
297 if(m_callRead){
298 readInfo(runNo, tab, col);
299 m_recallRead=false;
300 }
301 return m_runNoValid;
302}

◆ isReadDBValid() [4/4]

bool MeasuredEcmsSvc::isReadDBValid ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

◆ isRunNoValid() [1/2]

bool MeasuredEcmsSvc::isRunNoValid ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 318 of file MeasuredEcmsSvc.cxx.

318 {
319 MsgStream log(msgSvc(), name());
320 log<<MSG::INFO<<"MeasuredEcmsSvc judge the valid of runNo"<<endreq;
321 if(m_callRead){
322 readDB(runNo);
323 m_recallRead=false;
324 }
325 return m_runNoValid;
326}

◆ isRunNoValid() [2/2]

bool MeasuredEcmsSvc::isRunNoValid ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ queryInterface() [1/2]

StatusCode MeasuredEcmsSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvIF 
)
virtual

Definition at line 53 of file MeasuredEcmsSvc.cxx.

53 {
54 if(IMeasuredEcmsSvc::interfaceID().versionMatch(riid)) *ppvIF = dynamic_cast<IMeasuredEcmsSvc*>(this);
55 else return Service::queryInterface(riid, ppvIF);
56 addRef();
57 return StatusCode::SUCCESS;
58}

◆ queryInterface() [2/2]

virtual StatusCode MeasuredEcmsSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvIF 
)
virtual

◆ readDB() [1/2]

void MeasuredEcmsSvc::readDB ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 166 of file MeasuredEcmsSvc.cxx.

166 {
167 if(std::abs(runNo)>=RunParamsMin&&std::abs(runNo)<=RunParamsMax) readRunParams(runNo);
168 if(std::abs(runNo)>=MeasuredEcmsMin&&std::abs(runNo)<=MeasuredEcmsMax) readMeasuredEcms(runNo);
169}
void readRunParams(int runNo)
void readMeasuredEcms(int runNo)

Referenced by getAveEcms(), getAveEcmsErr(), getEcms(), getEcmsErr(), getPx(), getPy(), getPz(), getRunFrom(), getRunTo(), getSampleName(), and isRunNoValid().

◆ readDB() [2/2]

void MeasuredEcmsSvc::readDB ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ readInfo() [1/4]

void MeasuredEcmsSvc::readInfo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 143 of file MeasuredEcmsSvc.cxx.

143 {
144 char tab[100];
145 char col[100];
146 strcpy(tab, table.c_str());
147 strcpy(col, column.c_str());
148 MsgStream log(msgSvc(), name());
149 log<<MSG::INFO<<"MeasuredEcmsSvc begin read database "<<tab<<"-"<<col<<endreq;
150 int runNum=std::abs(runNo);
151 if(runNo<0) log<<MSG::INFO<<"MeasuredEcmsSvc for MC events"<<endreq;
152 else log<<MSG::INFO<<"MeasuredEcmsSvc for DT events"<<endreq;
153 char stmt1[500];
154 snprintf(stmt1, 1024, "select %s from %s where run_number = %d", col, tab, runNum);
156 int row_no = m_dbSvc->query("offlinedb", stmt1, res);
157 if(row_no==0){log<<MSG::ERROR<<"RowNo can not be 0 for "<<tab<<", failed to read DB"<<endreq;}
158 else{
159 DatabaseRecord* records = res[0];
160 log<<MSG::INFO<<"MeasuredEcmsSvc first read the runNo, read the "<<tab<<" database "<<runNo<<endreq;
161 m_info=records->GetDouble(col);
162 m_runNoValid=true;
163 }
164}
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0

◆ readInfo() [2/4]

void MeasuredEcmsSvc::readInfo ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ readInfo() [3/4]

void MeasuredEcmsSvc::readInfo ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 124 of file MeasuredEcmsSvc.cxx.

124 {
125 MsgStream log(msgSvc(), name());
126 log<<MSG::INFO<<"MeasuredEcmsSvc begin read database "<<tab<<"-"<<col<<endreq;
127 int runNum=std::abs(runNo);
128 if(runNo<0) log<<MSG::INFO<<"MeasuredEcmsSvc for MC events"<<endreq;
129 else log<<MSG::INFO<<"MeasuredEcmsSvc for DT events"<<endreq;
130 char stmt1[400];
131 snprintf(stmt1, 1024, "select %s from %s where run_number = %d", col, tab, runNum);
133 int row_no = m_dbSvc->query("offlinedb", stmt1, res);
134 if(row_no==0){log<<MSG::ERROR<<"RowNo can not be 0 for "<<tab<<", failed to read DB"<<endreq;}
135 else{
136 DatabaseRecord* records = res[0];
137 log<<MSG::INFO<<"MeasuredEcmsSvc first read the runNo, read the "<<tab<<" database "<<runNo<<endreq;
138 m_info=records->GetDouble(col);
139 m_runNoValid=true;
140 }
141}

Referenced by getInfo(), and isReadDBValid().

◆ readInfo() [4/4]

void MeasuredEcmsSvc::readInfo ( int  runNo,
char *  tab,
char *  col 
)
virtual

Implements IMeasuredEcmsSvc.

◆ readMeasuredEcms() [1/2]

void MeasuredEcmsSvc::readMeasuredEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 75 of file MeasuredEcmsSvc.cxx.

75 {
76 MsgStream log(msgSvc(), name());
77 log<<MSG::INFO<<"MeasuredEcmsSvc begin read database MeasuredEcmsSvc"<<endreq;
78 int runNum=std::abs(runNo);
79 if(runNo<0) log<<MSG::INFO<<"MeasuredEcmsSvc for MC events"<<endreq;
80 else log<<MSG::INFO<<"MeasuredEcmsSvc for DT events"<<endreq;
81 char stmt[400];
82 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);
84 int rowNo=m_dbSvc->query("offlinedb", stmt, res);
85 if(rowNo==0){ log<<MSG::ERROR<<"RowNo can not be 0 for MeasuredEcmsSvc, failed to read DB"<<endreq; }
86 else{
87 DatabaseRecord* records=res[0];
88 log<<MSG::INFO<<"MeasuredEcmsSvc first read the runNo, read the MeasuredEcms database"<<runNo<<endreq;
89 m_runFrom=records->GetDouble("RunFrom");
90 m_runTo=records->GetDouble("RunTo");
91 m_sampleName=records->GetDouble("sample");
92 m_ecms=records->GetDouble("Ecms");
93 m_ecmsErr=records->GetDouble("Ecms_err");
94 m_aveEcms=records->GetDouble("Ave_Ecms");
95 m_aveEcmsErr=records->GetDouble("Ave_Ecms_err");
96 m_runNoValid=true;
97 }
98}

Referenced by readDB().

◆ readMeasuredEcms() [2/2]

void MeasuredEcmsSvc::readMeasuredEcms ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

◆ readRunParams() [1/2]

void MeasuredEcmsSvc::readRunParams ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Definition at line 100 of file MeasuredEcmsSvc.cxx.

100 {
101 MsgStream log(msgSvc(), name());
102 log<<MSG::INFO<<"MeasuredEcmsSvc begin read database RunParams"<<endreq;
103 int runNum=std::abs(runNo);
104 if(runNo<0) log<<MSG::INFO<<"MeasuredEcmsSvc for MC events"<<endreq;
105 else log<<MSG::INFO<<"MeasuredEcmsSvc for DT events"<<endreq;
106 char stmt1[400];
107 snprintf(stmt1, 1024, "select beam_energy, px, py, pz from RunParams where run_number = %d", runNum);
109 int row_no = m_dbSvc->query("offlinedb", stmt1, res);
110 if(row_no==0){log<<MSG::ERROR<<"RowNo can not be 0 for RunParams, failed to read DB"<<endreq;}
111 else{
112 DatabaseRecord* records = res[0];
113 log<<MSG::INFO<<"MeasuredEcmsSvc first read the runNo, read the RunParams database"<<runNo<<endreq;
114 double bE=0;
115 bE=records->GetDouble("beam_energy");
116 m_px=records->GetDouble("px");
117 m_py=records->GetDouble("py");
118 m_pz=records->GetDouble("pz");
119 m_ecms=bE*2.00;
120 m_runNoValid=true;
121 }
122}

Referenced by readDB().

◆ readRunParams() [2/2]

void MeasuredEcmsSvc::readRunParams ( int  runNo)
virtual

Implements IMeasuredEcmsSvc.

Friends And Related Function Documentation

◆ CnvFactory< MeasuredEcmsSvc >


The documentation for this class was generated from the following files: