509 coral::ISchema& CTPPS = session.
coralSession().schema(
"CMS_PPS_SPECT_COND");
511 std::unique_ptr<coral::IQuery> CTPPSDataQuery(CTPPS.newQuery());
513 CTPPSDataQuery->addToTableList(
std::string(
"PPS_LHC_MACHINE_PARAMS"));
515 CTPPSDataQuery->addToOutputList(
std::string(
"DIP_UPDATE_TIME"));
516 CTPPSDataQuery->addToOutputList(
std::string(
"LUMI_SECTION"));
517 CTPPSDataQuery->addToOutputList(
std::string(
"RUN_NUMBER"));
518 CTPPSDataQuery->addToOutputList(
std::string(
"FILL_NUMBER"));
519 CTPPSDataQuery->addToOutputList(
std::string(
"XING_ANGLE_P5_X_URAD"));
520 CTPPSDataQuery->addToOutputList(
std::string(
"XING_ANGLE_P5_Y_URAD"));
521 CTPPSDataQuery->addToOutputList(
std::string(
"BETA_STAR_P5_X_M"));
522 CTPPSDataQuery->addToOutputList(
std::string(
"BETA_STAR_P5_Y_M"));
524 coral::AttributeList CTPPSDataBindVariables;
525 CTPPSDataBindVariables.extend<coral::TimeStamp>(
std::string(
"beginFillTime"));
526 CTPPSDataBindVariables.extend<coral::TimeStamp>(
std::string(
"endFillTime"));
527 CTPPSDataBindVariables[
std::string(
"beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
528 CTPPSDataBindVariables[
std::string(
"endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
529 std::string conditionStr =
std::string(
"DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime");
530 CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables);
532 CTPPSDataQuery->addToOrderList(
std::string(
"DIP_UPDATE_TIME"));
534 coral::AttributeList CTPPSDataOutput;
535 CTPPSDataOutput.extend<coral::TimeStamp>(
std::string(
"DIP_UPDATE_TIME"));
536 CTPPSDataOutput.extend<
int>(
std::string(
"LUMI_SECTION"));
537 CTPPSDataOutput.extend<
int>(
std::string(
"RUN_NUMBER"));
538 CTPPSDataOutput.extend<
int>(
std::string(
"FILL_NUMBER"));
539 CTPPSDataOutput.extend<
float>(
std::string(
"XING_ANGLE_P5_X_URAD"));
540 CTPPSDataOutput.extend<
float>(
std::string(
"XING_ANGLE_P5_Y_URAD"));
541 CTPPSDataOutput.extend<
float>(
std::string(
"BETA_STAR_P5_X_M"));
542 CTPPSDataOutput.extend<
float>(
std::string(
"BETA_STAR_P5_Y_M"));
543 CTPPSDataQuery->defineOutput(CTPPSDataOutput);
545 coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute();
546 unsigned int lumiSection = 0;
549 float crossingAngleX = 0., betaStarX = 0.;
550 float crossingAngleY = 0., betaStarY = 0.;
553 int wrongFillNumbers = 0;
554 std::stringstream wrongFills;
555 std::vector<pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::iterator current =
m_tmpBuffer.begin();
556 while (CTPPSDataCursor.next()) {
558 std::ostringstream CTPPS;
559 CTPPSDataCursor.currentRow().toOutputStream(CTPPS);
561 coral::Attribute
const& dipTimeAttribute = CTPPSDataCursor.currentRow()[
std::string(
"DIP_UPDATE_TIME")];
562 if (!dipTimeAttribute.isNull()) {
564 coral::Attribute
const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[
std::string(
"LUMI_SECTION")];
565 if (!lumiSectionAttribute.isNull()) {
566 lumiSection = lumiSectionAttribute.data<
int>();
568 coral::Attribute
const& runNumberAttribute = CTPPSDataCursor.currentRow()[
std::string(
"RUN_NUMBER")];
569 if (!runNumberAttribute.isNull()) {
570 runNumber = runNumberAttribute.data<
int>();
572 coral::Attribute
const& fillNumberAttribute = CTPPSDataCursor.currentRow()[
std::string(
"FILL_NUMBER")];
573 if (!fillNumberAttribute.isNull()) {
574 fillNumber = fillNumberAttribute.data<
int>();
576 coral::Attribute
const& crossingAngleXAttribute =
577 CTPPSDataCursor.currentRow()[
std::string(
"XING_ANGLE_P5_X_URAD")];
578 if (!crossingAngleXAttribute.isNull()) {
579 crossingAngleX = crossingAngleXAttribute.data<
float>();
581 coral::Attribute
const& crossingAngleYAttribute =
582 CTPPSDataCursor.currentRow()[
std::string(
"XING_ANGLE_P5_Y_URAD")];
583 if (!crossingAngleYAttribute.isNull()) {
584 crossingAngleY = crossingAngleYAttribute.data<
float>();
586 coral::Attribute
const& betaStarXAttribute = CTPPSDataCursor.currentRow()[
std::string(
"BETA_STAR_P5_X_M")];
587 if (!betaStarXAttribute.isNull()) {
588 betaStarX = betaStarXAttribute.data<
float>();
590 coral::Attribute
const& betaStarYAttribute = CTPPSDataCursor.currentRow()[
std::string(
"BETA_STAR_P5_Y_M")];
591 if (!betaStarYAttribute.isNull()) {
592 betaStarY = betaStarYAttribute.data<
float>();
594 if (current !=
m_tmpBuffer.end() && current->second->fillNumber() != fillNumber) {
595 wrongFills <<
"( " <<
runNumber <<
"_" << lumiSection <<
" fill: OMS: " << current->second->fillNumber()
596 <<
" PPSdb: " << fillNumber <<
" ) ";
600 current !=
m_tmpBuffer.end() && make_pair(current->second->runNumber(), current->second->lumiSection()) <=
604 payload.setCrossingAngleX(crossingAngleX);
605 payload.setCrossingAngleY(crossingAngleY);
606 payload.setBetaStarX(betaStarX);
607 payload.setBetaStarY(betaStarY);
608 payload.setLumiSection(lumiSection);
616 if (wrongFillNumbers) {
617 edm::LogWarning(
"getCTPPSData") <<
"Number of records from PPS DB with fillNumber different from OMS: " 619 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