CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DQM/SiStripCommissioningSummary/src/FedCablingSummaryFactory.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSummary/interface/FedCablingSummaryFactory.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 uint32_t SummaryPlotFactory<FedCablingAnalysis*>::init( const sistrip::Monitorable& mon, 
00013                                                         const sistrip::Presentation& pres,
00014                                                         const sistrip::View& view, 
00015                                                         const std::string& level, 
00016                                                         const sistrip::Granularity& gran,
00017                                                         const std::map<uint32_t,FedCablingAnalysis*>& data ) {
00018   
00019   // Some initialisation
00020   SummaryPlotFactoryBase::init( mon, pres, view, level, gran );
00021   
00022   // Check if generator class exists
00023   if ( !SummaryPlotFactoryBase::generator_ ) { return 0; }
00024   
00025   // Extract monitorable
00026   std::map<uint32_t,FedCablingAnalysis*>::const_iterator iter = data.begin();
00027   for ( ; iter != data.end(); iter++ ) {
00028     float value = static_cast<float>(sistrip::invalid_);
00029     if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_FED_ID ) { value = iter->second->fedId(); }
00030     else if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_FED_CH ) { value = iter->second->fedCh(); }
00031     else if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_ADC_LEVEL ) { value = iter->second->adcLevel(); }
00032     else { 
00033       edm::LogWarning(mlSummaryPlots_)
00034         << "[SummaryPlotFactory::" << __func__ << "]" 
00035         << " Unexpected monitorable: "
00036         << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00037       continue; 
00038     }
00039     SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00040                                                  SummaryPlotFactoryBase::gran_, 
00041                                                  iter->first, 
00042                                                  value );
00043   }
00044   
00045   return SummaryPlotFactoryBase::generator_->nBins();
00046   
00047 }
00048 
00049 //------------------------------------------------------------------------------
00050 //
00051 void SummaryPlotFactory<FedCablingAnalysis*>::fill( TH1& summary_histo ) {
00052   
00053   // Histogram filling and formating
00054   SummaryPlotFactoryBase::fill( summary_histo );
00055   
00056   if ( !SummaryPlotFactoryBase::generator_ ) { return; }
00057   
00058   // Histogram formatting
00059   if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_FED_ID ) {
00060     SummaryPlotFactoryBase::generator_->axisLabel( "FED id" );
00061   } else if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_FED_CH ) {
00062     SummaryPlotFactoryBase::generator_->axisLabel( "FED channel" );
00063   } else if ( SummaryPlotFactoryBase::mon_ == sistrip::FED_CABLING_ADC_LEVEL ) {
00064     SummaryPlotFactoryBase::generator_->axisLabel( "Signal level [ADC]" );
00065   } else { 
00066     edm::LogWarning(mlSummaryPlots_)
00067       << "[SummaryPlotFactory::" << __func__ << "]" 
00068       << " Unexpected SummaryHisto value:"
00069       << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00070   } 
00071   
00072 }
00073 
00074 // -----------------------------------------------------------------------------
00075 //
00076 template class SummaryPlotFactory<FedCablingAnalysis*>;
00077