262 {
263 MsgStream log( messageService(), name() );
264 log << MSG::DEBUG << "In getCaliConst" << endreq;
265
267
268 StatusCode sc;
269
270
271 if(m_ifReadBunch == true) {
272 std::vector<std::string> sbunch;
273 std::vector<double> bunchInfo;
274 ConnectionProvider::eRet e = m_connect->
getReadBunchInfo(sbunch,
runNo,m_SftVer,m_ParVer,m_bossRelease);
275 if(e == 7 ) {
276 bool last = true;
277 for(int id = 1; true; id++) {
279 last = true;
280 if(e == 7) {
283 last = false;
284 }
285 }
286 if(e == 0) {
287 if(last ==
true) log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo+
id <<
" instead of run " <<
runNo << endreq;
288 if(last ==
false) log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo-
id <<
" instead of run " <<
runNo << endreq;
289 break;
290 }
291 }
292 }
293 if(e != 0 && e != 7) {
294 log << MSG::ERROR << "Could not find Bunch infor., exit." << endreq;
295 exit(1);
296 }
297 for(unsigned int i = 0; i < sbunch.size(); i++)
298 {
299 bunchInfo.push_back(atof(sbunch[i].
c_str()));
300 }
301 sbunch.clear();
302
303 if(bunchInfo.size() == 6)
304 {
305
306 m_bunch_x = 10*bunchInfo[0];
307 m_bunch_y = 10*bunchInfo[1];
308 m_bunch_z = 10*bunchInfo[2];
309 m_sigma_x = 10*bunchInfo[3];
310 m_sigma_y = 10*bunchInfo[4];
311 m_sigma_z = 10*bunchInfo[5];
312 log << MSG::INFO <<
"BunchPosX: " << m_bunch_x <<
" BunchPosY: " << m_bunch_y <<
" BunchPosZ: " << m_bunch_z <<
" in Run " <<
runNo << endreq;
313 log << MSG::INFO <<
"BunchSigmaX: " << m_sigma_x <<
" BunchSigmaY: " << m_sigma_y <<
" BunchSigmaZ: " << m_sigma_z <<
" in Run " <<
runNo << endreq;
314 }
315 else {
316 log << MSG::ERROR << "Please check the bunch information, the size is " << bunchInfo.size() << endreq;
317 }
318 bunchInfo.clear();
319 }
320
321
322 if(m_ifReadTrg == true) {
323 m_trgTable.clear();
324 std::vector<std::string> strgTable;
326 if(e != 0 ) {
327 log << MSG::ERROR << "Could not find TrgTable infor., exit." << endreq;
328 exit(1);
329 }
330 for(unsigned int i = 0; i < strgTable.size(); i++)
331 {
332 long long value = 0;
333 for (unsigned int j = 0; j < (strgTable[i]).length(); j++)
334 {
335 value = value*10 + (strgTable[i][j] - '0');
336 }
337 m_trgTable.push_back(uint32_t(value));
338 }
339 strgTable.clear();
340 if(m_trgTable.size() != 65) log << MSG::ERROR << "Please check the TrgTable information, the size is " << m_trgTable.size() << endreq;
341
342 std::vector<double> vtrgGain;
344 if(e != 0 ) {
345 log << MSG::ERROR << "Could not find emc gain infor., exit." << endreq;
346 exit(1);
347 }
348 for(unsigned int i = 0; i < vtrgGain.size(); i++) {
349 m_trgGain[i] = vtrgGain[i];
350 }
351
352
354 if(e != 0 ) {
355 log << MSG::ERROR << "Could not find Trigger config infor., exit." << endreq;
356 exit(1);
357 }
369 }
370
371
372 if(m_ifReadRandTrg == true) {
373 std::vector<std::string> fileInfor;
375 if(e == 7 ) {
376 bool last = true;
377 for(int id = 1; true; id++) {
379 last = true;
380 if(e == 7) {
383 last = false;
384 }
385 }
386 if(e == 0) {
387 if(last ==
true) log << MSG::INFO <<
"Use Bg files of run " <<
runNo+
id <<
" instead of run " <<
runNo << endreq;
388 if(last ==
false) log << MSG::INFO <<
"Use Bg files of run " <<
runNo-
id <<
" instead of run " <<
runNo << endreq;
389 break;
390 }
391 }
392 }
393 if(e != 0 && e != 7) {
394 log << MSG::ERROR << "Could not find background infor., exit." << endreq;
395 exit(1);
396 }
397 m_bgfilename.clear();
398 for(unsigned int i = 0; i < fileInfor.size(); i+=2)
399 {
400 m_bgfilename.push_back(fileInfor[i]+"/"+fileInfor[i+1]);
401 }
402 fileInfor.clear();
403 for(unsigned int i = 0; i < m_bgfilename.size(); i++) {
404 log << MSG::INFO <<
"Background file name: " << m_bgfilename[i] <<
" in run " <<
runNo << endreq;
405 }
406
407
408 std::string srunTime;
409 std::string stau_value;
410 e = m_connect->
getLumCurvePar(srunTime, stau_value,
runNo, m_SftVer, m_ParVer, m_bossRelease);
411 if(e != 0 ) {
412 log << MSG::ERROR << "Could not find Luminosity curve parameters, exit." << endreq;
413 exit(1);
414 }
415 m_runTotalTime = std::atof(srunTime.c_str());
416 m_tauValue = std::atof(stau_value.c_str());
417 log << MSG::INFO <<
"Total time is " << m_runTotalTime <<
", tau is " << m_tauValue <<
" in run " <<
runNo <<
". " << endreq;
418 }
419
420
421 if(m_ifReadTFEE == true) {
422 m_tfee.clear();
424 if(e != 0 ) {
425 log << MSG::ERROR << "Could not find TFEE infor., exit." << endreq;
426 exit(1);
427 }
428
429 for(unsigned int i = 0; i < m_tfee.size(); i++) {
430 log << MSG::INFO << "TFEE ----> " << m_tfee[i] << endreq;
431 }
432 }
433
434
435 if(m_ifReadRunInfo == true) {
436 m_runInfo.clear();
437 std::vector<std::string> srunInfo;
439 if(e != 0 ) {
440 log << MSG::ERROR << "Could not find run infor., exit." << endreq;
441 exit(1);
442 }
443 for(unsigned int i = 0; i < srunInfo.size(); i++)
444 {
445 m_runInfo.push_back(atof(srunInfo[i].
c_str()));
446 }
447 srunInfo.clear();
448
449 for(unsigned int i = 0; i < m_runInfo.size(); i++) {
450 log << MSG::INFO << "runInfo ----> " << m_runInfo[i] << endreq;
451 }
452 }
453
454}
ConnectionProvider::eRet getRunInfo(std::vector< std::string > &runInfo, int runNo)
ConnectionProvider::eRet getReadBunchInfo(std::vector< std::string > &bunch, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease)
ConnectionProvider::eRet getLumCurvePar(std::string &runTotalTime, std::string &tau_value, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease)
ConnectionProvider::eRet getTrgConfigInfo(int runNo)
ConnectionProvider::eRet getEmcGain(std::vector< double > &emcGain, int runNo)
ConnectionProvider::eRet getReadTrgTableInfo(std::vector< std::string > &trgTable, int runNo)
ConnectionProvider::eRet getReadTofThreshInfo(std::vector< std::string > &tofThresh, int runNo)