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, cmsPerfSuiteHarvest::now, and AlCaHLTBitMon_QueryRunRegistry::string.

21  :
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) m_endTime = now;
44  }
45 }
T getUntrackedParameter(std::string const &, T const &) const
boost::posix_time::ptime m_startTime
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
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
LHCInfoPopConSourceHandler::~LHCInfoPopConSourceHandler ( )
override

Definition at line 48 of file LHCInfoPopConSourceHandler.cc.

48 {}

Member Function Documentation

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

Definition at line 754 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().

754  {
755  bool add = false;
756  if( m_to_transfer.empty() ){
757  if( !m_lastPayloadEmpty ) add = true;
758  } else {
759  LHCInfo* lastAdded = m_to_transfer.back().first;
760  if( lastAdded->fillNumber() != 0 ) {
761  add = true;
762  }
763  }
764  if( add ) {
765  auto newPayload = std::make_shared<LHCInfo>();
766  m_to_transfer.push_back( std::make_pair( newPayload.get(), iov ) );
767  m_payloadBuffer.push_back(newPayload);
768  m_prevPayload = newPayload;
769  }
770 }
std::shared_ptr< LHCInfo > m_prevPayload
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
unsigned short const fillNumber() const
Definition: LHCInfo.cc:144
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 520 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(), LHCInfo::setBetaStar(), LHCInfo::setCrossingAngle(), LHCInfo::setCtppsStatus(), LHCInfo::setLhcComment(), LHCInfo::setLhcState(), LHCInfo::setLumiSection(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

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

Definition at line 384 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by getNewObjects().

386  {
387  //run the third and fourth query against the schema hosting detailed DIP information
388  coral::ISchema& beamCondSchema = session.coralSession().schema( m_dipSchema );
389  //start the transaction against the DIP "deep" database backend schema
390  //prepare the WHERE clause for both queries
391  coral::AttributeList bunchConfBindVariables;
392  bunchConfBindVariables.extend<coral::TimeStamp>(std::string("beginFillTime"));
393  bunchConfBindVariables.extend<coral::TimeStamp>(std::string("endFillTime"));
394  bunchConfBindVariables[ std::string( "beginFillTime")].data<coral::TimeStamp>()= coral::TimeStamp( beginFillTime );
395  bunchConfBindVariables[ std::string( "endFillTime")].data<coral::TimeStamp>()= coral::TimeStamp( endFillTime );
396  std::string conditionStr = std::string( "DIPTIME >= :beginFillTime and DIPTIME< :endFillTime" );
397  //define the output types for both queries
398  coral::AttributeList bunchConfOutput;
399  bunchConfOutput.extend<coral::TimeStamp>( std::string( "DIPTIME" ) );
400  bunchConfOutput.extend<unsigned short>( std::string( "BUCKET" ) );
401  //execute query for Beam 1
402  std::unique_ptr<coral::IQuery> bunchConf1Query(beamCondSchema.newQuery());
403  bunchConf1Query->addToTableList( std::string( "LHC_CIRCBUNCHCONFIG_BEAM1" ), std::string( "BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS" ) );
404  bunchConf1Query->addToOutputList( std::string( "BEAMCONF.DIPTIME" ), std::string( "DIPTIME" ) );
405  bunchConf1Query->addToOutputList( std::string( "BUCKETS.COLUMN_VALUE" ), std::string( "BUCKET" ) );
406  bunchConf1Query->setCondition( conditionStr, bunchConfBindVariables );
407  bunchConf1Query->addToOrderList( std::string( "DIPTIME" ) );
408  bunchConf1Query->limitReturnedRows( LHCInfo::availableBunchSlots ); //maximum number of filled bunches
409  bunchConf1Query->defineOutput( bunchConfOutput );
410 
411  coral::ICursor& bunchConf1Cursor = bunchConf1Query->execute();
412  std::bitset<LHCInfo::bunchSlots+1> bunchConfiguration1( 0ULL );
413  bool ret = false;
414  cond::Time_t lumiSectionTime = 0;
415  while( bunchConf1Cursor.next() ) {
416  if( m_debug ) {
417  std::ostringstream b1s;
418  bunchConf1Cursor.currentRow().toOutputStream( b1s );
419  }
420  coral::Attribute const & dipTimeAttribute = bunchConf1Cursor.currentRow()[ std::string( "DIPTIME" ) ];
421  coral::Attribute const & bunchConf1Attribute = bunchConf1Cursor.currentRow()[ std::string( "BUCKET" ) ];
422  if( !dipTimeAttribute.isNull() and !bunchConf1Attribute.isNull() ){
423  cond::Time_t dipTime = cond::time::from_boost( dipTimeAttribute.data<coral::TimeStamp>().time() );
424  // assuming only one sample has been selected...
425  unsigned short slot = ( bunchConf1Attribute.data<unsigned short>() - 1 ) / 10 + 1;
426  if( lumiSectionTime == 0 or lumiSectionTime == dipTime){
427  bunchConfiguration1[slot] = true;
428  } else break;
429  lumiSectionTime = dipTime;
430  }
431  }
432  if( ret ){
433  m_fillPayload->setBunchBitsetForBeam1(bunchConfiguration1);
434  }
435 
436  //execute query for Beam 2
437  std::unique_ptr<coral::IQuery> bunchConf2Query(beamCondSchema.newQuery());
438  bunchConf2Query->addToTableList( std::string( "LHC_CIRCBUNCHCONFIG_BEAM2" ), std::string( "BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS" ) );
439  bunchConf2Query->addToOutputList( std::string( "BEAMCONF.DIPTIME" ), std::string( "DIPTIME" ) );
440  bunchConf2Query->addToOutputList( std::string( "BUCKETS.COLUMN_VALUE" ), std::string( "BUCKET" ) );
441  bunchConf2Query->setCondition( conditionStr, bunchConfBindVariables );
442  bunchConf2Query->addToOrderList( std::string( "DIPTIME" ) );
443  bunchConf2Query->limitReturnedRows( LHCInfo::availableBunchSlots ); //maximum number of filled bunches
444  bunchConf2Query->defineOutput( bunchConfOutput );
445  coral::ICursor& bunchConf2Cursor = bunchConf2Query->execute();
446 
447  std::bitset<LHCInfo::bunchSlots+1> bunchConfiguration2( 0ULL );
448  ret = false;
449  lumiSectionTime = 0;
450  while( bunchConf2Cursor.next() ) {
451  if( m_debug ) {
452  std::ostringstream b2s;
453  bunchConf2Cursor.currentRow().toOutputStream( b2s );
454  }
455  coral::Attribute const & dipTimeAttribute = bunchConf2Cursor.currentRow()[ std::string( "DIPTIME" ) ];
456  coral::Attribute const & bunchConf2Attribute = bunchConf2Cursor.currentRow()[ std::string( "BUCKET" ) ];
457  if( !dipTimeAttribute.isNull() and !bunchConf2Attribute.isNull() ){
458  ret = true;
459  cond::Time_t dipTime = cond::time::from_boost( dipTimeAttribute.data<coral::TimeStamp>().time() );
460  // assuming only one sample has been selected...
461  unsigned short slot = ( bunchConf2Attribute.data<unsigned short>() - 1 ) / 10 + 1;
462  if( lumiSectionTime == 0 or lumiSectionTime == dipTime){
463  bunchConfiguration2[slot] = true;
464  } else break;
465  lumiSectionTime = dipTime;
466  }
467  }
468  if(ret){
469  m_fillPayload->setBunchBitsetForBeam2( bunchConfiguration2 );
470  }
471  //execute query for lumiPerBX
472  std::unique_ptr<coral::IQuery> lumiDataQuery(beamCondSchema.newQuery());
473  lumiDataQuery->addToTableList( std::string( "CMS_LHC_LUMIPERBUNCH" ), std::string( "LUMIPERBUNCH\", TABLE( LUMIPERBUNCH.LUMI_BUNCHINST ) \"VALUE" ) );
474  lumiDataQuery->addToOutputList( std::string( "LUMIPERBUNCH.DIPTIME" ), std::string( "DIPTIME" ) );
475  lumiDataQuery->addToOutputList( std::string( "VALUE.COLUMN_VALUE" ), std::string( "LUMI_BUNCH" ) );
476  coral::AttributeList lumiDataBindVariables;
477  lumiDataBindVariables.extend<coral::TimeStamp>( std::string( "beginFillTime" ) );
478  lumiDataBindVariables.extend<coral::TimeStamp>( std::string( "endFillTime" ) );
479  lumiDataBindVariables[ std::string( "beginFillTime" ) ].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
480  lumiDataBindVariables[ std::string( "endFillTime" ) ].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
481  conditionStr = std::string( "DIPTIME BETWEEN :beginFillTime AND :endFillTime" );
482  lumiDataQuery->setCondition( conditionStr, lumiDataBindVariables );
483  lumiDataQuery->addToOrderList( std::string( "DIPTIME" ) );
484  lumiDataQuery->limitReturnedRows(3564); //Maximum number of bunches.
485  //define query output
486  coral::AttributeList lumiDataOutput;
487  lumiDataOutput.extend<coral::TimeStamp>( std::string( "DIPTIME" ) );
488  lumiDataOutput.extend<float>( std::string( "LUMI_BUNCH" ) );
489  lumiDataQuery->defineOutput( lumiDataOutput );
490  //execute the query
491  coral::ICursor& lumiDataCursor = lumiDataQuery->execute();
492 
493  std::vector<float> lumiPerBX;
494  ret = false;
495  lumiSectionTime = 0;
496  while( lumiDataCursor.next() ) {
497  if( m_debug ) {
498  std::ostringstream lpBX;
499  lumiDataCursor.currentRow().toOutputStream( lpBX );
500  }
501  coral::Attribute const & dipTimeAttribute = lumiDataCursor.currentRow()[ std::string( "DIPTIME" ) ];
502  coral::Attribute const & lumiBunchAttribute = lumiDataCursor.currentRow()[ std::string( "LUMI_BUNCH" ) ];
503  if( !dipTimeAttribute.isNull() and !lumiBunchAttribute.isNull() ){
504  ret = true;
505  cond::Time_t dipTime = cond::time::from_boost( dipTimeAttribute.data<coral::TimeStamp>().time() );
506  // assuming only one sample has been selected...
507  float lumi_b = lumiBunchAttribute.data<float>();
508  if( lumiSectionTime == 0 or lumiSectionTime == dipTime){
509  if( lumi_b != 0.00 ) lumiPerBX.push_back( lumi_b );
510  } else break;
511  lumiSectionTime = dipTime;
512  }
513  }
514  if( ret){
515  m_fillPayload->setLumiPerBX( lumiPerBX );
516  }
517  return ret;
518  }
std::unique_ptr< LHCInfo > m_fillPayload
unsigned long long Time_t
Definition: Time.h:16
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:34
coral::ISessionProxy & coralSession()
Definition: Session.cc:236
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 651 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(), LHCInfoImpl::setElementData(), AlCaHLTBitMon_QueryRunRegistry::string, protons_cff::time, and cond::time::to_boost().

Referenced by getNewObjects().

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

Definition at line 243 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by getNewObjects().

244  {
245  // Prepare the WHERE clause
246  coral::AttributeList fillDataBindVariables;
247  fillDataBindVariables.extend<unsigned short>(std::string("fillId"));
248  fillDataBindVariables[ std::string( "fillId")].data<unsigned short>()= fillId;
249  std::string conditionStr = "LHCFILL=:fillId";
250  return LHCInfoImpl::makeFillDataQuery( session, conditionStr, fillDataBindVariables, m_fillPayload, m_debug );
251 }
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 253 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(), ntuplemaker::since, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects().

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

Implements popcon::PopConSourceHandler< LHCInfo >.

Definition at line 816 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, dataset::name, cond::TagInfo_t::name, dataDML::session, 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().

816  {
817  //reference to the last payload in the tag
818  Ref previousFill;
819 
820  //if a new tag is created, transfer fake fill from 1 to the first fill for the first time
821  if ( tagInfo().name.empty() ) {
822  edm::LogInfo( m_name ) << "New tag "<< tagInfo().name << "; from " << m_name << "::getNewObjects";
823  } else {
824  //check what is already inside the database
825  edm::LogInfo( m_name ) << "got info for tag " << tagInfo().name
826  << ", IOVSequence token " << tagInfo().token
827  << ": size " << tagInfo().size
828  << ", last object valid since " << tagInfo().lastInterval.first
829  << " ( "<< boost::posix_time::to_iso_extended_string( cond::time::to_boost( tagInfo().lastInterval.first ) )
830  << " ); from " << m_name << "::getNewObjects";
831  }
832 
833  cond::Time_t lastSince = tagInfo().lastInterval.first;
834  if( lastSince == 0 ){
835  // for a new or empty tag, an empty payload should be added on top with since=1
836  addEmptyPayload( 1 );
837  } else {
838  edm::LogInfo( m_name ) << "The last Iov in tag " << tagInfo().name
839  << " valid since " << lastSince
840  << "from " << m_name << "::getNewObjects";
841  }
842 
843  boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time();
844  cond::Time_t targetSince = 0;
845  cond::Time_t endIov = cond::time::from_boost( executionTime );
846  if( !m_startTime.is_not_a_date_time() ){
847  targetSince = cond::time::from_boost(m_startTime);
848  }
849  if( lastSince > targetSince ) targetSince = lastSince;
850 
851  edm::LogInfo(m_name) <<"Starting sampling at "<<boost::posix_time::to_simple_string(cond::time::to_boost(targetSince));
852 
853  //retrieve the data from the relational database source
855  //configure the connection
856  if( m_debug ) {
857  connection.setMessageVerbosity( coral::Debug );
858  } else {
859  connection.setMessageVerbosity( coral::Error );
860  }
861  connection.setAuthenticationPath( m_authpath );
862  connection.configure();
863  //create the sessions
865  cond::persistency::Session session2 = connection.createSession( m_ecalConnectionString, false );
866  // fetch last payload when available
867  if( !tagInfo().lastPayloadToken.empty() ){
869  session3.transaction().start(true);
871  session3.transaction().commit();
872  }
873 
874  bool iovAdded = false;
875  while( true ){
876  if( targetSince >= endIov ){
877  edm::LogInfo( m_name ) <<"Sampling ended at the time "<<boost::posix_time::to_simple_string(cond::time::to_boost( endIov ));
878  break;
879  }
880  bool updateEcal=false;
881  boost::posix_time::ptime targetTime = cond::time::to_boost( targetSince );
882  boost::posix_time::ptime startSampleTime;
883  boost::posix_time::ptime endSampleTime;
884  if( !m_endFill and m_prevPayload->fillNumber() and m_prevPayload->endTime()==0ULL){
885  // execute the query for the current fill
886  session.transaction().start(true);
887  edm::LogInfo( m_name ) <<"Searching started fill #"<<m_prevPayload->fillNumber();
888  bool foundFill = getFillData( session, m_prevPayload->fillNumber() );
889  session.transaction().commit();
890  if(!foundFill ){
891  edm::LogError( m_name )<<"Could not find fill #"<<m_prevPayload->fillNumber();
892  break;
893  }
894  updateEcal = true;
895  startSampleTime = cond::time::to_boost(lastSince);
896  } else {
897  session.transaction().start(true);
898  edm::LogInfo( m_name ) <<"Searching new fill after "<<boost::posix_time::to_simple_string(targetTime);
899  bool foundFill = getNextFillData( session, targetTime, m_endFill );
900  session.transaction().commit();
901  if ( !foundFill ){
902  edm::LogInfo( m_name )<<"No fill found - END of job.";
903  if( iovAdded ) addEmptyPayload( targetSince );
904  break;
905  }
906  startSampleTime = cond::time::to_boost(m_fillPayload->createTime());
907  }
908  cond::Time_t startFillTime = m_fillPayload->createTime();
909  cond::Time_t endFillTime = m_fillPayload->endTime();
910  unsigned short lhcFill = m_fillPayload->fillNumber();
911  if( endFillTime == 0ULL ){
912  edm::LogInfo( m_name ) <<"Found ongoing fill "<<lhcFill<<" created at "<<cond::time::to_boost(startFillTime);
913  endSampleTime = executionTime;
914  targetSince = endIov;
915  } else {
916  edm::LogInfo( m_name ) <<"Found fill "<<lhcFill<<" created at "<<cond::time::to_boost(startFillTime)<<" ending at "<<cond::time::to_boost(endFillTime);
917  endSampleTime = cond::time::to_boost(endFillTime);
918  targetSince = endFillTime;
919  }
920 
921  session.transaction().start(true);
922  getDipData( session, startSampleTime, endSampleTime );
923  size_t nlumi = getLumiData( session, startSampleTime, endSampleTime );
924  edm::LogInfo( m_name ) <<"Found "<<nlumi<<" lumisections during the fill "<<lhcFill;
925  boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first);
926  boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first);
927  edm::LogInfo( m_name ) <<"First lumi starts at "<<flumiStart<<" last lumi starts at "<<flumiStop;
928  getCTTPSData( session, startSampleTime, endSampleTime );
929  session.transaction().commit();
930  session2.transaction().start(true);
931  getEcalData( session2, startSampleTime, endSampleTime, updateEcal );
932  session2.transaction().commit();
933  //
935  edm::LogInfo( m_name ) <<"Added "<<niovs<<" iovs within the Fill time";
936  m_tmpBuffer.clear();
937  iovAdded = true;
938  //if(m_prevPayload->fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() );
939  if(m_prevPayload->fillNumber() and m_fillPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() );
940  }
941 }
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)
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:22
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:78
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:218
std::shared_ptr< LHCInfo > m_prevPayload
Transaction & transaction()
Definition: Session.cc:66
std::string name
Definition: Types.h:74
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)
bool getDipData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
cond::ValidityInterval lastInterval
Definition: Types.h:76
std::vector< std::shared_ptr< LHCInfo > > m_payloadBuffer
unsigned long long Time_t
Definition: Time.h:16
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:77
void setAuthenticationPath(const std::string &p)
const bool Debug
std::string token
Definition: Types.h:75
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > > m_tmpBuffer
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 229 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by getNewObjects().

