CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
cond::payloadInspector::TimeHistoryPlot< PayloadType, Y > Class Template Referenceabstract

#include <PayloadInspector.h>

Inheritance diagram for cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >:
cond::payloadInspector::Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y > cond::payloadInspector::PlotBase

Public Types

typedef Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y > Base
 

Public Member Functions

bool fill (const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
 
virtual Y getFromPayload (PayloadType &payload)=0
 
 TimeHistoryPlot (const std::string &title, const std::string &yLabel)
 
 ~TimeHistoryPlot () override=default
 
- Public Member Functions inherited from cond::payloadInspector::Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
 Plot2D (const std::string &type, const std::string &title, const std::string xLabel, const std::string &yLabel)
 
std::string processData (const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
 
std::string serializeData ()
 
 ~Plot2D () override=default
 
- Public Member Functions inherited from cond::payloadInspector::PlotBase
std::string data () const
 
cond::persistency::Session dbSession ()
 
template<typename PayloadType >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
cond::Tag_t getTagInfo (const std::string &tag)
 
virtual void init ()
 
bool isSingleIov () const
 
bool isTwoTags () const
 
std::string payloadType () const
 
 PlotBase ()
 
bool process (const std::string &connectionString, const std::string &tag, const std::string &timeType, cond::Time_t begin, cond::Time_t end)
 
bool processTwoTags (const std::string &connectionString, const std::string &tag0, const std::string &tag1, cond::Time_t time0, cond::Time_t time1)
 
void setSingleIov (bool flag)
 
void setTwoTags (bool flag)
 
std::string title () const
 
std::string type () const
 
virtual ~PlotBase ()=default
 

Additional Inherited Members

- Protected Attributes inherited from cond::payloadInspector::Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y >
std::vector< std::tuple< std::tuple< unsigned long long, std::string >, Y > > m_plotData
 
- Protected Attributes inherited from cond::payloadInspector::PlotBase
PlotAnnotations m_plotAnnotations
 
std::string m_tag0 = ""
 
std::string m_tag1 = ""
 

Detailed Description

template<typename PayloadType, typename Y>
class cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >

Definition at line 355 of file PayloadInspector.h.

Member Typedef Documentation

template<typename PayloadType , typename Y >
typedef Plot2D<PayloadType,std::tuple<unsigned long long,std::string>,Y > cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::Base

Definition at line 357 of file PayloadInspector.h.

Constructor & Destructor Documentation

template<typename PayloadType , typename Y >
cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::TimeHistoryPlot ( const std::string &  title,
const std::string &  yLabel 
)
inline

Definition at line 359 of file PayloadInspector.h.

359  :
360  Base( "TimeHistory", title, "iov_since" , yLabel ){
361  }
Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y > Base
template<typename PayloadType , typename Y >
cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::~TimeHistoryPlot ( )
overridedefault

Member Function Documentation

template<typename PayloadType , typename Y >
bool cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::fill ( const std::vector< std::tuple< cond::Time_t, cond::Hash > > &  iovs)
inlineoverridevirtual

Implements cond::payloadInspector::Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y >.

Definition at line 363 of file PayloadInspector.h.

References cond::persistency::RunInfoProxy::end(), cond::persistency::RunInfoProxy::find(), cond::time::from_boost(), label, cond::lumiid, SiStripPI::max, min(), jets_cff::payload, cond::runnumber, seconds(), cond::time::SECONDS_PER_LUMI(), ntuplemaker::since, AlCaHLTBitMon_QueryRunRegistry::string, protons_cff::time, cond::timestamp, cond::Tag_t::timeType, cond::time::to_boost(), and DOFs::Y.

363  {
366  if( tagInfo.timeType==cond::lumiid || tagInfo.timeType==cond::runnumber){
367  cond::Time_t min = std::get<0>(iovs.front());
368  cond::Time_t max = std::get<0>( iovs.back() );
369  if( tagInfo.timeType==cond::lumiid ){
370  min = min >> 32;
371  max = max >> 32;
372  }
373  runInfo = Base::dbSession().getRunInfo( min, max );
374  }
375  for( auto iov : iovs ) {
376  cond::Time_t since = std::get<0>(iov);
377  boost::posix_time::ptime time;
378  std::string label("");
379  if( tagInfo.timeType==cond::lumiid || tagInfo.timeType==cond::runnumber){
380  unsigned int nlumi = since & 0xFFFFFFFF;
381  if( tagInfo.timeType==cond::lumiid ) since = since >> 32;
382  label = std::to_string(since );
383  auto it = runInfo.find( since );
384  if ( it == runInfo.end() ){
385  // this should never happen...
386  return false;
387  }
388  time = (*it).start;
389  // add the lumi sections...
390  if( tagInfo.timeType==cond::lumiid ){
392  label += (" : "+std::to_string(nlumi ) );
393  }
394  } else if ( tagInfo.timeType==cond::timestamp ){
395  time = cond::time::to_boost( since );
396  label = boost::posix_time::to_simple_string( time );
397  }
398  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
399  if( payload.get() ){
400  Y value = getFromPayload( *payload );
401  Base::m_plotData.push_back( std::make_tuple(std::make_tuple( cond::time::from_boost(time),label),value));
402  }
403  }
404  return true;
405  }
cond::Tag_t getTagInfo(const std::string &tag)
double seconds()
cond::persistency::Session dbSession()
std::vector< std::tuple< std::tuple< unsigned long long, std::string >, Y > > m_plotData
char const * label
unsigned long long Time_t
Definition: Time.h:16
virtual Y getFromPayload(PayloadType &payload)=0
Definition: value.py:1
T min(T a, T b)
Definition: MathUtil.h:58
Time_t from_boost(boost::posix_time::ptime bt)
const unsigned int SECONDS_PER_LUMI(23)
TimeType timeType
Definition: Types.h:65
Iterator find(Time_t target) const
boost::posix_time::ptime to_boost(Time_t iValue)
RunInfoProxy getRunInfo(cond::Time_t start, cond::Time_t end)
Definition: Session.cc:218
template<typename PayloadType , typename Y >
virtual Y cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::getFromPayload ( PayloadType &  payload)
pure virtual