CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
LHCInfoPopConSourceHandler Class Reference

#include <LHCInfoPopConSourceHandler.h>

Inheritance diagram for LHCInfoPopConSourceHandler:
popcon::PopConSourceHandler< LHCInfo >

Public Member Functions

void getNewObjects () override
 
std::string id () const override
 
 LHCInfoPopConSourceHandler (const edm::ParameterSet &pset)
 
 ~LHCInfoPopConSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< LHCInfo >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Member Functions

void addEmptyPayload (cond::Time_t iov)
 
bool getCTTPSData (cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
 
bool getDipData (cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
 
bool getEcalData (cond::persistency::Session &session, const boost::posix_time::ptime &lowerTime, const boost::posix_time::ptime &upperTime, bool update)
 
bool getFillData (cond::persistency::Session &session, unsigned short fillId)
 
size_t getLumiData (cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
 
bool getNextFillData (cond::persistency::Session &session, const boost::posix_time::ptime &targetTime, bool ended)
 

Private Attributes

std::string m_authpath
 
std::string m_connectionString
 
bool m_debug
 
std::string m_dipSchema
 
std::string m_ecalConnectionString
 
bool m_endFill = true
 
boost::posix_time::ptime m_endTime
 
std::unique_ptr< LHCInfom_fillPayload
 
bool m_lastPayloadEmpty = false
 
std::string m_name
 
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
 
std::shared_ptr< LHCInfom_prevPayload
 
unsigned int m_samplingInterval
 
boost::posix_time::ptime m_startTime
 
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< LHCInfo >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< LHCInfo *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< LHCInfoself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef LHCInfo value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< LHCInfo >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< LHCInfo >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 10 of file LHCInfoPopConSourceHandler.h.

Constructor & Destructor Documentation

LHCInfoPopConSourceHandler::LHCInfoPopConSourceHandler ( const edm::ParameterSet pset)

Definition at line 21 of file LHCInfoPopConSourceHandler.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getUntrackedParameter(), m_endTime, m_startTime, fileCollector::now, and AlCaHLTBitMon_QueryRunRegistry::string.

22  : m_debug(pset.getUntrackedParameter<bool>("debug", false)),
23  m_startTime(),
24  m_endTime(),
25  m_samplingInterval((unsigned int)pset.getUntrackedParameter<unsigned int>("samplingInterval", 300)),
26  m_endFill(pset.getUntrackedParameter<bool>("endFill", true)),
27  m_name(pset.getUntrackedParameter<std::string>("name", "LHCInfoPopConSourceHandler")),
28  m_connectionString(pset.getUntrackedParameter<std::string>("connectionString", "")),
29  m_ecalConnectionString(pset.getUntrackedParameter<std::string>("ecalConnectionString", "")),
30  m_dipSchema(pset.getUntrackedParameter<std::string>("DIPSchema", "")),
31  m_authpath(pset.getUntrackedParameter<std::string>("authenticationPath", "")),
32  m_fillPayload(),
33  m_prevPayload(),
34  m_tmpBuffer(),
35  m_payloadBuffer() {
36  if (pset.exists("startTime")) {
37  m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter<std::string>("startTime"));
38  }
39  boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
40  m_endTime = now;
41  if (pset.exists("endTime")) {
42  m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter<std::string>("endTime"));
43  if (m_endTime > now)
44  m_endTime = now;
45  }
46 }
T getUntrackedParameter(std::string const &, T const &) const
boost::posix_time::ptime m_startTime
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
std::unique_ptr< LHCInfo > m_fillPayload
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::shared_ptr< LHCInfo > m_prevPayload
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
boost::posix_time::ptime m_endTime
LHCInfoPopConSourceHandler::~LHCInfoPopConSourceHandler ( )
override

Definition at line 49 of file LHCInfoPopConSourceHandler.cc.

49 {}

Member Function Documentation

void LHCInfoPopConSourceHandler::addEmptyPayload ( cond::Time_t  iov)
private

Definition at line 774 of file LHCInfoPopConSourceHandler.cc.

References popcon::PopConSourceHandler< LHCInfo >::add(), LHCInfo::fillNumber(), m_lastPayloadEmpty, m_payloadBuffer, m_prevPayload, and popcon::PopConSourceHandler< LHCInfo >::m_to_transfer.

Referenced by getNewObjects().

774  {
775  bool add = false;
776  if (m_to_transfer.empty()) {
777  if (!m_lastPayloadEmpty)
778  add = true;
779  } else {
780  LHCInfo* lastAdded = m_to_transfer.back().first;
781  if (lastAdded->fillNumber() != 0) {
782  add = true;
783  }
784  }
785  if (add) {
786  auto newPayload = std::make_shared<LHCInfo>();
787  m_to_transfer.push_back(std::make_pair(newPayload.get(), iov));
788  m_payloadBuffer.push_back(newPayload);
789  m_prevPayload = newPayload;
790  }
791 }
std::shared_ptr< LHCInfo > m_prevPayload
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
unsigned short const fillNumber() const
Definition: LHCInfo.cc:158
int add(value_type *payload, Summary *summary, Time_t time)
bool LHCInfoPopConSourceHandler::getCTTPSData ( cond::persistency::Session session,
const boost::posix_time::ptime &  beginFillTime,
const boost::posix_time::ptime &  endFillTime 
)
private

Definition at line 533 of file LHCInfoPopConSourceHandler.cc.

References cond::persistency::Session::coralSession(), LHCInfoImpl::LumiSectionFilter::current(), ALCARECOTkAlBeamHalo_cff::filter, cond::time::from_boost(), m_debug, m_tmpBuffer, jets_cff::payload, LHCInfoImpl::LumiSectionFilter::process(), runTheMatrix::ret, LHCInfo::setBetaStar(), LHCInfo::setCrossingAngle(), LHCInfo::setCtppsStatus(), LHCInfo::setLhcComment(), LHCInfo::setLhcState(), LHCInfo::setLumiSection(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

535  {
536  //run the fifth query against the CTPPS schema
537  //Initializing the CMS_CTP_CTPPS_COND schema.
538  coral::ISchema& CTPPS = session.coralSession().schema("CMS_CTP_CTPPS_COND");
539  //execute query for CTPPS Data
540  std::unique_ptr<coral::IQuery> CTPPSDataQuery(CTPPS.newQuery());
541  //FROM clause
542  CTPPSDataQuery->addToTableList(std::string("CTPPS_LHC_MACHINE_PARAMS"));
543  //SELECT clause
544  CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME"));
545  CTPPSDataQuery->addToOutputList(std::string("LHC_STATE"));
546  CTPPSDataQuery->addToOutputList(std::string("LHC_COMMENT"));
547  CTPPSDataQuery->addToOutputList(std::string("CTPPS_STATUS"));
548  CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION"));
549  CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_URAD"));
550  CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_CMS"));
551  //WHERE CLAUSE
552  coral::AttributeList CTPPSDataBindVariables;
553  CTPPSDataBindVariables.extend<coral::TimeStamp>(std::string("beginFillTime"));
554  CTPPSDataBindVariables.extend<coral::TimeStamp>(std::string("endFillTime"));
555  CTPPSDataBindVariables[std::string("beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
556  CTPPSDataBindVariables[std::string("endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
557  std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime");
558  CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables);
559  //ORDER BY clause
560  CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME"));
561  //define query output
562  coral::AttributeList CTPPSDataOutput;
563  CTPPSDataOutput.extend<coral::TimeStamp>(std::string("DIP_UPDATE_TIME"));
564  CTPPSDataOutput.extend<std::string>(std::string("LHC_STATE"));
565  CTPPSDataOutput.extend<std::string>(std::string("LHC_COMMENT"));
566  CTPPSDataOutput.extend<std::string>(std::string("CTPPS_STATUS"));
567  CTPPSDataOutput.extend<int>(std::string("LUMI_SECTION"));
568  CTPPSDataOutput.extend<float>(std::string("XING_ANGLE_URAD"));
569  CTPPSDataOutput.extend<float>(std::string("BETA_STAR_CMS"));
570  CTPPSDataQuery->defineOutput(CTPPSDataOutput);
571  //execute the query
572  coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute();
573  cond::Time_t dipTime = 0;
574  std::string lhcState = "", lhcComment = "", ctppsStatus = "";
575  unsigned int lumiSection = 0;
576  float crossingAngle = 0., betastar = 0.;
577 
578  bool ret = false;
580  while (CTPPSDataCursor.next()) {
581  if (m_debug) {
582  std::ostringstream CTPPS;
583  CTPPSDataCursor.currentRow().toOutputStream(CTPPS);
584  }
585  coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")];
586  if (!dipTimeAttribute.isNull()) {
587  dipTime = cond::time::from_boost(dipTimeAttribute.data<coral::TimeStamp>().time());
588  if (filter.process(dipTime)) {
589  ret = true;
590  coral::Attribute const& lhcStateAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_STATE")];
591  if (!lhcStateAttribute.isNull()) {
592  lhcState = lhcStateAttribute.data<std::string>();
593  }
594  coral::Attribute const& lhcCommentAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_COMMENT")];
595  if (!lhcCommentAttribute.isNull()) {
596  lhcComment = lhcCommentAttribute.data<std::string>();
597  }
598  coral::Attribute const& ctppsStatusAttribute = CTPPSDataCursor.currentRow()[std::string("CTPPS_STATUS")];
599  if (!ctppsStatusAttribute.isNull()) {
600  ctppsStatus = ctppsStatusAttribute.data<std::string>();
601  }
602  coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")];
603  if (!lumiSectionAttribute.isNull()) {
604  lumiSection = lumiSectionAttribute.data<int>();
605  }
606  coral::Attribute const& crossingAngleAttribute = CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_URAD")];
607  if (!crossingAngleAttribute.isNull()) {
608  crossingAngle = crossingAngleAttribute.data<float>();
609  }
610  coral::Attribute const& betaStarAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_CMS")];
611  if (!betaStarAttribute.isNull()) {
612  betastar = betaStarAttribute.data<float>();
613  }
614  for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) {
615  // set the current values to all of the payloads of the lumi section samples after the current since
616  LHCInfo& payload = *(it->second);
617  payload.setCrossingAngle(crossingAngle);
618  payload.setBetaStar(betastar);
619  payload.setLhcState(lhcState);
620  payload.setLhcComment(lhcComment);
621  payload.setCtppsStatus(ctppsStatus);
622  payload.setLumiSection(lumiSection);
623  }
624  }
625  }
626  }
627  return ret;
628 }
void setLumiSection(unsigned int const &lumiSection)
Definition: LHCInfo.cc:352
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
ret
prodAgent to be discontinued
void setLhcComment(std::string const &lhcComment)
Definition: LHCInfo.cc:344
unsigned long long Time_t
Definition: Time.h:14
void setBetaStar(float const &betaStar)
Definition: LHCInfo.cc:300
void setLhcState(std::string const &lhcState)
Definition: LHCInfo.cc:340
Time_t from_boost(boost::posix_time::ptime bt)
coral::ISessionProxy & coralSession()
Definition: Session.cc:218
void setCtppsStatus(std::string const &ctppsStatus)
Definition: LHCInfo.cc:348
void setCrossingAngle(float const &angle)
Definition: LHCInfo.cc:298
bool LHCInfoPopConSourceHandler::getDipData ( cond::persistency::Session session,
const boost::posix_time::ptime &  beginFillTime,
const boost::posix_time::ptime &  endFillTime 
)
private

Definition at line 390 of file LHCInfoPopConSourceHandler.cc.

References LHCInfo::availableBunchSlots, cond::persistency::Session::coralSession(), cond::time::from_boost(), m_debug, m_dipSchema, m_fillPayload, or, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

392  {
393  //run the third and fourth query against the schema hosting detailed DIP information
394  coral::ISchema& beamCondSchema = session.coralSession().schema(m_dipSchema);
395  //start the transaction against the DIP "deep" database backend schema
396  //prepare the WHERE clause for both queries
397  coral::AttributeList bunchConfBindVariables;
398  bunchConfBindVariables.extend<coral::TimeStamp>(std::string("beginFillTime"));
399  bunchConfBindVariables.extend<coral::TimeStamp>(std::string("endFillTime"));
400  bunchConfBindVariables[std::string("beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
401  bunchConfBindVariables[std::string("endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
402  std::string conditionStr = std::string("DIPTIME >= :beginFillTime and DIPTIME< :endFillTime");
403  //define the output types for both queries
404  coral::AttributeList bunchConfOutput;
405  bunchConfOutput.extend<coral::TimeStamp>(std::string("DIPTIME"));
406  bunchConfOutput.extend<unsigned short>(std::string("BUCKET"));
407  //execute query for Beam 1
408  std::unique_ptr<coral::IQuery> bunchConf1Query(beamCondSchema.newQuery());
409  bunchConf1Query->addToTableList(std::string("LHC_CIRCBUNCHCONFIG_BEAM1"),
410  std::string("BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS"));
411  bunchConf1Query->addToOutputList(std::string("BEAMCONF.DIPTIME"), std::string("DIPTIME"));
412  bunchConf1Query->addToOutputList(std::string("BUCKETS.COLUMN_VALUE"), std::string("BUCKET"));
413  bunchConf1Query->setCondition(conditionStr, bunchConfBindVariables);
414  bunchConf1Query->addToOrderList(std::string("DIPTIME"));
415  bunchConf1Query->limitReturnedRows(LHCInfo::availableBunchSlots); //maximum number of filled bunches
416  bunchConf1Query->defineOutput(bunchConfOutput);
417 
418  coral::ICursor& bunchConf1Cursor = bunchConf1Query->execute();
419  std::bitset<LHCInfo::bunchSlots + 1> bunchConfiguration1(0ULL);
420  bool ret = false;
421  cond::Time_t lumiSectionTime = 0;
422  while (bunchConf1Cursor.next()) {
423  if (m_debug) {
424  std::ostringstream b1s;
425  bunchConf1Cursor.currentRow().toOutputStream(b1s);
426  }
427  coral::Attribute const& dipTimeAttribute = bunchConf1Cursor.currentRow()[std::string("DIPTIME")];
428  coral::Attribute const& bunchConf1Attribute = bunchConf1Cursor.currentRow()[std::string("BUCKET")];
429  if (!dipTimeAttribute.isNull() and !bunchConf1Attribute.isNull()) {
430  cond::Time_t dipTime = cond::time::from_boost(dipTimeAttribute.data<coral::TimeStamp>().time());
431  // assuming only one sample has been selected...
432  unsigned short slot = (bunchConf1Attribute.data<unsigned short>() - 1) / 10 + 1;
433  if (lumiSectionTime == 0 or lumiSectionTime == dipTime) {
434  bunchConfiguration1[slot] = true;
435  } else
436  break;
437  lumiSectionTime = dipTime;
438  }
439  }
440  if (ret) {
441  m_fillPayload->setBunchBitsetForBeam1(bunchConfiguration1);
442  }
443 
444  //execute query for Beam 2
445  std::unique_ptr<coral::IQuery> bunchConf2Query(beamCondSchema.newQuery());
446  bunchConf2Query->addToTableList(std::string("LHC_CIRCBUNCHCONFIG_BEAM2"),
447  std::string("BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS"));
448  bunchConf2Query->addToOutputList(std::string("BEAMCONF.DIPTIME"), std::string("DIPTIME"));
449  bunchConf2Query->addToOutputList(std::string("BUCKETS.COLUMN_VALUE"), std::string("BUCKET"));
450  bunchConf2Query->setCondition(conditionStr, bunchConfBindVariables);
451  bunchConf2Query->addToOrderList(std::string("DIPTIME"));
452  bunchConf2Query->limitReturnedRows(LHCInfo::availableBunchSlots); //maximum number of filled bunches
453  bunchConf2Query->defineOutput(bunchConfOutput);
454  coral::ICursor& bunchConf2Cursor = bunchConf2Query->execute();
455 
456  std::bitset<LHCInfo::bunchSlots + 1> bunchConfiguration2(0ULL);
457  ret = false;
458  lumiSectionTime = 0;
459  while (bunchConf2Cursor.next()) {
460  if (m_debug) {
461  std::ostringstream b2s;
462  bunchConf2Cursor.currentRow().toOutputStream(b2s);
463  }
464  coral::Attribute const& dipTimeAttribute = bunchConf2Cursor.currentRow()[std::string("DIPTIME")];
465  coral::Attribute const& bunchConf2Attribute = bunchConf2Cursor.currentRow()[std::string("BUCKET")];
466  if (!dipTimeAttribute.isNull() and !bunchConf2Attribute.isNull()) {
467  ret = true;
468  cond::Time_t dipTime = cond::time::from_boost(dipTimeAttribute.data<coral::TimeStamp>().time());
469  // assuming only one sample has been selected...
470  unsigned short slot = (bunchConf2Attribute.data<unsigned short>() - 1) / 10 + 1;
471  if (lumiSectionTime == 0 or lumiSectionTime == dipTime) {
472  bunchConfiguration2[slot] = true;
473  } else
474  break;
475  lumiSectionTime = dipTime;
476  }
477  }
478  if (ret) {
479  m_fillPayload->setBunchBitsetForBeam2(bunchConfiguration2);
480  }
481  //execute query for lumiPerBX
482  std::unique_ptr<coral::IQuery> lumiDataQuery(beamCondSchema.newQuery());
483  lumiDataQuery->addToTableList(std::string("CMS_LHC_LUMIPERBUNCH"),
484  std::string("LUMIPERBUNCH\", TABLE( LUMIPERBUNCH.LUMI_BUNCHINST ) \"VALUE"));
485  lumiDataQuery->addToOutputList(std::string("LUMIPERBUNCH.DIPTIME"), std::string("DIPTIME"));
486  lumiDataQuery->addToOutputList(std::string("VALUE.COLUMN_VALUE"), std::string("LUMI_BUNCH"));
487  coral::AttributeList lumiDataBindVariables;
488  lumiDataBindVariables.extend<coral::TimeStamp>(std::string("beginFillTime"));
489  lumiDataBindVariables.extend<coral::TimeStamp>(std::string("endFillTime"));
490  lumiDataBindVariables[std::string("beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
491  lumiDataBindVariables[std::string("endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
492  conditionStr = std::string("DIPTIME BETWEEN :beginFillTime AND :endFillTime");
493  lumiDataQuery->setCondition(conditionStr, lumiDataBindVariables);
494  lumiDataQuery->addToOrderList(std::string("DIPTIME"));
495  lumiDataQuery->limitReturnedRows(3564); //Maximum number of bunches.
496  //define query output
497  coral::AttributeList lumiDataOutput;
498  lumiDataOutput.extend<coral::TimeStamp>(std::string("DIPTIME"));
499  lumiDataOutput.extend<float>(std::string("LUMI_BUNCH"));
500  lumiDataQuery->defineOutput(lumiDataOutput);
501  //execute the query
502  coral::ICursor& lumiDataCursor = lumiDataQuery->execute();
503 
504  std::vector<float> lumiPerBX;
505  ret = false;
506  lumiSectionTime = 0;
507  while (lumiDataCursor.next()) {
508  if (m_debug) {
509  std::ostringstream lpBX;
510  lumiDataCursor.currentRow().toOutputStream(lpBX);
511  }
512  coral::Attribute const& dipTimeAttribute = lumiDataCursor.currentRow()[std::string("DIPTIME")];
513  coral::Attribute const& lumiBunchAttribute = lumiDataCursor.currentRow()[std::string("LUMI_BUNCH")];
514  if (!dipTimeAttribute.isNull() and !lumiBunchAttribute.isNull()) {
515  ret = true;
516  cond::Time_t dipTime = cond::time::from_boost(dipTimeAttribute.data<coral::TimeStamp>().time());
517  // assuming only one sample has been selected...
518  float lumi_b = lumiBunchAttribute.data<float>();
519  if (lumiSectionTime == 0 or lumiSectionTime == dipTime) {
520  if (lumi_b != 0.00)
521  lumiPerBX.push_back(lumi_b);
522  } else
523  break;
524  lumiSectionTime = dipTime;
525  }
526  }
527  if (ret) {
528  m_fillPayload->setLumiPerBX(lumiPerBX);
529  }
530  return ret;
531 }
std::unique_ptr< LHCInfo > m_fillPayload
ret
prodAgent to be discontinued
unsigned long long Time_t
Definition: Time.h:14
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Time_t from_boost(boost::posix_time::ptime bt)
static size_t const availableBunchSlots
Definition: LHCInfo.h:61
coral::ISessionProxy & coralSession()
Definition: Session.cc:218
bool LHCInfoPopConSourceHandler::getEcalData ( cond::persistency::Session session,
const boost::posix_time::ptime &  lowerTime,
const boost::posix_time::ptime &  upperTime,
bool  update 
)
private

Definition at line 668 of file LHCInfoPopConSourceHandler.cc.

References LHCInfoImpl::LumiSectionFilter::current(), ECAL, ALCARECOTkAlBeamHalo_cff::filter, cond::time::from_boost(), edm::detail::isnan(), m_debug, m_name, m_prevPayload, m_tmpBuffer, cond::persistency::Session::nominalSchema(), jets_cff::payload, LHCInfoImpl::LumiSectionFilter::process(), runTheMatrix::ret, LHCInfoImpl::setElementData(), AlCaHLTBitMon_QueryRunRegistry::string, ntuplemaker::time, and cond::time::to_boost().

Referenced by getNewObjects().

671  {
672  //run the sixth query against the CMS_DCS_ENV_PVSS_COND schema
673  //Initializing the CMS_DCS_ENV_PVSS_COND schema.
674  coral::ISchema& ECAL = session.nominalSchema();
675  //start the transaction against the fill logging schema
676  //execute query for ECAL Data
677  std::unique_ptr<coral::IQuery> ECALDataQuery(ECAL.newQuery());
678  //FROM clause
679  ECALDataQuery->addToTableList(std::string("BEAM_PHASE"));
680  //SELECT clause
681  ECALDataQuery->addToOutputList(std::string("CHANGE_DATE"));
682  ECALDataQuery->addToOutputList(std::string("DIP_value"));
683  ECALDataQuery->addToOutputList(std::string("element_nr"));
684  ECALDataQuery->addToOutputList(std::string("VALUE_NUMBER"));
685  //WHERE CLAUSE
686  coral::AttributeList ECALDataBindVariables;
687  ECALDataBindVariables.extend<coral::TimeStamp>(std::string("lowerTime"));
688  ECALDataBindVariables.extend<coral::TimeStamp>(std::string("upperTime"));
689  ECALDataBindVariables[std::string("lowerTime")].data<coral::TimeStamp>() = coral::TimeStamp(lowerTime);
690  ECALDataBindVariables[std::string("upperTime")].data<coral::TimeStamp>() = coral::TimeStamp(upperTime);
691  std::string conditionStr = std::string(
692  "(DIP_value LIKE '%beamPhaseMean%' OR DIP_value LIKE '%cavPhaseMean%') AND CHANGE_DATE >= :lowerTime AND "
693  "CHANGE_DATE < :upperTime");
694 
695  ECALDataQuery->setCondition(conditionStr, ECALDataBindVariables);
696  //ORDER BY clause
697  ECALDataQuery->addToOrderList(std::string("CHANGE_DATE"));
698  ECALDataQuery->addToOrderList(std::string("DIP_value"));
699  ECALDataQuery->addToOrderList(std::string("element_nr"));
700  //define query output
701  coral::AttributeList ECALDataOutput;
702  ECALDataOutput.extend<coral::TimeStamp>(std::string("CHANGE_DATE"));
703  ECALDataOutput.extend<std::string>(std::string("DIP_value"));
704  ECALDataOutput.extend<unsigned int>(std::string("element_nr"));
705  ECALDataOutput.extend<float>(std::string("VALUE_NUMBER"));
706  //ECALDataQuery->limitReturnedRows( 14256 ); //3564 entries per vector.
707  ECALDataQuery->defineOutput(ECALDataOutput);
708  //execute the query
709  coral::ICursor& ECALDataCursor = ECALDataQuery->execute();
710  cond::Time_t changeTime = 0;
711  cond::Time_t firstTime = 0;
712  std::string dipVal = "";
713  unsigned int elementNr = 0;
714  float value = 0.;
715  std::set<cond::Time_t> initializedVectors;
717  bool ret = false;
718  if (m_prevPayload.get()) {
719  for (auto& lumiSlot : m_tmpBuffer) {
720  lumiSlot.second->setBeam1VC(m_prevPayload->beam1VC());
721  lumiSlot.second->setBeam2VC(m_prevPayload->beam2VC());
722  lumiSlot.second->setBeam1RF(m_prevPayload->beam1RF());
723  lumiSlot.second->setBeam2RF(m_prevPayload->beam2RF());
724  }
725  }
726  std::map<cond::Time_t, cond::Time_t> iovMap;
727  cond::Time_t lowerLumi = m_tmpBuffer.front().first;
728  while (ECALDataCursor.next()) {
729  if (m_debug) {
730  std::ostringstream ECAL;
731  ECALDataCursor.currentRow().toOutputStream(ECAL);
732  }
733  coral::Attribute const& changeDateAttribute = ECALDataCursor.currentRow()[std::string("CHANGE_DATE")];
734  if (!changeDateAttribute.isNull()) {
735  ret = true;
736  boost::posix_time::ptime chTime = changeDateAttribute.data<coral::TimeStamp>().time();
737  // move the first IOV found to the start of the fill interval selected
738  if (changeTime == 0) {
739  firstTime = cond::time::from_boost(chTime);
740  }
741  changeTime = cond::time::from_boost(chTime);
742  cond::Time_t iovTime = changeTime;
743  if (!update and changeTime == firstTime)
744  iovTime = lowerLumi;
745  coral::Attribute const& dipValAttribute = ECALDataCursor.currentRow()[std::string("DIP_value")];
746  coral::Attribute const& valueNumberAttribute = ECALDataCursor.currentRow()[std::string("VALUE_NUMBER")];
747  coral::Attribute const& elementNrAttribute = ECALDataCursor.currentRow()[std::string("element_nr")];
748  if (!dipValAttribute.isNull() and !valueNumberAttribute.isNull()) {
749  dipVal = dipValAttribute.data<std::string>();
750  elementNr = elementNrAttribute.data<unsigned int>();
751  value = valueNumberAttribute.data<float>();
752  if (isnan(value))
753  value = 0.;
754  if (filter.process(iovTime)) {
755  iovMap.insert(std::make_pair(changeTime, filter.current()->first));
756  for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) {
757  LHCInfo& payload = *(it->second);
758  LHCInfoImpl::setElementData(it->first, dipVal, elementNr, value, payload, initializedVectors);
759  }
760  }
761  //}
762  }
763  }
764  }
765  if (m_debug) {
766  for (auto& im : iovMap) {
767  edm::LogInfo(m_name) << "Found iov=" << im.first << " (" << cond::time::to_boost(im.first) << " ) moved to "
768  << im.second << " ( " << cond::time::to_boost(im.second) << " )";
769  }
770  }
771  return ret;
772 }
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
ret
prodAgent to be discontinued
std::shared_ptr< LHCInfo > m_prevPayload
unsigned long long Time_t
Definition: Time.h:14
bool isnan(float x)
Definition: math.h:13
coral::ISchema & nominalSchema()
Definition: Session.cc:224
Definition: value.py:1
Time_t from_boost(boost::posix_time::ptime bt)
void setElementData(cond::Time_t since, const std::string &dipVal, unsigned int elementNr, float value, LHCInfo &payload, std::set< cond::Time_t > &initList)
#define update(a, b)
boost::posix_time::ptime to_boost(Time_t iValue)
bool LHCInfoPopConSourceHandler::getFillData ( cond::persistency::Session session,
unsigned short  fillId 
)
private

Definition at line 251 of file LHCInfoPopConSourceHandler.cc.

References m_debug, m_fillPayload, LHCInfoImpl::makeFillDataQuery(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

251  {
252  // Prepare the WHERE clause
253  coral::AttributeList fillDataBindVariables;
254  fillDataBindVariables.extend<unsigned short>(std::string("fillId"));
255  fillDataBindVariables[std::string("fillId")].data<unsigned short>() = fillId;
256  std::string conditionStr = "LHCFILL=:fillId";
257  return LHCInfoImpl::makeFillDataQuery(session, conditionStr, fillDataBindVariables, m_fillPayload, m_debug);
258 }
std::unique_ptr< LHCInfo > m_fillPayload
bool makeFillDataQuery(cond::persistency::Session &session, const std::string &conditionString, const coral::AttributeList &fillDataBindVariables, std::unique_ptr< LHCInfo > &targetPayload, bool debug)
size_t LHCInfoPopConSourceHandler::getLumiData ( cond::persistency::Session session,
const boost::posix_time::ptime &  beginFillTime,
const boost::posix_time::ptime &  endFillTime 
)
private

Definition at line 260 of file LHCInfoPopConSourceHandler.cc.

References cond::time::from_boost(), muonGEMDigis_cfi::instLumi, m_fillPayload, m_tmpBuffer, cond::persistency::Session::nominalSchema(), jets_cff::payload, LHCInfo::setDelivLumi(), LHCInfo::setInstLumi(), LHCInfo::setInstLumiError(), LHCInfo::setRecLumi(), writeEcalDQMStatus::since, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

262  {
263  coral::ISchema& runTimeLoggerSchema = session.nominalSchema();
264  //prepare the query for table 2:
265  std::unique_ptr<coral::IQuery> fillDataQuery2(runTimeLoggerSchema.newQuery());
266  //FROM clause
267  fillDataQuery2->addToTableList(std::string("LUMI_SECTIONS"));
268  //SELECT clause
269  fillDataQuery2->addToOutputList(std::string("DELIVLUMI"));
270  fillDataQuery2->addToOutputList(std::string("LIVELUMI"));
271  fillDataQuery2->addToOutputList(std::string("INSTLUMI"));
272  fillDataQuery2->addToOutputList(std::string("INSTLUMIERROR"));
273  fillDataQuery2->addToOutputList(std::string("STARTTIME"));
274  fillDataQuery2->addToOutputList(std::string("LHCFILL"));
275  //WHERE clause
276  coral::AttributeList fillDataBindVariables;
277  fillDataBindVariables.extend<coral::TimeStamp>(std::string("start"));
278  fillDataBindVariables.extend<coral::TimeStamp>(std::string("stop"));
279  fillDataBindVariables[std::string("start")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
280  fillDataBindVariables[std::string("stop")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
281  std::string conditionStr = "DELIVLUMI IS NOT NULL AND STARTTIME >= :start AND STARTTIME< :stop";
282  fillDataQuery2->setCondition(conditionStr, fillDataBindVariables);
283  //ORDER BY clause
284  fillDataQuery2->addToOrderList(std::string("STARTTIME"));
285  //define query output*/
286  coral::AttributeList fillDataOutput2;
287  fillDataOutput2.extend<float>(std::string("DELIVEREDLUMI"));
288  fillDataOutput2.extend<float>(std::string("RECORDEDLUMI"));
289  fillDataOutput2.extend<float>(std::string("INSTLUMI"));
290  fillDataOutput2.extend<float>(std::string("INSTLUMIERROR"));
291  fillDataOutput2.extend<coral::TimeStamp>(std::string("STARTTIME"));
292  fillDataOutput2.extend<int>(std::string("LHCFILL"));
293  fillDataQuery2->defineOutput(fillDataOutput2);
294  //execute the query
295  coral::ICursor& fillDataCursor2 = fillDataQuery2->execute();
296 
297  size_t nlumi = 0;
298  while (fillDataCursor2.next()) {
299  nlumi++;
300  float delivLumi = 0., recLumi = 0., instLumi = 0, instLumiErr = 0.;
301  cond::Time_t since = 0;
302  coral::Attribute const& delivLumiAttribute = fillDataCursor2.currentRow()[std::string("DELIVEREDLUMI")];
303  if (!delivLumiAttribute.isNull()) {
304  delivLumi = delivLumiAttribute.data<float>() / 1000.;
305  }
306  coral::Attribute const& recLumiAttribute = fillDataCursor2.currentRow()[std::string("RECORDEDLUMI")];
307  if (!recLumiAttribute.isNull()) {
308  recLumi = recLumiAttribute.data<float>() / 1000.;
309  }
310  coral::Attribute const& instLumiAttribute = fillDataCursor2.currentRow()[std::string("INSTLUMI")];
311  if (!instLumiAttribute.isNull()) {
312  instLumi = instLumiAttribute.data<float>() / 1000.;
313  }
314  coral::Attribute const& instLumiErrAttribute = fillDataCursor2.currentRow()[std::string("INSTLUMIERROR")];
315  if (!instLumiErrAttribute.isNull()) {
316  instLumiErr = instLumiErrAttribute.data<float>() / 1000.;
317  }
318  coral::Attribute const& startLumiSectionAttribute = fillDataCursor2.currentRow()[std::string("STARTTIME")];
319  if (!startLumiSectionAttribute.isNull()) {
320  since = cond::time::from_boost(startLumiSectionAttribute.data<coral::TimeStamp>().time());
321  }
322  LHCInfo* thisLumiSectionInfo = m_fillPayload->cloneFill();
323  m_tmpBuffer.emplace_back(std::make_pair(since, thisLumiSectionInfo));
324  LHCInfo& payload = *thisLumiSectionInfo;
325  payload.setDelivLumi(delivLumi);
326  payload.setRecLumi(recLumi);
327  payload.setInstLumi(instLumi);
328  payload.setInstLumiError(instLumiErr);
329  }
330  return nlumi;
331 }
void setInstLumi(float const &instLumi)
Definition: LHCInfo.cc:316
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
std::unique_ptr< LHCInfo > m_fillPayload
void setInstLumiError(float const &instLumiError)
Definition: LHCInfo.cc:318
void setDelivLumi(float const &delivLumi)
Definition: LHCInfo.cc:312
unsigned long long Time_t
Definition: Time.h:14
coral::ISchema & nominalSchema()
Definition: Session.cc:224
Time_t from_boost(boost::posix_time::ptime bt)
void setRecLumi(float const &recLumi)
Definition: LHCInfo.cc:314
void LHCInfoPopConSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< LHCInfo >.

Definition at line 847 of file LHCInfoPopConSourceHandler.cc.

References addEmptyPayload(), cond::persistency::Transaction::commit(), cond::persistency::ConnectionPool::configure(), cond::persistency::ConnectionPool::createSession(), popcon::PopConSourceHandler< LHCInfo >::dbSession(), Debug, cond::persistency::Session::fetchPayload(), cond::time::from_boost(), getCTTPSData(), getDipData(), getEcalData(), getFillData(), getLumiData(), getNextFillData(), cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, m_authpath, m_connectionString, m_debug, m_ecalConnectionString, m_endFill, m_fillPayload, m_name, m_payloadBuffer, m_prevPayload, m_startTime, m_tmpBuffer, popcon::PopConSourceHandler< LHCInfo >::m_to_transfer, Skims_PA_cff::name, cond::TagInfo_t::name, cond::persistency::ConnectionPool::setAuthenticationPath(), cond::persistency::ConnectionPool::setMessageVerbosity(), cond::TagInfo_t::size, cond::persistency::Transaction::start(), popcon::PopConSourceHandler< LHCInfo >::tagInfo(), cond::time::to_boost(), cond::TagInfo_t::token, cond::persistency::Session::transaction(), and LHCInfoImpl::transferPayloads().

847  {
848  //reference to the last payload in the tag
849  Ref previousFill;
850 
851  //if a new tag is created, transfer fake fill from 1 to the first fill for the first time
852  if (tagInfo().name.empty()) {
853  edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects";
854  } else {
855  //check what is already inside the database
856  edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ", IOVSequence token " << tagInfo().token
857  << ": size " << tagInfo().size << ", last object valid since " << tagInfo().lastInterval.first
858  << " ( "
859  << boost::posix_time::to_iso_extended_string(
860  cond::time::to_boost(tagInfo().lastInterval.first))
861  << " ); from " << m_name << "::getNewObjects";
862  }
863 
864  cond::Time_t lastSince = tagInfo().lastInterval.first;
865  if (lastSince == 0) {
866  // for a new or empty tag, an empty payload should be added on top with since=1
867  addEmptyPayload(1);
868  } else {
869  edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from "
870  << m_name << "::getNewObjects";
871  }
872 
873  boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time();
874  cond::Time_t targetSince = 0;
875  cond::Time_t endIov = cond::time::from_boost(executionTime);
876  if (!m_startTime.is_not_a_date_time()) {
877  targetSince = cond::time::from_boost(m_startTime);
878  }
879  if (lastSince > targetSince)
880  targetSince = lastSince;
881 
882  edm::LogInfo(m_name) << "Starting sampling at "
883  << boost::posix_time::to_simple_string(cond::time::to_boost(targetSince));
884 
885  //retrieve the data from the relational database source
887  //configure the connection
888  if (m_debug) {
889  connection.setMessageVerbosity(coral::Debug);
890  } else {
891  connection.setMessageVerbosity(coral::Error);
892  }
893  connection.setAuthenticationPath(m_authpath);
894  connection.configure();
895  //create the sessions
896  cond::persistency::Session session = connection.createSession(m_connectionString, false);
898  // fetch last payload when available
899  if (!tagInfo().lastPayloadToken.empty()) {
901  session3.transaction().start(true);
903  session3.transaction().commit();
904  }
905 
906  bool iovAdded = false;
907  while (true) {
908  if (targetSince >= endIov) {
909  edm::LogInfo(m_name) << "Sampling ended at the time "
910  << boost::posix_time::to_simple_string(cond::time::to_boost(endIov));
911  break;
912  }
913  bool updateEcal = false;
914  boost::posix_time::ptime targetTime = cond::time::to_boost(targetSince);
915  boost::posix_time::ptime startSampleTime;
916  boost::posix_time::ptime endSampleTime;
917  if (!m_endFill and m_prevPayload->fillNumber() and m_prevPayload->endTime() == 0ULL) {
918  // execute the query for the current fill
919  session.transaction().start(true);
920  edm::LogInfo(m_name) << "Searching started fill #" << m_prevPayload->fillNumber();
921  bool foundFill = getFillData(session, m_prevPayload->fillNumber());
922  session.transaction().commit();
923  if (!foundFill) {
924  edm::LogError(m_name) << "Could not find fill #" << m_prevPayload->fillNumber();
925  break;
926  }
927  updateEcal = true;
928  startSampleTime = cond::time::to_boost(lastSince);
929  } else {
930  session.transaction().start(true);
931  edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(targetTime);
932  bool foundFill = getNextFillData(session, targetTime, m_endFill);
933  session.transaction().commit();
934  if (!foundFill) {
935  edm::LogInfo(m_name) << "No fill found - END of job.";
936  if (iovAdded)
937  addEmptyPayload(targetSince);
938  break;
939  }
940  startSampleTime = cond::time::to_boost(m_fillPayload->createTime());
941  }
942  cond::Time_t startFillTime = m_fillPayload->createTime();
943  cond::Time_t endFillTime = m_fillPayload->endTime();
944  unsigned short lhcFill = m_fillPayload->fillNumber();
945  if (endFillTime == 0ULL) {
946  edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime);
947  endSampleTime = executionTime;
948  targetSince = endIov;
949  } else {
950  edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime)
951  << " ending at " << cond::time::to_boost(endFillTime);
952  endSampleTime = cond::time::to_boost(endFillTime);
953  targetSince = endFillTime;
954  }
955 
956  session.transaction().start(true);
957  getDipData(session, startSampleTime, endSampleTime);
958  size_t nlumi = getLumiData(session, startSampleTime, endSampleTime);
959  edm::LogInfo(m_name) << "Found " << nlumi << " lumisections during the fill " << lhcFill;
960  boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first);
961  boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first);
962  edm::LogInfo(m_name) << "First lumi starts at " << flumiStart << " last lumi starts at " << flumiStop;
963  getCTTPSData(session, startSampleTime, endSampleTime);
964  session.transaction().commit();
965  session2.transaction().start(true);
966  getEcalData(session2, startSampleTime, endSampleTime, updateEcal);
967  session2.transaction().commit();
968  //
970  edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time";
971  m_tmpBuffer.clear();
972  iovAdded = true;
973  //if(m_prevPayload->fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() );
974  if (m_prevPayload->fillNumber() and m_fillPayload->endTime() != 0ULL)
975  addEmptyPayload(m_fillPayload->endTime());
976  }
977 }
cond::persistency::Session & dbSession() const
edm::ErrorSummaryEntry Error
bool getFillData(cond::persistency::Session &session, unsigned short fillId)
boost::posix_time::ptime m_startTime
bool getCTTPSData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
size_t getLumiData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
std::unique_ptr< LHCInfo > m_fillPayload
void start(bool readOnly=true)
Definition: Session.cc:18
bool getEcalData(cond::persistency::Session &session, const boost::posix_time::ptime &lowerTime, const boost::posix_time::ptime &upperTime, bool update)
size_t size
Definition: Types.h:76
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:224
std::shared_ptr< LHCInfo > m_prevPayload
Transaction & transaction()
Definition: Session.cc:43
size_t transferPayloads(const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo >>> &buffer, std::vector< std::shared_ptr< LHCInfo >> &payloadBuffer, std::vector< std::pair< LHCInfo *, cond::Time_t >> &vecToTransfer, std::shared_ptr< LHCInfo > &prevPayload)
std::string name
Definition: Types.h:72
bool getDipData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
cond::ValidityInterval lastInterval
Definition: Types.h:74
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
unsigned long long Time_t
Definition: Time.h:14
Session createSession(const std::string &connectionString, bool writeCapable=false)
void setMessageVerbosity(coral::MsgLevel level)
Time_t from_boost(boost::posix_time::ptime bt)
std::string lastPayloadToken
Definition: Types.h:75
void setAuthenticationPath(const std::string &p)
const bool Debug
std::string token
Definition: Types.h:73
boost::posix_time::ptime to_boost(Time_t iValue)
bool getNextFillData(cond::persistency::Session &session, const boost::posix_time::ptime &targetTime, bool ended)
cond::TagInfo_t const & tagInfo() const
bool LHCInfoPopConSourceHandler::getNextFillData ( cond::persistency::Session session,
const boost::posix_time::ptime &  targetTime,
bool  ended 
)
private

Definition at line 235 of file LHCInfoPopConSourceHandler.cc.

References m_debug, m_fillPayload, LHCInfoImpl::makeFillDataQuery(), seconds(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

237  {
238  // Prepare the WHERE clause
239  coral::AttributeList fillDataBindVariables;
240  fillDataBindVariables.extend<coral::TimeStamp>(std::string("targetTime"));
241  fillDataBindVariables[std::string("targetTime")].data<coral::TimeStamp>() =
242  coral::TimeStamp(targetTime + boost::posix_time::seconds(1));
243  //by imposing BEGINTIME IS NOT NULL, we remove fills which never went into stable beams,
244  //by additionally imposing ENDTIME IS NOT NULL, we select only finished fills
245  std::string conditionStr = "BEGINTIME IS NOT NULL AND CREATETIME > :targetTime AND LHCFILL IS NOT NULL";
246  if (ended)
247  conditionStr += " AND ENDTIME IS NOT NULL";
248  return LHCInfoImpl::makeFillDataQuery(session, conditionStr, fillDataBindVariables, m_fillPayload, m_debug);
249 }
double seconds()
std::unique_ptr< LHCInfo > m_fillPayload
bool makeFillDataQuery(cond::persistency::Session &session, const std::string &conditionString, const coral::AttributeList &fillDataBindVariables, std::unique_ptr< LHCInfo > &targetPayload, bool debug)
std::string LHCInfoPopConSourceHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< LHCInfo >.

Definition at line 979 of file LHCInfoPopConSourceHandler.cc.

References m_name.

979 { return m_name; }

Member Data Documentation

std::string LHCInfoPopConSourceHandler::m_authpath
private

Definition at line 46 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

std::string LHCInfoPopConSourceHandler::m_connectionString
private

Definition at line 45 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

bool LHCInfoPopConSourceHandler::m_debug
private
std::string LHCInfoPopConSourceHandler::m_dipSchema
private

Definition at line 46 of file LHCInfoPopConSourceHandler.h.

Referenced by getDipData().

std::string LHCInfoPopConSourceHandler::m_ecalConnectionString
private

Definition at line 45 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

bool LHCInfoPopConSourceHandler::m_endFill = true
private

Definition at line 42 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

boost::posix_time::ptime LHCInfoPopConSourceHandler::m_endTime
private

Definition at line 39 of file LHCInfoPopConSourceHandler.h.

Referenced by LHCInfoPopConSourceHandler().

std::unique_ptr<LHCInfo> LHCInfoPopConSourceHandler::m_fillPayload
private
bool LHCInfoPopConSourceHandler::m_lastPayloadEmpty = false
private

Definition at line 51 of file LHCInfoPopConSourceHandler.h.

Referenced by addEmptyPayload().

std::string LHCInfoPopConSourceHandler::m_name
private

Definition at line 43 of file LHCInfoPopConSourceHandler.h.

Referenced by getEcalData(), getNewObjects(), and id().

std::vector<std::shared_ptr<LHCInfo> > LHCInfoPopConSourceHandler::m_payloadBuffer
private

Definition at line 50 of file LHCInfoPopConSourceHandler.h.

Referenced by addEmptyPayload(), and getNewObjects().

std::shared_ptr<LHCInfo> LHCInfoPopConSourceHandler::m_prevPayload
private

Definition at line 48 of file LHCInfoPopConSourceHandler.h.

Referenced by addEmptyPayload(), getEcalData(), and getNewObjects().

unsigned int LHCInfoPopConSourceHandler::m_samplingInterval
private

Definition at line 41 of file LHCInfoPopConSourceHandler.h.

boost::posix_time::ptime LHCInfoPopConSourceHandler::m_startTime
private

Definition at line 38 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects(), and LHCInfoPopConSourceHandler().

std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfo> > > LHCInfoPopConSourceHandler::m_tmpBuffer
private

Definition at line 49 of file LHCInfoPopConSourceHandler.h.

Referenced by getCTTPSData(), getEcalData(), getLumiData(), and getNewObjects().