CMS 3D CMS Logo

PayloadInspector.h
Go to the documentation of this file.
1 #ifndef CondCore_Utilities_PayloadInspector_h
2 #define CondCore_Utilities_PayloadInspector_h
3 
6 #include <iostream>
7 
8 #include <string>
9 #include <tuple>
10 #include <vector>
11 #include <boost/uuid/uuid.hpp>
12 #include <boost/uuid/uuid_generators.hpp>
13 #include <boost/uuid/uuid_io.hpp>
14 
15 namespace cond {
16 
17  namespace payloadInspector {
18 
19  // Metadata dictionary
20  struct PlotAnnotations {
21  static constexpr const char* const PLOT_TYPE_K = "type";
22  static constexpr const char* const TITLE_K = "title";
23  static constexpr const char* const PAYLOAD_TYPE_K = "payload_type";
24  static constexpr const char* const INFO_K = "info";
25  static constexpr const char* const XAXIS_K = "x_label";
26  static constexpr const char* const YAXIS_K = "y_label";
27  static constexpr const char* const ZAXIS_K = "z_label";
29  std::string get( const std::string& key ) const;
30  std::map<std::string,std::string> m;
31  bool singleIov = false;
32  bool twoTags = false;
33  };
34 
35  static const char* const JSON_FORMAT_VERSION = "1.0";
36 
37  // Serialize functions
38  template <typename V> std::string serializeValue( const std::string& entryLabel, const V& value ){
39  std::stringstream ss;
40  ss << "\""<<entryLabel<<"\":"<<value;
41  return ss.str();
42  }
43 
44  template <> std::string serializeValue( const std::string& entryLabel, const std::string& value ){
45  std::stringstream ss;
46  ss << "\""<<entryLabel<<"\":\""<<value<<"\"";
47  return ss.str();
48  }
49 
50  // Specialization for the multi-values coordinates ( to support the combined time+runlumi abscissa )
51  template <typename V> std::string serializeValue( const std::string& entryLabel, const std::tuple<V,std::string>& value ){
52  std::stringstream ss;
53  ss << serializeValue( entryLabel, std::get<0>(value) );
54  ss << ", ";
55  ss << serializeValue( entryLabel+"_label", std::get<1>(value) );
56  return ss.str();
57  }
58 
59  // Specialization for the error bars
60  template <typename V> std::string serializeValue( const std::string& entryLabel, const std::pair<V,V>& value ){
61  std::stringstream ss;
62  ss << serializeValue( entryLabel, value.first );
63  ss << ", ";
64  ss << serializeValue( entryLabel+"_err", value.second );
65  return ss.str();
66  }
67 
69  std::stringstream ss;
70  ss <<"\"version\": \""<<JSON_FORMAT_VERSION<<"\",";
71  ss <<"\"annotations\": {";
72  bool first = true;
73  for( auto a: annotations.m ){
74  if ( !first ) ss <<",";
75  ss << "\""<<a.first<<"\":\"" << a.second <<"\"";
76  first = false;
77  }
78  ss <<"}";
79  return ss.str();
80  }
81 
82  template <typename X,typename Y> std::string serialize( const PlotAnnotations& annotations, const std::vector<std::tuple<X,Y> >& data ){
83  // prototype implementation...
84  std::stringstream ss;
85  ss << "{";
86  ss << serializeAnnotations( annotations );
87  ss <<",";
88  ss << "\"data\": [";
89  bool first = true;
90  for ( auto d : data ){
91  if( !first ) ss <<",";
92  ss <<" { "<<serializeValue("x",std::get<0>(d))<<", "<<serializeValue( "y",std::get<1>( d))<<" }";
93  first = false;
94  }
95  ss << "]";
96  ss << "}";
97  return ss.str();
98  }
99 
100  template <typename X,typename Y,typename Z> std::string serialize( const PlotAnnotations& annotations, const std::vector<std::tuple<X,Y,Z> >& data ){
101  // prototype implementation...
102  std::stringstream ss;
103  ss << "{";
104  ss << serializeAnnotations( annotations );
105  ss <<",";
106  ss << "\"data\": [";
107  bool first = true;
108  for ( auto d : data ){
109  if( !first ) ss <<",";
110  ss <<" { "<<serializeValue("x",std::get<0>(d))<<", "<<serializeValue( "y",std::get<1>( d))<<", "<<serializeValue( "z",std::get<2>( d))<<" }";
111  first = false;
112  }
113  ss << "]";
114  ss << "}";
115  return ss.str();
116  }
117 
118  std::string serialize( const PlotAnnotations& annotations, const std::string& imageFileName ){
119  std::stringstream ss;
120  ss << "{";
121  ss << serializeAnnotations( annotations );
122  ss <<",";
123  ss << "\"file\": \""<<imageFileName<<"\"";
124  ss << "}";
125  return ss.str();
126  }
127 
128  struct ModuleVersion {
129  static constexpr const char* const label = "1.0";
130  };
131 
132  // Base class, factorizing the functions exposed in the python interface
133  class PlotBase {
134  public:
135  PlotBase();
136  virtual ~PlotBase() = default;
137  // required in the browser to find corresponding tags
138  std::string payloadType() const;
139 
140  // required in the browser
141  std::string title() const;
142 
143  // required in the browser
144  std::string type() const;
145 
146  // required in the browser
147  bool isSingleIov() const;
148 
149  // required in the browser
150  bool isTwoTags() const;
151 
152  // returns the json file with the plot data
153  std::string data() const;
154 
155  // triggers the processing producing the plot
156  bool process( const std::string& connectionString, const std::string& tag, const std::string& timeType, cond::Time_t begin, cond::Time_t end );
157  //bool process( const std::string& connectionString, const std::string& tag, cond::Time_t begin, cond::Time_t end );
158 
159  bool processTwoTags( const std::string& connectionString, const std::string& tag0, const std::string& tag1, cond::Time_t time0, cond::Time_t time1 );
160 
161  // not exposed in python:
162  // called internally in process()
163  virtual void init();
164 
165  // not exposed in python:
166  // called internally in process()
167  virtual std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs );
168 
169  // to be set in order to limit the iov selection ( and processing ) to 1 iov
170  void setSingleIov( bool flag );
171 
172  void setTwoTags( bool flag );
173 
174  // access to the fetch function of the configured reader, to be used in the processData implementations
175  template <typename PayloadType> std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
176  return m_dbSession.fetchPayload<PayloadType>( payloadHash );
177  }
178 
179  cond::Tag_t getTagInfo( const std::string& tag );
180 
181  // access to the timeType of the tag in process
182  //cond::TimeType tagTimeType() const;
183 
184  // access to the underlying db session
185  cond::persistency::Session dbSession();
186 
187  protected:
188 
190  std::string m_tag0 = "";
191  std::string m_tag1 = "";
192 
193  private:
194 
196  //cond::TimeType m_tagTimeType;
197 
198  std::string m_data = "";
199  };
200 
201  // Concrete plot-types implementations
202  template <typename PayloadType, typename X, typename Y> class Plot2D : public PlotBase {
203  public:
204  Plot2D( const std::string& type, const std::string& title, const std::string xLabel, const std::string& yLabel ) :
205  PlotBase(),m_plotData(){
206  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = type;
207  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
208  m_plotAnnotations.m[PlotAnnotations::XAXIS_K] = xLabel;
209  m_plotAnnotations.m[PlotAnnotations::YAXIS_K] = yLabel;
210  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = cond::demangledName( typeid(PayloadType) );
211  }
212  ~Plot2D() override = default;
214  return serialize( m_plotAnnotations, m_plotData);
215  }
216 
217  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
218  fill( iovs );
219  return serializeData();
220  }
221 
222  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
223  return PlotBase::fetchPayload<PayloadType>( payloadHash );
224  }
225 
226  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
227  protected:
228  std::vector<std::tuple<X,Y> > m_plotData;
229  };
230 
231  template <typename PayloadType, typename X, typename Y, typename Z> class Plot3D : public PlotBase {
232  public:
233  Plot3D( const std::string& type, const std::string& title, const std::string xLabel, const std::string& yLabel, const std::string& zLabel ) :
234  PlotBase(),m_plotData(){
235  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = type;
236  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
237  m_plotAnnotations.m[PlotAnnotations::XAXIS_K] = xLabel;
238  m_plotAnnotations.m[PlotAnnotations::YAXIS_K] = yLabel;
239  m_plotAnnotations.m[PlotAnnotations::ZAXIS_K] = zLabel;
240  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = cond::demangledName( typeid(PayloadType) );
241  }
242  ~Plot3D() override = default;
244  return serialize( m_plotAnnotations, m_plotData);
245  }
246 
247  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
248  fill( iovs );
249  return serializeData();
250  }
251 
252  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
253  return PlotBase::fetchPayload<PayloadType>( payloadHash );
254  }
255 
256  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
257  protected:
258  std::vector<std::tuple<X,Y,Z> > m_plotData;
259  };
260 
261  template<typename PayloadType, typename Y> class HistoryPlot : public Plot2D<PayloadType,unsigned long long,Y > {
262  public:
264 
265  HistoryPlot( const std::string& title, const std::string& yLabel ) :
266  Base( "History", title, "iov_since" , yLabel ){
267  }
268  ~HistoryPlot() override = default;
269  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
270  for( auto iov : iovs ) {
271  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
272  if( payload.get() ){
273  Y value = getFromPayload( *payload );
274  Base::m_plotData.push_back( std::make_tuple(std::get<0>(iov),value));
275  }
276  }
277  return true;
278  }
279 
280  virtual Y getFromPayload( PayloadType& payload ) = 0;
281 
282  };
283 
284  template<typename PayloadType, typename Y> class RunHistoryPlot : public Plot2D<PayloadType,std::tuple<float,std::string>,Y > {
285  public:
287 
288  RunHistoryPlot( const std::string& title, const std::string& yLabel ) :
289  Base( "RunHistory", title, "iov_since" , yLabel ){
290  }
291  ~RunHistoryPlot() override = default;
292  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
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;
296  cond::Tag_t tagInfo = Base::getTagInfo( Base::m_tag0 );
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  }
350 
351  virtual Y getFromPayload( PayloadType& payload ) = 0;
352 
353  };
354 
355  template<typename PayloadType, typename Y> class TimeHistoryPlot : public Plot2D<PayloadType,std::tuple<unsigned long long,std::string>,Y > {
356  public:
358 
359  TimeHistoryPlot( const std::string& title, const std::string& yLabel ) :
360  Base( "TimeHistory", title, "iov_since" , yLabel ){
361  }
362  ~TimeHistoryPlot() override = default;
363  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
365  cond::Tag_t tagInfo = Base::getTagInfo( Base::m_tag0 );
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  }
406 
407  virtual Y getFromPayload( PayloadType& payload ) = 0;
408 
409  };
410 
411  template<typename PayloadType, typename X, typename Y> class ScatterPlot : public Plot2D<PayloadType,X,Y > {
412  public:
414  // the x axis label will be overwritten by the plot rendering application
415  ScatterPlot( const std::string& title, const std::string& xLabel, const std::string& yLabel ) :
416  Base( "Scatter", title, xLabel , yLabel ){
417  }
418  ~ScatterPlot() override = default;
419  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
420  for( auto iov : iovs ) {
421  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
422  if( payload.get() ){
423  std::tuple<X,Y> value = getFromPayload( *payload );
424  Base::m_plotData.push_back( value );
425  }
426  }
427  return true;
428  }
429 
430  virtual std::tuple<X,Y> getFromPayload( PayloadType& payload ) = 0;
431 
432  };
433 
434  //
435  template<typename PayloadType> class Histogram1D: public Plot2D<PayloadType,float,float > {
436  public:
438  // naive implementation, essentially provided as an example...
439  Histogram1D( const std::string& title, const std::string& xLabel, size_t nbins, float min, float max, const std::string& yLabel="entries"):
440  Base( "Histo1D", title, xLabel , yLabel),m_nbins(nbins),m_min(min),m_max(max){
441  }
442  ~Histogram1D() override = default;
443  //
444  void init() override{
445  Base::m_plotData.clear();
446  float binSize = (m_max-m_min)/m_nbins;
447  if( binSize>0 ){
448  m_binSize = binSize;
449  Base::m_plotData.resize( m_nbins );
450  for( size_t i=0;i<m_nbins;i++ ){
451  Base::m_plotData[i] = std::make_tuple( m_min+i*m_binSize, 0 );
452  }
453  }
454  }
455 
456  // to be used to fill the histogram!
457  void fillWithValue( float value, float weight=1 ){
458  // ignoring underflow/overflows ( they can be easily added - the total entries as well )
459  if( !Base::m_plotData.empty() && (value < m_max) && (value >= m_min) ){
460  size_t ibin = (value-m_min)/m_binSize;
461  std::get<1>(Base::m_plotData[ibin])+=weight;
462  }
463  }
464 
465  // to be used to fill the histogram!
466  void fillWithBinAndValue( size_t bin, float weight=1 ){
467  if(bin>=0 && bin<Base::m_plotData.size()){
468  std::get<1>(Base::m_plotData[bin])=weight;
469  }
470  }
471 
472  // this one can ( and in general should ) be overridden - the implementation should use fillWithValue
473  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
474  for( auto iov : iovs ) {
475  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
476  if( payload.get() ){
477  float value = getFromPayload( *payload );
478  fillWithValue( value );
479  }
480  }
481  return true;
482  }
483 
484  // implement this one if you use the default fill implementation, otherwise ignore it...
485  virtual float getFromPayload( PayloadType& payload ) {
486  return 0;
487  }
488 
489  private:
490  float m_binSize = 0;
491  size_t m_nbins;
492  float m_min;
493  float m_max;
494  };
495 
496  //
497  template<typename PayloadType> class Histogram2D: public Plot3D<PayloadType,float,float,float > {
498  public:
500  // naive implementation, essentially provided as an example...
501  Histogram2D( const std::string& title, const std::string& xLabel, size_t nxbins, float xmin, float xmax,
502  const std::string& yLabel, size_t nybins, float ymin, float ymax ):
503  Base( "Histo2D", title, xLabel , yLabel, "entries" ),m_nxbins( nxbins), m_xmin(xmin),m_xmax(xmax),m_nybins(nybins),m_ymin(ymin),m_ymax(ymax){
504  }
505 
506  ~Histogram2D() override = default;
507  //
508  void init() override{
509  Base::m_plotData.clear();
510  float xbinSize = (m_xmax-m_xmin)/m_nxbins;
511  float ybinSize = (m_ymax-m_ymin)/m_nybins;
512  if( xbinSize>0 && ybinSize>0){
513  m_xbinSize = xbinSize;
514  m_ybinSize = ybinSize;
515  Base::m_plotData.resize( m_nxbins*m_nybins );
516  for( size_t i=0;i<m_nybins;i++ ){
517  for( size_t j=0;j<m_nxbins;j++ ){
518  Base::m_plotData[i*m_nxbins+j] = std::make_tuple( m_xmin+j*m_xbinSize, m_ymin+i*m_ybinSize, 0 );
519  }
520  }
521  }
522  }
523 
524  // to be used to fill the histogram!
525  void fillWithValue( float xvalue, float yvalue, float weight=1 ){
526  // ignoring underflow/overflows ( they can be easily added - the total entries as well )
527  if( !Base::m_plotData.empty() && xvalue < m_xmax && xvalue >= m_xmin && yvalue < m_ymax && yvalue >= m_ymin ){
528  size_t ixbin = (xvalue-m_xmin)/m_xbinSize;
529  size_t iybin = (yvalue-m_ymin)/m_ybinSize;
530  std::get<2>(Base::m_plotData[iybin*m_nxbins+ixbin])+=weight;
531  }
532  }
533 
534  // this one can ( and in general should ) be overridden - the implementation should use fillWithValue
535  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
536  for( auto iov : iovs ) {
537  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
538  if( payload.get() ){
539  std::tuple<float,float> value = getFromPayload( *payload );
540  fillWithValue( std::get<0>(value),std::get<1>(value) );
541  }
542  }
543  return true;
544  }
545 
546  // implement this one if you use the default fill implementation, otherwise ignore it...
547  virtual std::tuple<float,float> getFromPayload( PayloadType& payload ) {
548  float x = 0;
549  float y = 0;
550  return std::make_tuple(x,y);
551  }
552 
553  private:
554  size_t m_nxbins;
555  float m_xbinSize = 0;
556  float m_xmin;
557  float m_xmax;
558  float m_ybinSize = 0;
559  size_t m_nybins;
560  float m_ymin;
561  float m_ymax;
562  };
563 
564  //
565  template <typename PayloadType> class PlotImage : public PlotBase {
566  public:
567  explicit PlotImage( const std::string& title ) :
568  PlotBase(){
569  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = "Image";
570  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
571  std::string payloadTypeName = cond::demangledName( typeid(PayloadType) );
572  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = payloadTypeName;
573  m_imageFileName = boost::lexical_cast<std::string>( ( boost::uuids::random_generator())() )+".png";
574  }
575 
577  return serialize( m_plotAnnotations, m_imageFileName);
578  }
579 
580  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
581  fill( iovs );
582  return serializeData();
583  }
584 
585  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
586  return PlotBase::fetchPayload<PayloadType>( payloadHash );
587  }
588 
589  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
590  protected:
592  };
593 
594  }
595 
596 }
597 
598 #endif
599 
size
Write out results.
type
Definition: HCALResponse.h:21
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
double seconds()
const boost::posix_time::ptime time0
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
Plot3D< PayloadType, float, float, float > Base
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
int init
Definition: HydjetWrapper.h:67
std::vector< std::tuple< X, Y, Z > > m_plotData
Plot2D< PayloadType, unsigned long long, Y > Base
Definition: weight.py:1
static const char *const JSON_FORMAT_VERSION
void fillWithValue(float xvalue, float yvalue, float weight=1)
std::map< std::string, std::string > m
std::vector< std::tuple< X, Y > > m_plotData
ScatterPlot(const std::string &title, const std::string &xLabel, const std::string &yLabel)
virtual float getFromPayload(PayloadType &payload)
char const * label
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
std::string processData(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
unsigned long long Time_t
Definition: Time.h:16
std::string serializeValue(const std::string &entryLabel, const V &value)
Plot2D< PayloadType, X, Y > Base
std::string processData(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
std::string Hash
Definition: Types.h:45
RunHistoryPlot(const std::string &title, const std::string &yLabel)
Plot2D< PayloadType, float, float > Base
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
#define end
Definition: vmac.h:39
std::string serialize(const PlotAnnotations &annotations, const std::vector< std::tuple< X, Y > > &data)
Definition: value.py:1
void fillWithValue(float value, float weight=1)
T min(T a, T b)
Definition: MathUtil.h:58
Time_t from_boost(boost::posix_time::ptime bt)
static const char *const PAYLOAD_TYPE_K
const unsigned int SECONDS_PER_LUMI(23)
bin
set the eta bin as selection string.
Plot3D(const std::string &type, const std::string &title, const std::string xLabel, const std::string &yLabel, const std::string &zLabel)
Histogram1D(const std::string &title, const std::string &xLabel, size_t nbins, float min, float max, const std::string &yLabel="entries")
void fillWithBinAndValue(size_t bin, float weight=1)
std::string processData(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Plot2D< PayloadType, std::tuple< float, std::string >, Y > Base
TimeHistoryPlot(const std::string &title, const std::string &yLabel)
TimeType timeType
Definition: Types.h:65
Iterator find(Time_t target) const
virtual std::tuple< float, float > getFromPayload(PayloadType &payload)
HistoryPlot(const std::string &title, const std::string &yLabel)
std::string serializeAnnotations(const PlotAnnotations &annotations)
Histogram2D(const std::string &title, const std::string &xLabel, size_t nxbins, float xmin, float xmax, const std::string &yLabel, size_t nybins, float ymin, float ymax)
Definition: plugin.cc:24
#define begin
Definition: vmac.h:32
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
cond::persistency::Session m_dbSession
double a
Definition: hdecay.h:121
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Plot2D< PayloadType, std::tuple< unsigned long long, std::string >, Y > Base
Plot2D(const std::string &type, const std::string &title, const std::string xLabel, const std::string &yLabel)
boost::posix_time::ptime to_boost(Time_t iValue)
#define constexpr
PlotImage(const std::string &title)