446 coral::ISchema& CTPPS = session.
coralSession().schema(
"CMS_PPS_SPECT_COND");
448 std::unique_ptr<coral::IQuery> CTPPSDataQuery(CTPPS.newQuery());
450 CTPPSDataQuery->addToTableList(
std::string(
"PPS_LHC_MACHINE_PARAMS"));
452 CTPPSDataQuery->addToOutputList(
std::string(
"DIP_UPDATE_TIME"));
453 CTPPSDataQuery->addToOutputList(
std::string(
"LUMI_SECTION"));
454 CTPPSDataQuery->addToOutputList(
std::string(
"RUN_NUMBER"));
455 CTPPSDataQuery->addToOutputList(
std::string(
"FILL_NUMBER"));
456 CTPPSDataQuery->addToOutputList(
std::string(
"XING_ANGLE_P5_X_URAD"));
457 CTPPSDataQuery->addToOutputList(
std::string(
"XING_ANGLE_P5_Y_URAD"));
458 CTPPSDataQuery->addToOutputList(
std::string(
"BETA_STAR_P5_X_M"));
459 CTPPSDataQuery->addToOutputList(
std::string(
"BETA_STAR_P5_Y_M"));
461 coral::AttributeList CTPPSDataBindVariables;
462 CTPPSDataBindVariables.extend<coral::TimeStamp>(
std::string(
"beginFillTime"));
463 CTPPSDataBindVariables.extend<coral::TimeStamp>(
std::string(
"endFillTime"));
464 CTPPSDataBindVariables[
std::string(
"beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
465 CTPPSDataBindVariables[
std::string(
"endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
466 std::string conditionStr =
std::string(
"DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime");
467 CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables);
469 CTPPSDataQuery->addToOrderList(
std::string(
"DIP_UPDATE_TIME"));
471 coral::AttributeList CTPPSDataOutput;
472 CTPPSDataOutput.extend<coral::TimeStamp>(
std::string(
"DIP_UPDATE_TIME"));
473 CTPPSDataOutput.extend<
int>(
std::string(
"LUMI_SECTION"));
474 CTPPSDataOutput.extend<
int>(
std::string(
"RUN_NUMBER"));
475 CTPPSDataOutput.extend<
int>(
std::string(
"FILL_NUMBER"));
476 CTPPSDataOutput.extend<
float>(
std::string(
"XING_ANGLE_P5_X_URAD"));
477 CTPPSDataOutput.extend<
float>(
std::string(
"XING_ANGLE_P5_Y_URAD"));
478 CTPPSDataOutput.extend<
float>(
std::string(
"BETA_STAR_P5_X_M"));
479 CTPPSDataOutput.extend<
float>(
std::string(
"BETA_STAR_P5_Y_M"));
480 CTPPSDataQuery->defineOutput(CTPPSDataOutput);
482 coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute();
483 unsigned int lumiSection = 0;
486 float crossingAngleX = 0., betaStarX = 0.;
487 float crossingAngleY = 0., betaStarY = 0.;
490 int wrongFillNumbers = 0;
491 std::stringstream wrongFills;
492 std::vector<pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::iterator current =
m_tmpBuffer.begin();
493 while (CTPPSDataCursor.next()) {
495 std::ostringstream CTPPS;
496 CTPPSDataCursor.currentRow().toOutputStream(CTPPS);
498 coral::Attribute
const& dipTimeAttribute = CTPPSDataCursor.currentRow()[
std::string(
"DIP_UPDATE_TIME")];
499 if (!dipTimeAttribute.isNull()) {
501 coral::Attribute
const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[
std::string(
"LUMI_SECTION")];
502 if (!lumiSectionAttribute.isNull()) {
503 lumiSection = lumiSectionAttribute.data<
int>();
505 coral::Attribute
const& runNumberAttribute = CTPPSDataCursor.currentRow()[
std::string(
"RUN_NUMBER")];
506 if (!runNumberAttribute.isNull()) {
507 runNumber = runNumberAttribute.data<
int>();
509 coral::Attribute
const& fillNumberAttribute = CTPPSDataCursor.currentRow()[
std::string(
"FILL_NUMBER")];
510 if (!fillNumberAttribute.isNull()) {
511 fillNumber = fillNumberAttribute.data<
int>();
513 coral::Attribute
const& crossingAngleXAttribute =
514 CTPPSDataCursor.currentRow()[
std::string(
"XING_ANGLE_P5_X_URAD")];
515 if (!crossingAngleXAttribute.isNull()) {
516 crossingAngleX = crossingAngleXAttribute.data<
float>();
518 coral::Attribute
const& crossingAngleYAttribute =
519 CTPPSDataCursor.currentRow()[
std::string(
"XING_ANGLE_P5_Y_URAD")];
520 if (!crossingAngleYAttribute.isNull()) {
521 crossingAngleY = crossingAngleYAttribute.data<
float>();
523 coral::Attribute
const& betaStarXAttribute = CTPPSDataCursor.currentRow()[
std::string(
"BETA_STAR_P5_X_M")];
524 if (!betaStarXAttribute.isNull()) {
525 betaStarX = betaStarXAttribute.data<
float>();
527 coral::Attribute
const& betaStarYAttribute = CTPPSDataCursor.currentRow()[
std::string(
"BETA_STAR_P5_Y_M")];
528 if (!betaStarYAttribute.isNull()) {
529 betaStarY = betaStarYAttribute.data<
float>();
531 if (current !=
m_tmpBuffer.end() && current->second->fillNumber() != fillNumber) {
532 wrongFills <<
"( " <<
runNumber <<
"_" << lumiSection <<
" fill: OMS: " << current->second->fillNumber()
533 <<
" PPSdb: " << fillNumber <<
" ) ";
537 current !=
m_tmpBuffer.end() && make_pair(current->second->runNumber(), current->second->lumiSection()) <=
541 payload.setCrossingAngleX(crossingAngleX);
542 payload.setCrossingAngleY(crossingAngleY);
543 payload.setBetaStarX(betaStarX);
544 payload.setBetaStarY(betaStarY);
545 payload.setLumiSection(lumiSection);
553 if (wrongFillNumbers) {
554 edm::LogWarning(
"getCTPPSData") <<
"Number of records from PPS DB with fillNumber different from OMS: " 556 edm::LogWarning(
"getCTPPSData") <<
"Records from PPS DB with fillNumber different from OMS: " << wrongFills.str();
ret
prodAgent to be discontinued
unsigned long long Time_t
std::map< pair< cond::Time_t, unsigned int >, pair< cond::Time_t, unsigned int > > m_lsIdMap
coral::ISessionProxy & coralSession()
Log< level::Warning, false > LogWarning
std::vector< pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > > m_tmpBuffer