CMS 3D CMS Logo

Public Member Functions | Private Attributes

SummaryHistogramFactory< T > Class Template Reference

#include <SummaryHistogramFactory.h>

List of all members.

Public Member Functions

uint32_t extract (const std::map< uint32_t, T > &data)
void fill (TH1 &summary_histo)
void init (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &)
 SummaryHistogramFactory ()
 ~SummaryHistogramFactory ()

Private Attributes

SummaryGeneratorgenerator_
sistrip::Granularity gran_
std::string level_
sistrip::Monitorable mon_
sistrip::Presentation pres_
sistrip::View view_

Detailed Description

template<class T>
class SummaryHistogramFactory< T >

Definition at line 13 of file SummaryHistogramFactory.h.


Constructor & Destructor Documentation

template<class T >
SummaryHistogramFactory< T >::~SummaryHistogramFactory ( )

Definition at line 27 of file SummaryHistogramFactory.cc.

References LogTrace, and sistrip::mlSummaryPlots_.

                                                     {
  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
  if ( generator_ ) { delete generator_; }
}

Member Function Documentation

template<class T >
uint32_t SummaryHistogramFactory< T >::extract ( const std::map< uint32_t, T > &  data)

Definition at line 59 of file SummaryHistogramFactory.cc.

References LogTrace, and sistrip::mlSummaryPlots_.

                                                                             {
  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
  
  // Check if data are present
  if ( data.empty() ) { 
    edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]" 
                                     << " No data in monitorables std::map!";
    return 0; 
  }
  
  // Check if instance of generator class exists
  if ( !generator_ ) { 
    edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]" 
         << " NULL pointer to SummaryGenerator object!";
    return 0;
  }
  
  // Transfer appropriate monitorables info to generator object
  generator_->clearMap();
  typename std::map<uint32_t,T>::const_iterator iter = data.begin();
  for ( ; iter != data.end(); iter++ ) {
    generator_->fillMap( level_,                             // top-level directory
                         gran_,                              // granularity
                         iter->first,                        // device key
                         static_cast<float>(iter->second) ); // value
  }
  
  return generator_->size();
}
template<class T >
void SummaryHistogramFactory< T >::fill ( TH1 &  summary_histo)

Definition at line 92 of file SummaryHistogramFactory.cc.

References sistrip::HISTO_1D, sistrip::HISTO_2D_SCATTER, sistrip::HISTO_2D_SUM, LogTrace, sistrip::mlSummaryPlots_, sistrip::PROFILE_1D, and sistrip::UNKNOWN_RUN_TYPE.

                                                          {
  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
  
  // Check if instance of generator class exists
  if ( !generator_ ) { 
    edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]" 
         << " NULL pointer to SummaryGenerator object!";
    return;
  }

  // Check if instance of generator class exists
  if ( !(&summary_histo) ) { 
    edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]" 
         << " NULL pointer to SummaryGenerator object!";
    return;
  }

  // Check if std::map is filled
  if ( !generator_->size() ) { 
    edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]" 
         << " No data in the monitorables std::map!";
    return; 
  } 
  
  // Generate appropriate summary histogram 
  if ( pres_ == sistrip::HISTO_1D ) {
    generator_->histo1D( summary_histo );
  } else if ( pres_ == sistrip::HISTO_2D_SUM ) {
    generator_->histo2DSum( summary_histo );
  } else if ( pres_ == sistrip::HISTO_2D_SCATTER ) {
    generator_->histo2DScatter( summary_histo );
  } else if ( pres_ == sistrip::PROFILE_1D ) {
    generator_->profile1D( summary_histo );
  } else { return; }
  
  // Histogram formatting
  generator_->format( sistrip::UNKNOWN_RUN_TYPE, mon_, pres_, view_, level_, gran_, summary_histo );
  
}
template<class T >
void SummaryHistogramFactory< T >::init ( const sistrip::Monitorable mon,
const sistrip::Presentation pres,
const sistrip::View view,
const std::string &  top_level_dir,
const sistrip::Granularity gran 
)

Definition at line 35 of file SummaryHistogramFactory.cc.

References SummaryGenerator::instance(), LogTrace, sistrip::mlSummaryPlots_, and LaserDQM_cfi::mon.

                                                                        {
  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
  mon_ = mon;
  pres_ = pres;
  view_ = view;
  level_ = top_level_dir;
  gran_ = gran;

  // Retrieve utility class used to generate summary histograms
  if ( generator_ ) { 
    delete generator_;
    generator_ = 0;
    generator_ = SummaryGenerator::instance( view );
  }
  
}

Member Data Documentation

template<class T >
SummaryGenerator* SummaryHistogramFactory< T >::generator_ [private]
template<class T >
sistrip::Granularity SummaryHistogramFactory< T >::gran_ [private]
template<class T >
std::string SummaryHistogramFactory< T >::level_ [private]
template<class T >
sistrip::Monitorable SummaryHistogramFactory< T >::mon_ [private]
template<class T >
sistrip::Presentation SummaryHistogramFactory< T >::pres_ [private]
template<class T >
sistrip::View SummaryHistogramFactory< T >::view_ [private]