231  {
232  // Prepare the WHERE clause
233  coral::AttributeList fillDataBindVariables;
234  fillDataBindVariables.extend<coral::TimeStamp>(std::string("targetTime"));
235  fillDataBindVariables[ std::string( "targetTime")].data<coral::TimeStamp>()= coral::TimeStamp( targetTime + boost::posix_time::seconds(1) );
236  //by imposing BEGINTIME IS NOT NULL, we remove fills which never went into stable beams,
237  //by additionally imposing ENDTIME IS NOT NULL, we select only finished fills
238  std::string conditionStr = "BEGINTIME IS NOT NULL AND CREATETIME > :targetTime AND LHCFILL IS NOT NULL";
239  if( ended ) conditionStr += " AND ENDTIME IS NOT NULL";
240  return LHCInfoImpl::makeFillDataQuery( session, conditionStr, fillDataBindVariables, m_fillPayload, m_debug );
241 }
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 943 of file LHCInfoPopConSourceHandler.cc.

References m_name.

943  {
944  return m_name;
945 }

Member Data Documentation

std::string LHCInfoPopConSourceHandler::m_authpath
private

Definition at line 36 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

std::string LHCInfoPopConSourceHandler::m_connectionString
private

Definition at line 35 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

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

Definition at line 36 of file LHCInfoPopConSourceHandler.h.

Referenced by getDipData().

std::string LHCInfoPopConSourceHandler::m_ecalConnectionString
private

Definition at line 35 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

bool LHCInfoPopConSourceHandler::m_endFill = true
private

Definition at line 32 of file LHCInfoPopConSourceHandler.h.

Referenced by getNewObjects().

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

Definition at line 29 of file LHCInfoPopConSourceHandler.h.

Referenced by LHCInfoPopConSourceHandler().

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

Definition at line 41 of file LHCInfoPopConSourceHandler.h.

Referenced by addEmptyPayload().

std::string LHCInfoPopConSourceHandler::m_name
private

Definition at line 33 of file LHCInfoPopConSourceHandler.h.

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

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

Definition at line 40 of file LHCInfoPopConSourceHandler.h.

Referenced by addEmptyPayload(), and getNewObjects().

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

Definition at line 38 of file LHCInfoPopConSourceHandler.h.

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

unsigned int LHCInfoPopConSourceHandler::m_samplingInterval
private

Definition at line 31 of file LHCInfoPopConSourceHandler.h.

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

Definition at line 28 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 39 of file LHCInfoPopConSourceHandler.h.

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