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/python/list.hpp>
12 #include <boost/python/extract.hpp>
13 #include <boost/uuid/uuid.hpp>
14 #include <boost/uuid/uuid_generators.hpp>
15 #include <boost/uuid/uuid_io.hpp>
16 
17 namespace cond {
18 
19  namespace payloadInspector {
20 
21  // Metadata dictionary
22  struct PlotAnnotations {
23  static constexpr const char* const PLOT_TYPE_K = "type";
24  static constexpr const char* const TITLE_K = "title";
25  static constexpr const char* const PAYLOAD_TYPE_K = "payload_type";
26  static constexpr const char* const INFO_K = "info";
27  static constexpr const char* const XAXIS_K = "x_label";
28  static constexpr const char* const YAXIS_K = "y_label";
29  static constexpr const char* const ZAXIS_K = "z_label";
31  std::string get( const std::string& key ) const;
32  std::map<std::string,std::string> m;
33  bool singleIov = false;
34  };
35 
36  static const char* const JSON_FORMAT_VERSION = "1.0";
37 
38  // Serialize functions
39  template <typename V> std::string serializeValue( const std::string& entryLabel, const V& value ){
40  std::stringstream ss;
41  ss << "\""<<entryLabel<<"\":"<<value;
42  return ss.str();
43  }
44 
45  template <> std::string serializeValue( const std::string& entryLabel, const std::string& value ){
46  std::stringstream ss;
47  ss << "\""<<entryLabel<<"\":\""<<value<<"\"";
48  return ss.str();
49  }
50 
51  // Specialization for the multi-values coordinates ( to support the combined time+runlumi abscissa )
52  template <typename V> std::string serializeValue( const std::string& entryLabel, const std::tuple<V,std::string>& value ){
53  std::stringstream ss;
54  ss << serializeValue( entryLabel, std::get<0>(value) );
55  ss << ", ";
56  ss << serializeValue( entryLabel+"_label", std::get<1>(value) );
57  return ss.str();
58  }
59 
60  // Specialization for the error bars
61  template <typename V> std::string serializeValue( const std::string& entryLabel, const std::pair<V,V>& value ){
62  std::stringstream ss;
63  ss << serializeValue( entryLabel, value.first );
64  ss << ", ";
65  ss << serializeValue( entryLabel+"_err", value.second );
66  return ss.str();
67  }
68 
70  std::stringstream ss;
71  ss <<"\"version\": \""<<JSON_FORMAT_VERSION<<"\",";
72  ss <<"\"annotations\": {";
73  bool first = true;
74  for( auto a: annotations.m ){
75  if ( !first ) ss <<",";
76  ss << "\""<<a.first<<"\":\"" << a.second <<"\"";
77  first = false;
78  }
79  ss <<"}";
80  return ss.str();
81  }
82 
83  template <typename X,typename Y> std::string serialize( const PlotAnnotations& annotations, const std::vector<std::tuple<X,Y> >& data ){
84  // prototype implementation...
85  std::stringstream ss;
86  ss << "{";
87  ss << serializeAnnotations( annotations );
88  ss <<",";
89  ss << "\"data\": [";
90  bool first = true;
91  for ( auto d : data ){
92  if( !first ) ss <<",";
93  ss <<" { "<<serializeValue("x",std::get<0>(d))<<", "<<serializeValue( "y",std::get<1>( d))<<" }";
94  first = false;
95  }
96  ss << "]";
97  ss << "}";
98  return ss.str();
99  }
100 
101  template <typename X,typename Y,typename Z> std::string serialize( const PlotAnnotations& annotations, const std::vector<std::tuple<X,Y,Z> >& data ){
102  // prototype implementation...
103  std::stringstream ss;
104  ss << "{";
105  ss << serializeAnnotations( annotations );
106  ss <<",";
107  ss << "\"data\": [";
108  bool first = true;
109  for ( auto d : data ){
110  if( !first ) ss <<",";
111  ss <<" { "<<serializeValue("x",std::get<0>(d))<<", "<<serializeValue( "y",std::get<1>( d))<<", "<<serializeValue( "z",std::get<2>( d))<<" }";
112  first = false;
113  }
114  ss << "]";
115  ss << "}";
116  return ss.str();
117  }
118 
119  std::string serialize( const PlotAnnotations& annotations, const std::string& imageFileName ){
120  std::stringstream ss;
121  ss << "{";
122  ss << serializeAnnotations( annotations );
123  ss <<",";
124  ss << "\"file\": \""<<imageFileName<<"\"";
125  ss << "}";
126  return ss.str();
127  }
128 
129  struct ModuleVersion {
130  static constexpr const char* const label = "1.0";
131  };
132 
133  // Base class, factorizing the functions exposed in the python interface
134  class PlotBase {
135  public:
136  PlotBase();
137  virtual ~PlotBase() = default;
138  // required in the browser to find corresponding tags
139  std::string payloadType() const;
140 
141  // required in the browser
142  std::string title() const;
143 
144  // required in the browser
145  std::string type() const;
146 
147  // required in the browser
148  bool isSingleIov() const;
149 
150  // returns the json file with the plot data
151  std::string data() const;
152 
153  // triggers the processing producing the plot
154  bool process( const std::string& connectionString, const std::string& tag, const std::string& timeType, cond::Time_t begin, cond::Time_t end );
155 
156  // not exposed in python:
157  // called internally in process()
158  virtual void init();
159 
160  // not exposed in python:
161  // called internally in process()
162  virtual std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs );
163 
164  // to be set in order to limit the iov selection ( and processing ) to 1 iov
165  void setSingleIov( bool flag );
166 
167  // access to the fetch function of the configured reader, to be used in the processData implementations
168  template <typename PayloadType> std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
169  return m_dbSession.fetchPayload<PayloadType>( payloadHash );
170  }
171 
172  // access to the timeType of the tag in process
173  cond::TimeType tagTimeType() const;
174 
175  // access to the underlying db session
176  cond::persistency::Session dbSession();
177 
178  protected:
179 
181 
182  private:
183 
186 
187  std::string m_data = "";
188  };
189 
190  // Concrete plot-types implementations
191  template <typename PayloadType, typename X, typename Y> class Plot2D : public PlotBase {
192  public:
193  Plot2D( const std::string& type, const std::string& title, const std::string xLabel, const std::string& yLabel ) :
194  PlotBase(),m_plotData(){
195  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = type;
196  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
197  m_plotAnnotations.m[PlotAnnotations::XAXIS_K] = xLabel;
198  m_plotAnnotations.m[PlotAnnotations::YAXIS_K] = yLabel;
199  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = cond::demangledName( typeid(PayloadType) );
200  }
201  ~Plot2D() override = default;
203  return serialize( m_plotAnnotations, m_plotData);
204  }
205 
206  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
207  fill( iovs );
208  return serializeData();
209  }
210 
211  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
212  return PlotBase::fetchPayload<PayloadType>( payloadHash );
213  }
214 
215  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
216  protected:
217  std::vector<std::tuple<X,Y> > m_plotData;
218  };
219 
220  template <typename PayloadType, typename X, typename Y, typename Z> class Plot3D : public PlotBase {
221  public:
222  Plot3D( const std::string& type, const std::string& title, const std::string xLabel, const std::string& yLabel, const std::string& zLabel ) :
223  PlotBase(),m_plotData(){
224  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = type;
225  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
226  m_plotAnnotations.m[PlotAnnotations::XAXIS_K] = xLabel;
227  m_plotAnnotations.m[PlotAnnotations::YAXIS_K] = yLabel;
228  m_plotAnnotations.m[PlotAnnotations::ZAXIS_K] = zLabel;
229  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = cond::demangledName( typeid(PayloadType) );
230  }
231  ~Plot3D() override = default;
233  return serialize( m_plotAnnotations, m_plotData);
234  }
235 
236  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
237  fill( iovs );
238  return serializeData();
239  }
240 
241  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
242  return PlotBase::fetchPayload<PayloadType>( payloadHash );
243  }
244 
245  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
246  protected:
247  std::vector<std::tuple<X,Y,Z> > m_plotData;
248  };
249 
250  template<typename PayloadType, typename Y> class HistoryPlot : public Plot2D<PayloadType,unsigned long long,Y > {
251  public:
253 
254  HistoryPlot( const std::string& title, const std::string& yLabel ) :
255  Base( "History", title, "iov_since" , yLabel ){
256  }
257  ~HistoryPlot() override = default;
258  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
259  for( auto iov : iovs ) {
260  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
261  if( payload.get() ){
262  Y value = getFromPayload( *payload );
263  Base::m_plotData.push_back( std::make_tuple(std::get<0>(iov),value));
264  }
265  }
266  return true;
267  }
268 
269  virtual Y getFromPayload( PayloadType& payload ) = 0;
270 
271  };
272 
273  template<typename PayloadType, typename Y> class RunHistoryPlot : public Plot2D<PayloadType,std::tuple<float,std::string>,Y > {
274  public:
276 
277  RunHistoryPlot( const std::string& title, const std::string& yLabel ) :
278  Base( "RunHistory", title, "iov_since" , yLabel ){
279  }
280  ~RunHistoryPlot() override = default;
281  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
282  // for the lumi iovs we need to count the number of lumisections in every runs
283  std::map<cond::Time_t,unsigned int> runs;
284  if( Base::tagTimeType()==cond::lumiid ){
285  for( auto iov : iovs ) {
286  unsigned int run = std::get<0>(iov) >> 32;
287  auto it = runs.find( run );
288  if( it == runs.end() ) it = runs.insert( std::make_pair( run, 0 ) ).first;
289  it->second++;
290  }
291  }
292  unsigned int currentRun = 0;
293  float lumiIndex = 0;
294  unsigned int lumiSize = 0;
295  unsigned int rind = 0;
296  float ind = 0;
297  std::string label("");
298  for( auto iov : iovs ) {
299  unsigned long long since = std::get<0>(iov);
300  // for the lumi iovs we squeeze the lumi section available in the constant run 'slot' of witdth=1
301  if( Base::tagTimeType()==cond::lumiid ){
302  unsigned int run = since >> 32;
303  unsigned int lumi = since & 0xFFFFFFFF;
304  if( run != currentRun ) {
305  rind++;
306  lumiIndex = 0;
307  auto it = runs.find( run );
308  if( it == runs.end() ) {
309  // it should never happen
310  return false;
311  }
312  lumiSize = it->second;
313  } else {
314  lumiIndex++;
315  }
316  ind = rind + (lumiIndex/lumiSize);
317  label = std::to_string(run )+" : "+std::to_string(lumi );
318  currentRun = run;
319  } else {
320  ind++;
321  // for the timestamp based iovs, it does not really make much sense to use this plot...
322  if( Base::tagTimeType()==cond::timestamp ){
323  boost::posix_time::ptime t = cond::time::to_boost( since );
324  label = boost::posix_time::to_simple_string( t );
325  } else {
326  label = std::to_string(since );
327  }
328  }
329  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
330  if( payload.get() ){
331  Y value = getFromPayload( *payload );
332  Base::m_plotData.push_back( std::make_tuple(std::make_tuple(ind,label),value));
333  }
334  }
335  return true;
336  }
337 
338  virtual Y getFromPayload( PayloadType& payload ) = 0;
339 
340  };
341 
342  template<typename PayloadType, typename Y> class TimeHistoryPlot : public Plot2D<PayloadType,std::tuple<unsigned long long,std::string>,Y > {
343  public:
345 
346  TimeHistoryPlot( const std::string& title, const std::string& yLabel ) :
347  Base( "TimeHistory", title, "iov_since" , yLabel ){
348  }
349  ~TimeHistoryPlot() override = default;
350  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
352  if( Base::tagTimeType()==cond::lumiid || Base::tagTimeType()==cond::runnumber){
353  cond::Time_t min = std::get<0>(iovs.front());
354  cond::Time_t max = std::get<0>( iovs.back() );
355  if( Base::tagTimeType()==cond::lumiid ){
356  min = min >> 32;
357  max = max >> 32;
358  }
359  runInfo = Base::dbSession().getRunInfo( min, max );
360  }
361  for( auto iov : iovs ) {
362  cond::Time_t since = std::get<0>(iov);
363  boost::posix_time::ptime time;
364  std::string label("");
365  if( Base::tagTimeType()==cond::lumiid || Base::tagTimeType()==cond::runnumber){
366  unsigned int nlumi = since & 0xFFFFFFFF;
367  if( Base::tagTimeType()==cond::lumiid ) since = since >> 32;
368  label = std::to_string(since );
369  auto it = runInfo.find( since );
370  if ( it == runInfo.end() ){
371  // this should never happen...
372  return false;
373  }
374  time = (*it).start;
375  // add the lumi sections...
376  if( Base::tagTimeType()==cond::lumiid ){
378  label += (" : "+std::to_string(nlumi ) );
379  }
380  } else if ( Base::tagTimeType()==cond::timestamp ){
381  time = cond::time::to_boost( since );
382  label = boost::posix_time::to_simple_string( time );
383  }
384  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
385  if( payload.get() ){
386  Y value = getFromPayload( *payload );
387  Base::m_plotData.push_back( std::make_tuple(std::make_tuple( cond::time::from_boost(time),label),value));
388  }
389  }
390  return true;
391  }
392 
393  virtual Y getFromPayload( PayloadType& payload ) = 0;
394 
395  };
396 
397  template<typename PayloadType, typename X, typename Y> class ScatterPlot : public Plot2D<PayloadType,X,Y > {
398  public:
400  // the x axis label will be overwritten by the plot rendering application
401  ScatterPlot( const std::string& title, const std::string& xLabel, const std::string& yLabel ) :
402  Base( "Scatter", title, xLabel , yLabel ){
403  }
404  ~ScatterPlot() override = default;
405  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
406  for( auto iov : iovs ) {
407  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
408  if( payload.get() ){
409  std::tuple<X,Y> value = getFromPayload( *payload );
410  Base::m_plotData.push_back( value );
411  }
412  }
413  return true;
414  }
415 
416  virtual std::tuple<X,Y> getFromPayload( PayloadType& payload ) = 0;
417 
418  };
419 
420  //
421  template<typename PayloadType> class Histogram1D: public Plot2D<PayloadType,float,float > {
422  public:
424  // naive implementation, essentially provided as an example...
425  Histogram1D( const std::string& title, const std::string& xLabel, size_t nbins, float min, float max, const std::string& yLabel="entries"):
426  Base( "Histo1D", title, xLabel , yLabel),m_nbins(nbins),m_min(min),m_max(max){
427  }
428  ~Histogram1D() override = default;
429  //
430  void init() override{
431  Base::m_plotData.clear();
432  float binSize = (m_max-m_min)/m_nbins;
433  if( binSize>0 ){
434  m_binSize = binSize;
435  Base::m_plotData.resize( m_nbins );
436  for( size_t i=0;i<m_nbins;i++ ){
437  Base::m_plotData[i] = std::make_tuple( m_min+i*m_binSize, 0 );
438  }
439  }
440  }
441 
442  // to be used to fill the histogram!
443  void fillWithValue( float value, float weight=1 ){
444  // ignoring underflow/overflows ( they can be easily added - the total entries as well )
445  if( !Base::m_plotData.empty() && (value < m_max) && (value >= m_min) ){
446  size_t ibin = (value-m_min)/m_binSize;
447  std::get<1>(Base::m_plotData[ibin])+=weight;
448  }
449  }
450 
451  // to be used to fill the histogram!
452  void fillWithBinAndValue( size_t bin, float weight=1 ){
453  if(bin>=0 && bin<Base::m_plotData.size()){
454  std::get<1>(Base::m_plotData[bin])=weight;
455  }
456  }
457 
458  // this one can ( and in general should ) be overridden - the implementation should use fillWithValue
459  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
460  for( auto iov : iovs ) {
461  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
462  if( payload.get() ){
463  float value = getFromPayload( *payload );
464  fillWithValue( value );
465  }
466  }
467  return true;
468  }
469 
470  // implement this one if you use the default fill implementation, otherwise ignore it...
471  virtual float getFromPayload( PayloadType& payload ) {
472  return 0;
473  }
474 
475  private:
476  float m_binSize = 0;
477  size_t m_nbins;
478  float m_min;
479  float m_max;
480  };
481 
482  //
483  template<typename PayloadType> class Histogram2D: public Plot3D<PayloadType,float,float,float > {
484  public:
486  // naive implementation, essentially provided as an example...
487  Histogram2D( const std::string& title, const std::string& xLabel, size_t nxbins, float xmin, float xmax,
488  const std::string& yLabel, size_t nybins, float ymin, float ymax ):
489  Base( "Histo2D", title, xLabel , yLabel, "entries" ),m_nxbins( nxbins), m_xmin(xmin),m_xmax(xmax),m_nybins(nybins),m_ymin(ymin),m_ymax(ymax){
490  }
491 
492  ~Histogram2D() override = default;
493  //
494  void init() override{
495  Base::m_plotData.clear();
496  float xbinSize = (m_xmax-m_xmin)/m_nxbins;
497  float ybinSize = (m_ymax-m_ymin)/m_nybins;
498  if( xbinSize>0 && ybinSize>0){
499  m_xbinSize = xbinSize;
500  m_ybinSize = ybinSize;
501  Base::m_plotData.resize( m_nxbins*m_nybins );
502  for( size_t i=0;i<m_nybins;i++ ){
503  for( size_t j=0;j<m_nxbins;j++ ){
504  Base::m_plotData[i*m_nxbins+j] = std::make_tuple( m_xmin+j*m_xbinSize, m_ymin+i*m_ybinSize, 0 );
505  }
506  }
507  }
508  }
509 
510  // to be used to fill the histogram!
511  void fillWithValue( float xvalue, float yvalue, float weight=1 ){
512  // ignoring underflow/overflows ( they can be easily added - the total entries as well )
513  if( !Base::m_plotData.empty() && xvalue < m_xmax && xvalue >= m_xmin && yvalue < m_ymax && yvalue >= m_ymin ){
514  size_t ixbin = (xvalue-m_xmin)/m_xbinSize;
515  size_t iybin = (yvalue-m_ymin)/m_ybinSize;
516  std::get<2>(Base::m_plotData[iybin*m_nxbins+ixbin])+=weight;
517  }
518  }
519 
520  // this one can ( and in general should ) be overridden - the implementation should use fillWithValue
521  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
522  for( auto iov : iovs ) {
523  std::shared_ptr<PayloadType> payload = Base::fetchPayload( std::get<1>(iov) );
524  if( payload.get() ){
525  std::tuple<float,float> value = getFromPayload( *payload );
526  fillWithValue( std::get<0>(value),std::get<1>(value) );
527  }
528  }
529  return true;
530  }
531 
532  // implement this one if you use the default fill implementation, otherwise ignore it...
533  virtual std::tuple<float,float> getFromPayload( PayloadType& payload ) {
534  float x = 0;
535  float y = 0;
536  return std::make_tuple(x,y);
537  }
538 
539  private:
540  size_t m_nxbins;
541  float m_xbinSize = 0;
542  float m_xmin;
543  float m_xmax;
544  float m_ybinSize = 0;
545  size_t m_nybins;
546  float m_ymin;
547  float m_ymax;
548  };
549 
550  //
551  template <typename PayloadType> class PlotImage : public PlotBase {
552  public:
553  explicit PlotImage( const std::string& title ) :
554  PlotBase(){
555  m_plotAnnotations.m[PlotAnnotations::PLOT_TYPE_K] = "Image";
556  m_plotAnnotations.m[PlotAnnotations::TITLE_K] = title;
557  std::string payloadTypeName = cond::demangledName( typeid(PayloadType) );
558  m_plotAnnotations.m[PlotAnnotations::PAYLOAD_TYPE_K] = payloadTypeName;
559  m_imageFileName = boost::lexical_cast<std::string>( ( boost::uuids::random_generator())() )+".png";
560  }
561 
563  return serialize( m_plotAnnotations, m_imageFileName);
564  }
565 
566  std::string processData( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override {
567  fill( iovs );
568  return serializeData();
569  }
570 
571  std::shared_ptr<PayloadType> fetchPayload( const cond::Hash& payloadHash ){
572  return PlotBase::fetchPayload<PayloadType>( payloadHash );
573  }
574 
575  virtual bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) = 0;
576  protected:
578  };
579 
580  }
581 
582 }
583 
584 #endif
585 
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()
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
#define constexpr
TimeType
Definition: Time.h:21
ScatterPlot(const std::string &title, const std::string &xLabel, const std::string &yLabel)
virtual float getFromPayload(PayloadType &payload)
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:37
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)
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:30
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)
PlotImage(const std::string &title)