Go to the documentation of this file.00001 #include "DQM/SiStripCommissioningSummary/interface/FedTimingSummaryFactory.h"
00002 #include "DQM/SiStripCommissioningSummary/interface/SummaryGenerator.h"
00003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include <iostream>
00006 #include <sstream>
00007
00008 using namespace sistrip;
00009
00010
00011
00012 SummaryHistogramFactory<FedTimingAnalysis>::SummaryHistogramFactory() :
00013 mon_(sistrip::UNKNOWN_MONITORABLE),
00014 pres_(sistrip::UNKNOWN_PRESENTATION),
00015 view_(sistrip::UNKNOWN_VIEW),
00016 level_(sistrip::root_),
00017 gran_(sistrip::UNKNOWN_GRAN),
00018 generator_(0)
00019 {;}
00020
00021
00022
00023
00024 SummaryHistogramFactory<FedTimingAnalysis>::~SummaryHistogramFactory() {
00025 if ( generator_ ) { delete generator_; }
00026 }
00027
00028
00029
00030 void SummaryHistogramFactory<FedTimingAnalysis>::init( const sistrip::Monitorable& mon,
00031 const sistrip::Presentation& pres,
00032 const sistrip::View& view,
00033 const std::string& top_level_dir,
00034 const sistrip::Granularity& gran ) {
00035 LogTrace(mlSummaryPlots_)
00036 << "[SummaryHistogramFactory::" << __func__ << "]";
00037 mon_ = mon;
00038 pres_ = pres;
00039 view_ = view;
00040 level_ = top_level_dir;
00041 gran_ = gran;
00042
00043
00044 if ( generator_ ) { delete generator_; generator_ = 0; }
00045 generator_ = SummaryGenerator::instance( view );
00046
00047 }
00048
00049
00050
00051 uint32_t SummaryHistogramFactory<FedTimingAnalysis>::extract( const std::map<uint32_t,FedTimingAnalysis>& data ) {
00052
00053
00054 if ( data.empty() ) {
00055 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00056 << " No data in monitorables std::map!";
00057 return 0;
00058 }
00059
00060
00061 if ( !generator_ ) {
00062 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00063 << " NULL pointer to SummaryGenerator object!";
00064 return 0;
00065 }
00066
00067
00068 generator_->clearMap();
00069 std::map<uint32_t,FedTimingAnalysis>::const_iterator iter = data.begin();
00070 for ( ; iter != data.end(); iter++ ) {
00071 if ( mon_ == sistrip::FED_TIMING_TIME ) {
00072 generator_->fillMap( level_, gran_, iter->first, iter->second.time() );
00073 } else if ( mon_ == sistrip::FED_TIMING_MAX_TIME ) {
00074 generator_->fillMap( level_, gran_, iter->first, iter->second.max() );
00075 } else if ( mon_ == sistrip::FED_TIMING_DELAY ) {
00076 generator_->fillMap( level_, gran_, iter->first, iter->second.delay() );
00077 } else if ( mon_ == sistrip::FED_TIMING_ERROR ) {
00078 generator_->fillMap( level_, gran_, iter->first, iter->second.error() );
00079 } else if ( mon_ == sistrip::FED_TIMING_BASE ) {
00080 generator_->fillMap( level_, gran_, iter->first, iter->second.base() );
00081 } else if ( mon_ == sistrip::FED_TIMING_PEAK ) {
00082 generator_->fillMap( level_, gran_, iter->first, iter->second.peak() );
00083 } else if ( mon_ == sistrip::FED_TIMING_HEIGHT ) {
00084 generator_->fillMap( level_, gran_, iter->first, iter->second.height() );
00085 } else {
00086 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00087 << " Unexpected SummaryHisto value:"
00088 << SiStripEnumsAndStrings::monitorable( mon_ )
00089 ;
00090 continue;
00091 }
00092 }
00093 return generator_->size();
00094 }
00095
00096
00097
00098 void SummaryHistogramFactory<FedTimingAnalysis>::fill( TH1& summary_histo ) {
00099
00100
00101 if ( !generator_ ) {
00102 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00103 << " NULL pointer to SummaryGenerator object!";
00104 return;
00105 }
00106
00107
00108 if ( !(&summary_histo) ) {
00109 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00110 << " NULL pointer to SummaryGenerator object!";
00111 return;
00112 }
00113
00114
00115 if ( !generator_->size() ) {
00116 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00117 << " No data in the monitorables std::map!";
00118 return;
00119 }
00120
00121
00122 if ( pres_ == sistrip::HISTO_1D ) {
00123 generator_->histo1D( summary_histo );
00124 } else if ( pres_ == sistrip::HISTO_2D_SUM ) {
00125 generator_->histo2DSum( summary_histo );
00126 } else if ( pres_ == sistrip::HISTO_2D_SCATTER ) {
00127 generator_->histo2DScatter( summary_histo );
00128 } else if ( pres_ == sistrip::PROFILE_1D ) {
00129 generator_->profile1D( summary_histo );
00130 } else {
00131 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00132 << " Unexpected SummaryType value:"
00133 << SiStripEnumsAndStrings::presentation( pres_ )
00134 ;
00135 return;
00136 }
00137
00138
00139 if ( mon_ == sistrip::FED_TIMING_TIME ) {
00140 } else if ( mon_ == sistrip::FED_TIMING_MAX_TIME ) {
00141 } else if ( mon_ == sistrip::FED_TIMING_DELAY ) {
00142 } else if ( mon_ == sistrip::FED_TIMING_ERROR ) {
00143 } else if ( mon_ == sistrip::FED_TIMING_BASE ) {
00144 } else if ( mon_ == sistrip::FED_TIMING_PEAK ) {
00145 } else if ( mon_ == sistrip::FED_TIMING_HEIGHT ) {
00146 } else {
00147 edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
00148 << " Unexpected SummaryHisto value:"
00149 << SiStripEnumsAndStrings::monitorable( mon_ )
00150 ;
00151 }
00152 generator_->format( sistrip::FED_TIMING, mon_, pres_, view_, level_, gran_, summary_histo );
00153
00154 }
00155
00156
00157
00158 template class SummaryHistogramFactory<FedTimingAnalysis>;
00159