CMS 3D CMS Logo

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

#include <PayloadInspector.h>

Inheritance diagram for cond::payloadInspector::RunHistoryPlot< PayloadType, Y >:
cond::payloadInspector::Plot2D< PayloadType, std::tuple< float, std::string >, Y > cond::payloadInspector::PlotBase

Public Types

typedef Plot2D< PayloadType, std::tuple< float, 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
 
 RunHistoryPlot (const std::string &title, const std::string &yLabel)
 
 ~RunHistoryPlot () override=default
 
- Public Member Functions inherited from cond::payloadInspector::Plot2D< PayloadType, std::tuple< float, 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< float, std::string >, Y >
std::vector< std::tuple< std::tuple< float, 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::RunHistoryPlot< PayloadType, Y >

Definition at line 284 of file PayloadInspector.h.

Member Typedef Documentation

template<typename PayloadType , typename Y >
typedef Plot2D<PayloadType,std::tuple<float,std::string>,Y > cond::payloadInspector::RunHistoryPlot< PayloadType, Y >::Base

Definition at line 286 of file PayloadInspector.h.

Constructor & Destructor Documentation

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

Definition at line 288 of file PayloadInspector.h.

288  :
289  Base( "RunHistory", title, "iov_since" , yLabel ){
290  }
Plot2D< PayloadType, std::tuple< float, std::string >, Y > Base
template<typename PayloadType , typename Y >
cond::payloadInspector::RunHistoryPlot< PayloadType, Y >::~RunHistoryPlot ( )
overridedefault

Member Function Documentation

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

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

Definition at line 292 of file PayloadInspector.h.

References label, cond::lumiid, jets_cff::payload, writedatasetfile::run, writedatasetfile::runs, ntuplemaker::since, AlCaHLTBitMon_QueryRunRegistry::string, protons_cff::t, cond::timestamp, cond::Tag_t::timeType, cond::time::to_boost(), and DOFs::Y.

292  {
293 
294  // for the lumi iovs we need to count the number of lumisections in every runs
295  std::map<cond::Time_t,unsigned int> runs;
297  if( tagInfo.timeType==cond::lumiid ){
298  for( auto iov : iovs ) {
299  unsigned int run = std::get<0>(iov) >> 32;
300  auto it = runs.find( run );
301  if( it == runs.end() ) it = runs.insert( std::make_pair( run, 0 ) ).first;
302  it->second++;
303  }
304  }
305  unsigned int currentRun = 0;
306  float lumiIndex = 0;
307  unsigned int lumiSize = 0;
308  unsigned int rind = 0;
309  float ind = 0;
310  std::string label("");
311  for( auto iov : iovs ) {
312  unsigned long long since = std::get<0>(iov);
313  // for the lumi iovs we squeeze the lumi section available in the constant run 'slot' of witdth=1
314  if( tagInfo.timeType==cond::lumiid ){
315  unsigned int run = since >> 32;
316  unsigned int lumi = since & 0xFFFFFFFF;
317  if( run != currentRun ) {
318  rind++;
319  lumiIndex = 0;
320  auto it = runs.find( run );
321  if( it == runs.end() ) {
322  // it should never happen
323  return false;
324  }
325  lumiSize = it->second;
326  } else {
327  lumiIndex++;
328  }
329  ind = rind + (lumiIndex/lumiSize);
330  label = std::to_string(run )+" : "+std::to_string(lumi );
331  currentRun = run;
332  } else {
333  ind++;
334  // for the timestamp based iovs, it does not really make much sense to use this plot...
335  if( tagInfo.timeType==cond::timestamp ){
336  boost::posix_time::ptime t = cond::time::to_boost( since );
337  label = boost::posix_time::to_simple_string( t );
338  } else {
339  label = std::to_string(since );
340  }
341  }
342  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
343  if( payload.get() ){
344  Y value = getFromPayload( *payload );
345  Base::m_plotData.push_back( std::make_tuple(std::make_tuple(ind,label),value));
346  }
347  }
348  return true;
349  }
cond::Tag_t getTagInfo(const std::string &tag)
std::vector< std::tuple< std::tuple< float, std::string >, Y > > m_plotData
char const * label
Definition: value.py:1
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
TimeType timeType
Definition: Types.h:65
virtual Y getFromPayload(PayloadType &payload)=0
boost::posix_time::ptime to_boost(Time_t iValue)
template<typename PayloadType , typename Y >
virtual Y cond::payloadInspector::RunHistoryPlot< PayloadType, Y >::getFromPayload ( PayloadType &  payload)
pure virtual